//拨号 public string CallPhone(int lineNum, string phone) { LineInfo line = Lines[lineNum]; //判断话务员是否摘机 if (line.State != (int)state.CH_DETECT) { return("请先摘机,然后拨号!"); } //如果是内线,并且状态为空闲 if (line.Type == (int)type.CHTYPE_USER) { //执行拨号 LineInfo inline = Lines[lineNum]; int trunk = getFreeTrunk(); LineInfo outline = Lines[trunk]; InvokeVcDll.StartPlaySignal((ushort)lineNum, (ushort)signal.SIG_STOP); InvokeVcDll.StopPlayFile((ushort)lineNum); InvokeVcDll.StopPlayFile((ushort)trunk); inline.ConnectToLine = trunk; inline.CallerPhone = phone; outline.ConnectToLine = lineNum; outline.CallerPhone = phone; outline.IsKey = false; InvokeVcDll.OffHook((ushort)trunk); outline.State = (int)state.CH_CALLPHONE; InvokeVcDll.SendDtmfBuf((ushort)trunk, phone); } return("sucessful"); }