public void OnCallStateChanged(object sender, CallStateArgs e) { if (AccountId != e.AccountId) { return; } int userData = App.SIPUA.GetCallUserData(e.CallId); if (userData != 0 && userData != (int)Id) { return; } if (e.STATE == sua_inv_state.PJSIP_INV_STATE_CONFIRMED) { Channel.IsBusy = true; Channel.CallId = e.CallId; SIPUri uri = new SIPUri(e.RemoteUri); Channel.SectionName = uri.User; } else if (e.STATE == sua_inv_state.PJSIP_INV_STATE_DISCONNECTED) { Channel.CallId = -1; Channel.IsBusy = false; Channel.SectionName = string.Empty; Channel.ZoneName = string.Empty; } }
public bool StartRecording(string dir) { if (!IsChannelBusy || RecorderId != -1) { return(false); } sua_call_info info = new sua_call_info(); App.SIPUA.GetCallInfo(CallId, ref info); SIPUri remteUri = new SIPUri(info.remote_uri); SIPUri localUri = new SIPUri(info.local_uri); string caller, callee; if ((sua_role_e)info.call_role == sua_role_e.SUA_ROLE_UAS) { caller = remteUri.User; callee = localUri.User; } else { callee = remteUri.User; caller = localUri.User; } string filename = RecordingFiles.BuildRecordingFileName(dir, DateTime.Now, caller, callee); int recordId = -1; if (App.SIPUA.StartRecording(CallId, filename, ref recordId)) { RecorderId = recordId; return(true); } return(false); }