err_code = MGT_MGCO_RSP_CODE_DUP_TERM_CTXT;
goto error;
}
- /********************************************************************/
- /* associate physical termination to context */
- if(SWITCH_STATUS_FALSE == megaco_context_add_termination(mg_ctxt, term)){
- switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_ERROR,"megaco_context_add_termination failed \n");
- mg_util_set_err_string(&errTxt, " Resource Failure ");
- err_code = MGT_MGCO_RSP_CODE_RSRC_ERROR;
- goto error;
- }
-
- /********************************************************************/
+/********************************************************************/
ret = mg_prc_descriptors(mg_profile, inc_cmd, term, &inc_cmd->u.mgCmdInd[0]->memCp);
err_code = MGT_MGCP_RSP_CODE_INCONSISTENT_LCL_OPT;
goto error;
}
+ /********************************************************************/
+ /* associate physical termination to context */
+
+ if(SWITCH_STATUS_FALSE == megaco_context_add_termination(mg_ctxt, term)){
+ switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_ERROR,"megaco_context_add_termination failed \n");
+ mg_util_set_err_string(&errTxt, " Resource Failure ");
+ err_code = MGT_MGCO_RSP_CODE_RSRC_ERROR;
+ goto error;
+ }
+
+
/* TODO - locally assigned SDP must be the part of termination...which we can use to fill responses*/
switch_port_t local_port;
switch_port_t remote_port;
switch_payload_t agreed_pt; /*XXX*/
+ switch_payload_t rfc2833_pt;
+
sofia_dtmf_t dtmf_type;
enum {
RTP_SENDONLY,
*codec = switch_event_get_header_nil(var_event, kCODEC),
*szptime = switch_event_get_header_nil(var_event, kPTIME),
//*mode = switch_event_get_header_nil(var_event, kMODE),
- //*szrfc2833_pt = switch_event_get_header_nil(var_event, kRFC2833PT),
+ *szrfc2833_pt = switch_event_get_header_nil(var_event, kRFC2833PT),
*szrate = switch_event_get_header_nil(var_event, kRATE),
*szpt = switch_event_get_header_nil(var_event, kPT);
remote_port = !zstr(szremote_port) ? atoi(szremote_port) : 0;
int ptime = !zstr(szptime) ? atoi(szptime) : 0,
- //rfc2833_pt = !zstr(szrfc2833_pt) ? atoi(szrfc2833_pt) : 0,
+ rfc2833_pt = !zstr(szrfc2833_pt) ? atoi(szrfc2833_pt) : 0,
rate = !zstr(szrate) ? atoi(szrate) : 8000,
pt = !zstr(szpt) ? atoi(szpt) : 0;
tech_pvt->remote_port = remote_port;
tech_pvt->ptime = ptime;
tech_pvt->agreed_pt = pt;
- tech_pvt->dtmf_type = DTMF_2833; /* XXX */
+ tech_pvt->rfc2833_pt = rfc2833_pt;
+ if (rfc2833_pt) {
+ tech_pvt->dtmf_type = DTMF_2833;
+ } else {
+ tech_pvt->dtmf_type = DTMF_NONE;
+ }
if (zstr(local_addr) || local_port == 0) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "The local address and port must be set\n");
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't setup RTP session: [%s]\n", err);
goto fail;
}
+
+ if (tech_pvt->dtmf_type == DTMF_2833) {
+ switch_rtp_set_telephony_event(tech_pvt->rtp_session, tech_pvt->rfc2833_pt);
+ }
if (switch_core_session_thread_launch(*new_session) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't start session thread.\n");
if (compare_var(event, channel, kRFC2833PT)) {
const char *szpt = switch_channel_get_variable(channel, kRFC2833PT);
int pt = !zstr(szpt) ? atoi(szpt) : 0;
+
+ tech_pvt->rfc2833_pt = pt;
+
+ if (pt) {
+ tech_pvt->dtmf_type = DTMF_2833;
+ } else {
+ tech_pvt->dtmf_type = DTMF_NONE;
+ }
switch_channel_set_variable(channel, kRFC2833PT, szpt);
switch_rtp_set_telephony_event(tech_pvt->rtp_session, pt);
}
-
} else {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Received unknown command [%s] in event.\n", !command ? "null" : command);
}