From 63b2654b54488c74b10de76a6a474ef79aa18bc5 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 25 Jul 2012 19:47:41 -0400 Subject: [PATCH] commit -- fix stash pop err --- libs/freetdm/mod_freetdm/tdm.c | 1 - .../media_gateway_cmd_handler.c | 29 +++++++++++++++---- src/mod/endpoints/mod_sofia/rtp.c | 2 ++ 3 files changed, 26 insertions(+), 6 deletions(-) diff --git a/libs/freetdm/mod_freetdm/tdm.c b/libs/freetdm/mod_freetdm/tdm.c index 5c259e0cd1..de52934570 100644 --- a/libs/freetdm/mod_freetdm/tdm.c +++ b/libs/freetdm/mod_freetdm/tdm.c @@ -119,7 +119,6 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi chan_id = atoi(szchanid); - if (ftdm_span_find_by_name(span_name, &span) == FTDM_SUCCESS) { span_id = ftdm_span_get_id(span); } else { diff --git a/src/mod/endpoints/mod_media_gateway/media_gateway_cmd_handler.c b/src/mod/endpoints/mod_media_gateway/media_gateway_cmd_handler.c index 5f756ac249..e040340e2c 100644 --- a/src/mod/endpoints/mod_media_gateway/media_gateway_cmd_handler.c +++ b/src/mod/endpoints/mod_media_gateway/media_gateway_cmd_handler.c @@ -540,8 +540,14 @@ switch_status_t handle_mg_add_cmd(megaco_profile_t* mg_profile, MgMgcoCommand *i MG_SET_VAL_PRES(new_ctxtId->val, mg_ctxt->context_id); } else { - /* context already present */ - memcpy(new_ctxtId, &inc_cmd->contextId,sizeof(MgMgcoContextId)); + /* context already present */ + memcpy(new_ctxtId, &inc_cmd->contextId,sizeof(MgMgcoContextId)); + mg_ctxt = megaco_get_context(mg_profile, inc_cmd->contextId.val.val); + if(NULL == mg_ctxt){ + mg_util_set_err_string(&errTxt, " Resource Failure "); + err_code = MGT_MGCO_RSP_CODE_RSRC_ERROR; + goto error; + } } /********************************************************************/ @@ -565,6 +571,17 @@ switch_status_t handle_mg_add_cmd(megaco_profile_t* mg_profile, MgMgcoCommand *i /* allocate rtp term and associated the same to context */ /********************************************************************/ }else{ /* Physical termination */ + printf("termId->name.lcl.val[%s]\n",termId->name.lcl.val); + term = megaco_find_termination(mg_profile, (char*)termId->name.lcl.val); + + if(NULL == term){ + mg_util_set_err_string(&errTxt, " Resource Failure "); + err_code = MGT_MGCO_RSP_CODE_RSRC_ERROR; + goto error; + } + + switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_INFO," Allocated Termination[%p] with term name[%s]\n", (void*)term, term->name); + /* get physical termination */ } @@ -672,9 +689,10 @@ switch_status_t handle_mg_add_cmd(megaco_profile_t* mg_profile, MgMgcoCommand *i MgMgcoLocalDesc *local; CmSdpInfoSet *psdp; char* ipAddress[4];// = "192.168.1.1"; + char* dup = strdup((char*)term->u.rtp.local_addr); MgMgcoMediaDesc* media = &desc->u.media; - switch_split((char*)term->u.rtp.local_addr,'.',ipAddress); + switch_split(dup,'.',ipAddress); printf("ipAddress[0]=%s, ipAddress[1]=%s, ipAddress[2]=%s,ipAddress[3]=%s\n",ipAddress[0],ipAddress[1],ipAddress[2],ipAddress[3]); @@ -812,8 +830,7 @@ switch_status_t handle_mg_add_cmd(megaco_profile_t* mg_profile, MgMgcoCommand *i MG_INIT_TOKEN_VALUE(&(media->field.id.u.port.type),CM_SDP_PORT_INT); MG_INIT_TOKEN_VALUE(&(media->field.id.u.port.u.portInt.pres),1); MG_INIT_TOKEN_VALUE(&(media->field.id.u.port.u.portInt.port.type), CM_SDP_SPEC); - //MG_INIT_TOKEN_VALUE(&(media->field.id.u.port.u.portInt.port.val), term->u.rtp.local_port); - MG_INIT_TOKEN_VALUE(&(media->field.id.u.port.u.portInt.port.val), 2904); + MG_INIT_TOKEN_VALUE(&(media->field.id.u.port.u.portInt.port.val), term->u.rtp.local_port); if (mgUtlGrowList((void ***)&media->field.par.pflst, sizeof(CmSdpMedProtoFmts), &media->field.par.numProtFmts, &rsp.u.mgCmdRsp[0]->memCp) != ROK) @@ -852,6 +869,8 @@ switch_status_t handle_mg_add_cmd(megaco_profile_t* mg_profile, MgMgcoCommand *i MG_INIT_TOKEN_VALUE(&(media->attrSet.attr[0]->u.ptime), term->u.rtp.ptime); } } + + free(dup); } diff --git a/src/mod/endpoints/mod_sofia/rtp.c b/src/mod/endpoints/mod_sofia/rtp.c index 631c8e7711..3ab784d74d 100644 --- a/src/mod/endpoints/mod_sofia/rtp.c +++ b/src/mod/endpoints/mod_sofia/rtp.c @@ -431,6 +431,8 @@ static switch_status_t channel_receive_event(switch_core_session_t *session, swi } else { switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_ERROR, "Received unknown command [%s] in event.\n", !command ? "null" : command); } + + return SWITCH_STATUS_SUCCESS; } static switch_status_t channel_receive_message(switch_core_session_t *session, switch_core_session_message_t *msg)