/// <summary> /// Stop the conversation between callers. /// </summary> /// <param name="caller">The caller to stop the conversation with.</param> public void StopConversation(CallParam caller) { // Combine the audio media. List <AudioMedia> local = new List <AudioMedia>(); local.AddRange(_audioMedias); local.AddRange(caller.AudioMedia); // For each call. for (int i = 0; i < local.Count; i++) { // Get first group. AudioMedia mediaCall_1 = local[i]; // For each call. for (int j = 0; j < local.Count; j++) { // Get second group. AudioMedia mediaCall_2 = local[j]; // If the two audio media are not equal. if (mediaCall_1.GetPortId() != mediaCall_2.GetPortId()) { // Stop these two calls from communicating. mediaCall_1.StopTransmit(mediaCall_2); } } } }
/// <summary> /// Make outgoing call to the specified URI. /// </summary> /// <param name="callId">An index call id (0 - 3).</param> /// <param name="uri">URI to be put in the To header (normally is the same as the target URI).</param> /// <param name="recordFilename">The path and filename where the conversation is to be recorded to. Currently ".wav" is supported on all platforms.</param> /// <param name="includeVideo">Should that call include video.</param> /// <returns>The call information.</returns> public Param.CallParam MakeCall(int callId, string uri, string recordFilename = null, bool includeVideo = false) { // If created. if (_created) { // Create a new call. Call call = new Call(_account, callId); // Create the call settings. CallSetting setting = new CallSetting(true); CallOpParam parm = new CallOpParam(true); setting.AudioCount = (uint)1; setting.VideoCount = (includeVideo ? (uint)1 : (uint)0); parm.Setting = setting; // Make the call. call.MakeCall(uri, parm); // return the call information. Param.CallParam callInfo = new Param.CallParam(call, _mediaManager, recordFilename); return(callInfo); } else { throw new Exception("Create the account first."); } }
/// <summary> /// Notify application on incoming call. /// </summary> ///<param name="sender">The current sender.</param> /// <param name="e">The event parameter.</param> private void _voipManager_OnIncomingCall(object sender, OnIncomingCallParam e) { // Is valid call. if (e.CallId >= 0) { // Create a new call. Call call = _voipManager.CreateCall(e.CallId); Param.CallParam callInfo = new Param.CallParam(call, _voipManager.MediaManager, _recordFilename); // Create the call settings. CallSetting setting = new CallSetting(true); CallOpParam parm = new CallOpParam(true); setting.AudioCount = 1; setting.VideoCount = 1; parm.Setting = setting; // Continue ringing. parm.Code = StatusCode.SC_RINGING; call.Answer(parm); // Send a notification to the call. Param.OnIncomingCallParam param = new Param.OnIncomingCallParam(); param.CallID = e.CallId; param.Info = e.RxData.Info; param.SrcAddress = e.RxData.SrcAddress; param.WholeMsg = e.RxData.WholeMsg; param.Call = callInfo; param.Contact = FindContact(param); // Call the event handler. OnIncomingCall?.Invoke(this, param); } }
/// <summary> /// Send DTMF digits to remote using RFC 2833 payload formats. /// </summary> /// <param name="call">The current call.</param> /// <param name="digits">DTMF string digits to be sent.</param> public void DialDtmf(Param.CallParam call, string digits) { // If created. if (_created) { call.DialDtmf(digits); } else { throw new Exception("Create the account first."); } }
/// <summary> /// Transfer replace the current call. /// </summary> /// <param name="call">The existing call.</param> public void TransferReplaces(CallParam call) { // Create the call settings. CallSetting setting = new CallSetting(true); CallOpParam parm = new CallOpParam(true); setting.AudioCount = (uint)1; setting.VideoCount = (_hasVideo ? (uint)1 : (uint)0); parm.Setting = setting; parm.Code = StatusCode.SC_OK; if (_call != null) { // Transfer. _call.TransferReplaces(call.Call, parm); } }
/// <summary> /// Send DTMF digits to remote using RFC 2833 payload formats. /// </summary> /// <param name="call">The current call.</param> /// <param name="digits">DTMF string digits to be sent.</param> public void DialDtmf(Param.CallParam call, string digits) { call.DialDtmf(digits); }