fixing local sdp issue
This commit is contained in:
parent
20f900c64a
commit
b1b2bee362
|
@ -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,45 +716,47 @@ 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),
|
||||
&media->num, &rsp.u.mgCmdRsp[0]->memCp) != ROK)
|
||||
{
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_ERROR,"Grow List failed\n");
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
/* allocating mem for local descriptor */
|
||||
if (mgUtlGrowList((void ***)&media->parms, sizeof(MgMgcoMediaPar),
|
||||
&media->num, &rsp.u.mgCmdRsp[0]->memCp) != ROK)
|
||||
{
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_ERROR,"Grow List failed\n");
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* Kapil - NOT REQUIRED..keeping now just for ref..will delete asap */
|
||||
media->parms[media->num.val-1]->type.pres = PRSNT_NODEF;
|
||||
/*media->parms[media->num.val-1]->type.val = MGT_MEDIAPAR_STRPAR;*/
|
||||
/* Kapil - NOT REQUIRED..keeping now just for ref..will delete asap */
|
||||
media->parms[media->num.val-1]->type.pres = PRSNT_NODEF;
|
||||
/*media->parms[media->num.val-1]->type.val = MGT_MEDIAPAR_STRPAR;*/
|
||||
|
||||
printf("media->num.val[%d]\n",media->num.val);
|
||||
printf("media->num.val[%d]\n",media->num.val);
|
||||
|
||||
stream = &media->parms[media->num.val-1]->u.stream;
|
||||
stream->pres.pres = PRSNT_NODEF;
|
||||
stream->pres.val = 0x01;
|
||||
stream = &media->parms[media->num.val-1]->u.stream;
|
||||
stream->pres.pres = PRSNT_NODEF;
|
||||
stream->pres.val = 0x01;
|
||||
#if 0
|
||||
if(inc_med_desc->num.pres && inc_med_desc->num.val){
|
||||
/* TODO - check stream descriptor type for all medias */
|
||||
inc_strm_desc = &inc_med_desc->parms[0]->u.stream;
|
||||
memcpy(&stream->streamId, &inc_strm_desc->streamId, sizeof(MgMgcoStreamId));
|
||||
if(inc_med_desc->num.pres && inc_med_desc->num.val){
|
||||
/* TODO - check stream descriptor type for all medias */
|
||||
inc_strm_desc = &inc_med_desc->parms[0]->u.stream;
|
||||
memcpy(&stream->streamId, &inc_strm_desc->streamId, sizeof(MgMgcoStreamId));
|
||||
}
|
||||
#endif
|
||||
|
||||
MG_INIT_TOKEN_VALUE(&(stream->streamId), 1);
|
||||
|
||||
|
||||
stream->sl.pres.pres = PRSNT_NODEF;
|
||||
stream->sl.pres.val = 0x01;
|
||||
|
||||
local = &stream->sl.local;
|
||||
#endif
|
||||
media->parms[media->num.val-1]->type.pres = PRSNT_NODEF;
|
||||
media->parms[media->num.val-1]->type.val = MGT_MEDIAPAR_LOCAL;
|
||||
|
||||
local = &media->parms[media->num.val-1]->u.local;
|
||||
}
|
||||
#endif
|
||||
|
||||
MG_INIT_TOKEN_VALUE(&(stream->streamId), 1);
|
||||
|
||||
|
||||
stream->sl.pres.pres = PRSNT_NODEF;
|
||||
stream->sl.pres.val = 0x01;
|
||||
|
||||
local = &stream->sl.local;
|
||||
#endif
|
||||
media->parms[media->num.val-1]->type.pres = PRSNT_NODEF;
|
||||
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;
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue