]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
commit -- fix stash pop err
authorroot <root@nsg-media-test.sangoma.local>
Wed, 25 Jul 2012 23:47:41 +0000 (19:47 -0400)
committerroot <root@nsg-media-test.sangoma.local>
Wed, 25 Jul 2012 23:47:41 +0000 (19:47 -0400)
libs/freetdm/mod_freetdm/tdm.c
src/mod/endpoints/mod_media_gateway/media_gateway_cmd_handler.c
src/mod/endpoints/mod_sofia/rtp.c

index 5c259e0cd1edd14cf188fd526ce77f195da4629b..de52934570a6bb1226ce69062a78b8c1e5d3403d 100644 (file)
@@ -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 {
index 5f756ac24979cf5dc93817a088e12acfc07c4d6e..e040340e2c690a7b08c6e43c603df2d9a529e55a 100644 (file)
@@ -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);
        }
 
 
index 631c8e7711fe4d22cf7151451b76eb3bbbe2e1c1..3ab784d74d8dd375161d1b5066b5cc233d41ce34 100644 (file)
@@ -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)