private void OnLineCallState(LINEMESSAGE msg) { bool bNewCall = false; if (!Calls.Contains(msg.hDevice)) { Calls.Add(msg.hDevice, new Call(msg.hDevice)); bNewCall = true; } if (Calls.Contains(msg.hDevice)) { Call call = Calls[msg.hDevice] as Call; call.OnLineCallState(msg); if (bNewCall) { call.LoadCallInfo(); Line line = Lines[call.Info.hLine] as Line; call.m_line = line; if (line != null) { line.OnNewCall(call); } } } }
private void OnNewCall(LINEMESSAGE msg) { bool bNewCall = false; if (!Calls.Contains(msg.dwParam2)) { Calls.Add(msg.dwParam2, new Call(msg.dwParam2)); bNewCall = true; } if (Calls.Contains(msg.dwParam2)) { Call call = Calls[msg.dwParam2] as Call; call.m_addressID = msg.dwParam1.ToInt32(); if (call.m_line == null) { Line line = Lines[msg.hDevice] as Line; call.m_line = line; if (bNewCall && line != null) { line.OnNewCall(call); } } } }
protected void OnMessage(LINEMESSAGE msg) { if (LineMessage != null) { LineMessage(msg); } }
protected internal void OnLineCallState(LINEMESSAGE msg) { m_state = (LINECALLSTATE)msg.dwParam1.ToInt32(); if (CallState != null) { CallState(this, m_state); } // if ( m_state == LINECALLSTATE.LINECALLSTATE_IDLE ) // Dispose(); }
protected void OnLineClose(LINEMESSAGE msg) { IntPtr hLine = msg.hDevice; Line line = Lines[hLine] as Line; if (line != null) { line.Dispose(); } }
protected internal void OnLineCallInfo(LINEMESSAGE msg) { LINECALLINFOSTATE infoState = (LINECALLINFOSTATE)msg.dwParam1.ToInt32(); LoadCallInfo(); if ((infoState & LINECALLINFOSTATE.CALLERID) == LINECALLINFOSTATE.CALLERID) { if (m_info.dwCallerIDSize != 0) { m_callerID = Encoding.Unicode.GetString(m_info.Data, m_info.dwCallerIDOffset, m_info.dwCallerIDSize - 1); } } if (CallInfo != null) { CallInfo(this, (LINECALLINFOSTATE)msg.dwParam1.ToInt32(), m_info); } }
protected void OnLineReply(LINEMESSAGE msg) { lock (PendingRequests.SyncRoot) { object ar = PendingRequests[(int)msg.dwParam1]; if (ar != null) { if (ar is MakeCallAsyncResult) { ((ar as MakeCallAsyncResult).AsyncWaitHandle as ManualResetEvent).Set(); if ((ar as MakeCallAsyncResult).Callback != null) { (ar as MakeCallAsyncResult).Callback(ar as IAsyncResult); } } PendingRequests.Remove((int)msg.dwParam1); } } }
extern static public int lineGetMessage(IntPtr m_hLineApp, out LINEMESSAGE lpMessage, int dwTimeout);
protected internal void OnLineMonitorTones(LINEMESSAGE msg) { }