fixing local sdp issue

This commit is contained in:
root 2012-07-26 15:02:25 -04:00
parent 20f900c64a
commit b1b2bee362
3 changed files with 54 additions and 44 deletions

View File

@ -498,6 +498,10 @@ switch_status_t handle_mg_add_cmd(megaco_profile_t* mg_profile, MgMgcoCommand *i
/*MgMgcoStreamDesc* inc_strm_desc;*/
MgMgcoAudRetParm *desc;
mg_context_t* mg_ctxt;
int mediaId;
MgMgcoLocalDesc *local = NULL;
CmSdpInfoSet *psdp = NULL;
/* TODO - Kapil dummy line , will need to add with proper code */
inc_med_desc = &cmd->dl.descs[0]->u.media;
@ -686,18 +690,25 @@ switch_status_t handle_mg_add_cmd(megaco_profile_t* mg_profile, MgMgcoCommand *i
}
/* copy media descriptor */
desc = rsp.u.mgCmdRsp[0]->u.add.audit.parms[rsp.u.mgCmdRsp[0]->u.add.audit.num.val-1];
desc->type.pres = PRSNT_NODEF;
desc->type.val = MGT_MEDIADESC;
mgUtlCpyMgMgcoMediaDesc(&desc->u.media, inc_med_desc, &rsp.u.mgCmdRsp[0]->memCp);
/* see if we have received local descriptor */
if((NOTPRSNT != desc->u.media.num.pres) &&
(0 != desc->u.media.num.val))
{
for(mediaId=0; mediaId<desc->u.media.num.val; mediaId++) {
if(MGT_MEDIAPAR_LOCAL == desc->u.media.parms[mediaId]->type.val) {
local = &desc->u.media.parms[mediaId]->u.local;
}
}
}
/* only for RTP */
if(is_rtp){
/* build local descriptors */
/*MgMgcoStreamDesc *stream;*/
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;
@ -705,6 +716,7 @@ switch_status_t handle_mg_add_cmd(megaco_profile_t* mg_profile, MgMgcoCommand *i
switch_split(dup,'.',ipAddress);
/* Most probably we need to add local descriptor */
if(!local){
/* allocating mem for local descriptor */
if (mgUtlGrowList((void ***)&media->parms, sizeof(MgMgcoMediaPar),
@ -744,6 +756,7 @@ switch_status_t handle_mg_add_cmd(megaco_profile_t* mg_profile, MgMgcoCommand *i
media->parms[media->num.val-1]->type.val = MGT_MEDIAPAR_LOCAL;
local = &media->parms[media->num.val-1]->u.local;
}
local->pres.pres = PRSNT_NODEF;

View File

@ -112,8 +112,6 @@ S16 mg_fill_mgco_termid ( MgMgcoTermId *termId, char* term_str, int term_len, C
/*MG_GETMEM(termId->name.lcl.val, termId->name.lcl.len , memCp, ret);*/
ret = mg_stack_alloc_mem((Ptr*)&termId->name.lcl.val,term_len);
printf("termId->name.lcl.val[%p]\n",termId->name.lcl.val);
if( ret != ROK)
RETVALUE(ret);
@ -121,7 +119,7 @@ S16 mg_fill_mgco_termid ( MgMgcoTermId *termId, char* term_str, int term_len, C
strncpy((char*)(termId->name.lcl.val), term_str, termId->name.lcl.len);
termId->name.lcl.val[termId->name.lcl.len] = '\0';
printf("mg_fill_mgco_termid: name.lcl.val[%s], len[%d], term_str[%s], term_len[%d]\n",termId->name.lcl.val, termId->name.lcl.len, term_str,term_len);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE,"mg_fill_mgco_termid: name.lcl.val[%s], len[%d], term_str[%s], term_len[%d]\n",termId->name.lcl.val, termId->name.lcl.len, term_str,term_len);
}
@ -742,8 +740,8 @@ void mgco_print_sdp_attr_set(CmSdpAttrSet *s)
void mgco_handle_sdp_c_line(CmSdpConn *s, mg_termination_t* term, mgco_sdp_types_e sdp_type)
{
char ipadd[12];
memset(ipadd, 0, 12);
char ipadd[32];
memset(ipadd, 0, sizeof(ipadd));
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "********** SDP connection line ****** \n");
@ -770,11 +768,10 @@ void mgco_handle_sdp_c_line(CmSdpConn *s, mg_termination_t* term, mgco_sdp_types
s->u.ip4.u.uniIp.b[1].val,
s->u.ip4.u.uniIp.b[2].val,
s->u.ip4.u.uniIp.b[3].val);
printf("Remote ip = %s \n", ipadd);
/* update remote ip */
if(MG_TERM_RTP == term->type){
term->u.rtp.remote_addr = strdup(ipadd);
printf("Update remote ip to [%s]\n", term->u.rtp.remote_addr);
term->u.rtp.remote_addr = switch_core_strdup(term->pool,ipadd);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE,"Update remote ip to [%s]\n", term->u.rtp.remote_addr);
}
}
}

View File

@ -111,8 +111,8 @@ struct mg_termination_s {
megaco_profile_t *profile; /*!< Parent MG profile */
MgMgcoReqEvtDesc *active_events; /* !< active megaco events */
mg_termination_t *next; /*!< List for physical terminations */
uint32_t flags;
mg_context_t* mg_ctxt;
uint32_t flags;
union {
struct {