//退出 public void Exit() { for (int i = 0; i < Lines.Count; i++) { ResetLine((ushort)i); } InvokeVcDll.DisableCard(); InvokeVcDll.FreeDRV(); }
/** * 初始化语音通道 **/ public void InitLines(ObservableCollection <LineInfo> objs) { //加载语音通道配置文件 String currentDir = Environment.CurrentDirectory; String path = System.IO.Path.Combine(currentDir, "lines.xml"); XElement lineConfig = XElement.Load(System.Xml.XmlReader.Create(path)); ushort TotalLine = InvokeVcDll.CheckValidCh(); for (int ch = 0; ch < TotalLine; ch++) { ushort type = InvokeVcDll.CheckChTypeNew(ch); LineInfo line = new LineInfo(); line.Number = (ushort)ch; line.Type = type; line.ConnectToLine = -1; line.State = (int)state.CH_FREE; line.CallerPhone = ""; line.RecordFile = ""; line.LastTime = System.DateTime.Now; line.Comingtime = System.DateTime.Now; line.Rectime = System.DateTime.Now;; line.Handuptime = System.DateTime.Now; line.Id = ""; line.Gonghao = ""; line.IsKey = false; line.Islink = "no"; line.ListenNum = -1; //查找配置文件中内容,设置通道属性 if (lineConfig != null) { XElement element = lineConfig.Elements().Where(e => e.Attribute("num").Value == ch + "").FirstOrDefault(); if (element != null) { //设定通道自动接通的开始和结束小时 string shour = (string)element.Attribute("starthour").Value; string ehour = (string)element.Attribute("endhour").Value; line.StartHour = shour; line.EndHour = ehour; } } objs.Add(line); } //给每条通道分配初始语音缓冲区 if (InvokeVcDll.EnableCard(TotalLine, 1024 * 128) != (long)0) { InvokeVcDll.FreeDRV(); } }