protected virtual void AnswerCall(RESTapi.media_type MediaType = RESTapi.media_type.audiovideo, bool AsyncCompletion = true) { /// <call answer="yes" media="audiovideo" signaling="yes" dtmf_mode="rfc2833" async_completion="yes" /// async_dtmf="yes" async_tone="yes" rx_delta="+0dB" tx_delta="+0dB" cpa="no" info_ack_mode="automatic"/> /// RESTapi.web_service ws = new RESTapi.web_service() { Item = new RESTapi.call() { answer = RESTapi.boolean_type.yes, answerSpecified = true, async_completion = AsyncCompletion ? RESTapi.boolean_type.yes : RESTapi.boolean_type.no, async_completionSpecified = true, media = MediaType, mediaSpecified = true, dtmf_mode = RESTapi.dtmf_mode_option.rfc2833, async_dtmf = RESTapi.boolean_type.yes, async_dtmfSpecified = true, async_tone = RESTapi.boolean_type.yes, async_toneSpecified = true, info_ack_mode = RESTapi.ack_mode_option.automatic, info_ack_modeSpecified = true, } }; String responseString = String.Empty; if (RestHelpers.SendHttpRequest(out responseString, CallURI, "PUT", ws)) { LoggingSingleton.Instance.Message(LogType.Library, LogLevel.Debug1, "Call::AnswerCall : AnswerCall OK"); LoggingSingleton.Instance.Message(LogType.Library, LogLevel.Debug1, responseString); // Note: If we use async_completion, we DON'T have to put the event // manually as it will (or rather... should) appear as a separate // event from the XMS server... // if (!AsyncCompletion) { PutEvent(RESTapi.event_type.answered); } } else { LoggingSingleton.Instance.Message(LogType.Library, LogLevel.Error, "Call::AnswerCall : AnswerCall failed!"); Hangup(); } }
protected virtual void AcceptCall(bool EarlyMedia = true, RESTapi.media_type MediaType = RESTapi.media_type.audiovideo) { /// <call accept="yes" early_media="yes" media="audiovideo" signaling="yes" dtmf_mode="rfc2833" /// async_dtmf="yes" async_tone="yes" rx_delta="+0dB" tx_delta="+0dB" cpa="no" info_ack_mode="automatic"/> /// RESTapi.web_service ws = new RESTapi.web_service() { Item = new RESTapi.call() { accept = RESTapi.boolean_type.yes, acceptSpecified = true, early_media = EarlyMedia ? RESTapi.boolean_type.yes : RESTapi.boolean_type.no, early_mediaSpecified = true, media = MediaType, mediaSpecified = true, dtmf_mode = RESTapi.dtmf_mode_option.rfc2833, async_dtmf = RESTapi.boolean_type.yes, async_dtmfSpecified = true, async_tone = RESTapi.boolean_type.yes, async_toneSpecified = true, info_ack_mode = RESTapi.ack_mode_option.automatic, info_ack_modeSpecified = true, } }; String responseString = String.Empty; if (RestHelpers.SendHttpRequest(out responseString, CallURI, "PUT", ws)) { LoggingSingleton.Instance.Message(LogType.Library, LogLevel.Debug1, "Call::AcceptCall : Accept call OK"); LoggingSingleton.Instance.Message(LogType.Library, LogLevel.Debug1, responseString); PutEvent(RESTapi.event_type.ringing); } else { LoggingSingleton.Instance.Message(LogType.Library, LogLevel.Error, "Call::AcceptCall : Accept call failed!"); Hangup(); } }