Merge branch 'nsg-4.3' of ssh://git.sangoma.com/smg_freeswitch into nsg-4.3

This commit is contained in:
David Yat Sin 2012-07-26 16:43:29 -04:00
commit b10e73131e
11 changed files with 408 additions and 308 deletions

View File

@ -121,7 +121,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 {

View File

@ -185,6 +185,7 @@ mg_termination_t *megaco_choose_termination(megaco_profile_t *profile, const cha
term->pool = pool;
term->type = termtype;
term->active_events = NULL;
term->mg_ctxt = NULL;
term->profile = profile;
switch_set_flag(term, MGT_ALLOCATED);
@ -231,6 +232,8 @@ void megaco_termination_destroy(mg_termination_t *term)
free(term->active_events);
term->active_events = NULL;
}
term->mg_ctxt = NULL;
switch_clear_flag(term, MGT_ALLOCATED);
switch_clear_flag(term, MGT_ACTIVE);

View File

@ -301,6 +301,8 @@ switch_status_t mg_prc_descriptors(megaco_profile_t* mg_profile, MgMgcoCommand *
}
}
mgco_handle_sdp(&local->sdp, term, MG_SDP_LOCAL);
break;
}
@ -311,6 +313,7 @@ switch_status_t mg_prc_descriptors(megaco_profile_t* mg_profile, MgMgcoCommand *
remote = &mediaPar->u.remote;
sdp = remote->sdp.info[0];
/* for Matt - same like local descriptor */
mgco_handle_sdp(&remote->sdp, term, MG_SDP_REMOTE);
break;
}
@ -403,12 +406,12 @@ switch_status_t mg_prc_descriptors(megaco_profile_t* mg_profile, MgMgcoCommand *
if (mgStream->sl.remote.pres.pres) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Got remote stream media description:\n");
mgco_print_sdp(&mgStream->sl.remote.sdp);
mgco_handle_sdp(&mgStream->sl.remote.sdp, term, MG_SDP_LOCAL);
}
if (mgStream->sl.local.pres.pres) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Got local stream media description:\n");
mgco_print_sdp(&mgStream->sl.local.sdp);
mgco_handle_sdp(&mgStream->sl.local.sdp, term, MG_SDP_REMOTE);
}
break;
@ -495,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;
@ -540,8 +547,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;
}
}
/********************************************************************/
@ -557,16 +570,34 @@ switch_status_t handle_mg_add_cmd(megaco_profile_t* mg_profile, MgMgcoCommand *i
goto error;
}
if(!term->mg_ctxt){
term->mg_ctxt = mg_ctxt;
}
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_INFO," Allocated Termination[%p] with term name[%s]\n", (void*)term, term->name);
is_rtp = 0x01;
/* TODO - Matt */
/* allocate rtp term and associated the same to context */
/********************************************************************/
/********************************************************************/
}else{ /* Physical termination */
/* get physical termination */
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;
}
if(!term->mg_ctxt){
term->mg_ctxt = mg_ctxt;
} else {
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_INFO," Termination[%s] already in context..rejecting ADD \n", term->name);
mg_util_set_err_string(&errTxt, " Term already is in call ");
err_code = MGT_MGCP_RSP_CODE_PROT_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);
}
/********************************************************************/
/* associate physical termination to context */
@ -659,65 +690,73 @@ 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;
switch_split((char*)term->u.rtp.local_addr,'.',ipAddress);
printf("ipAddress[0]=%s, ipAddress[1]=%s, ipAddress[2]=%s,ipAddress[3]=%s\n",ipAddress[0],ipAddress[1],ipAddress[2],ipAddress[3]);
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;
@ -812,8 +851,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 +890,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);
}
@ -899,8 +939,8 @@ switch_status_t handle_mg_modify_cmd(megaco_profile_t* mg_profile, MgMgcoCommand
MgMgcoInd *mgErr;
MgMgcoTermId *termId;
MgMgcoTermIdLst* termLst;
mg_termination_t* term = NULL;
switch_status_t ret;
mg_termination_t* term = NULL;
switch_status_t ret;
int err_code;
/*MgMgcoAmmReq *cmd = &inc_cmd->u.mgCmdInd[0]->cmd.u.mod;*/
U32 txn_id = inc_cmd->transId.val;
@ -1014,6 +1054,9 @@ switch_status_t handle_mg_modify_cmd(megaco_profile_t* mg_profile, MgMgcoCommand
ret = mg_prc_descriptors(mg_profile, inc_cmd, term);
/* SDP updated to termination */
megaco_activate_termination(term);
}
/********************************************************************/

View File

@ -15,6 +15,18 @@
#define MG_INACTIVITY_TMR_RESOLUTION 100 /* mit in ito package is experessed in 10ms steps */
/* rtp/avp profiles */
#define MG_RTP_AVP_PROFILE_A_LAW 8
#define MG_RTP_AVP_PROFILE_U_LAW 0
typedef enum{
MG_SDP_NONE,
MG_SDP_LOCAL,
MG_SDP_REMOTE,
}mgco_sdp_types_e;
typedef enum{
SNG_MG_TPT_NONE,
SNG_MG_TPT_UDP,
@ -151,7 +163,7 @@ int sng_mgco_mg_get_status(int elemId, MgMngmt* cfm, megaco_profile_t* mg_cfg, m
switch_status_t mg_is_ito_pkg_req(megaco_profile_t* mg_profile, MgMgcoCommand *cmd);
switch_status_t mg_send_end_of_axn(SuId suId, MgMgcoTransId* transId, MgMgcoContextId* ctxtId, TknU32* peerId);
void mgco_print_sdp(CmSdpInfoSet *sdp);
void mgco_handle_sdp(CmSdpInfoSet *sdp,mg_termination_t* term, mgco_sdp_types_e sdp_type);
void mg_util_set_ctxt_string ( MgStr *errTxt, MgMgcoContextId *ctxtId);
switch_status_t handle_mg_add_cmd(megaco_profile_t* mg_profile, MgMgcoCommand *inc_cmd, MgMgcoContextId* new_ctxtId);
switch_status_t handle_mg_subtract_cmd(megaco_profile_t* mg_profile, MgMgcoCommand *inc_cmd);

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);
}
@ -740,8 +738,11 @@ void mgco_print_sdp_attr_set(CmSdpAttrSet *s)
}
void mgco_print_sdp_c_line(CmSdpConn *s)
void mgco_handle_sdp_c_line(CmSdpConn *s, mg_termination_t* term, mgco_sdp_types_e sdp_type)
{
char ipadd[32];
memset(ipadd, 0, sizeof(ipadd));
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "********** SDP connection line ****** \n");
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "\t Net Type = %d \n",
@ -760,7 +761,20 @@ void mgco_print_sdp_c_line(CmSdpConn *s)
s->u.ip4.u.uniIp.b[1].val,
s->u.ip4.u.uniIp.b[2].val,
s->u.ip4.u.uniIp.b[3].val);
}
if(MG_SDP_REMOTE == sdp_type) {
sprintf(ipadd,"%d.%d.%d.%d",
s->u.ip4.u.uniIp.b[0].val,
s->u.ip4.u.uniIp.b[1].val,
s->u.ip4.u.uniIp.b[2].val,
s->u.ip4.u.uniIp.b[3].val);
/* update remote ip */
if(MG_TERM_RTP == term->type){
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);
}
}
}
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "**************** \n");
}
@ -772,7 +786,7 @@ void mgco_print_CmSdpU8OrNil(CmSdpU8OrNil* p)
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE,"CmSdpU8OrNil: Value = %d \n", (NOTPRSNT != p->val.pres)?p->val.val:-1);
}
void mgco_print_sdp_media_param(CmSdpMedPar *s)
void mgco_print_sdp_media_param(CmSdpMedPar *s, mg_termination_t* term, mgco_sdp_types_e sdp_type)
{
int i=0x00;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "***** Media Parameter *********** \n");
@ -815,6 +829,12 @@ void mgco_print_sdp_media_param(CmSdpMedPar *s)
for(i=0;i<r->num.val;i++){
mgco_print_CmSdpU8OrNil(r->fmts[i]);
if(MG_RTP_AVP_PROFILE_A_LAW == r->fmts[i]->val.val){
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, " MG_RTP_AVP_PROFILE_A_LAW: \n");
}else if(MG_RTP_AVP_PROFILE_U_LAW == r->fmts[i]->val.val){
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, " MG_RTP_AVP_PROFILE_U_LAW: \n");
}
}
}
break;
@ -834,255 +854,263 @@ void mgco_print_sdp_media_param(CmSdpMedPar *s)
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "**************** \n");
}
void mgco_print_sdp(CmSdpInfoSet *sdp)
void mgco_handle_sdp(CmSdpInfoSet *sdp, mg_termination_t* term, mgco_sdp_types_e sdp_type)
{
int i;
int i;
if (sdp->numComp.pres == NOTPRSNT) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, " No %s SDP present \n", (MG_SDP_LOCAL== sdp_type)?"MG_SDP_LOCAL":"MG_SDP_REMOTE");
return;
}
for (i = 0; i < sdp->numComp.val; i++) {
CmSdpInfo *s = sdp->info[i];
int mediaId;
/************************************************************************************************************************/
/* info presence check */
if(NOTPRSNT == s->pres.pres) continue;
/************************************************************************************************************************/
/* Version */
if(NOTPRSNT != s->ver.pres) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, " SDP Version = %d \n", s->ver.val);
}
/************************************************************************************************************************/
/* Orig */
if(NOTPRSNT != s->orig.pres.pres) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "********** SDP orig line ****** \n \t Type = %d \n", s->orig.type.val);
if(NOTPRSNT != s->orig.orig.pres.pres) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "\t User Name = %s \n",
(NOTPRSNT != s->orig.orig.usrName.pres)?(char*)s->orig.orig.usrName.val:"Not Present");
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "\t Session Id = %s \n",
(NOTPRSNT != s->orig.orig.sessId.pres)?(char*)s->orig.orig.sessId.val:"Not Present");
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "\t Session Version = %s \n",
(NOTPRSNT != s->orig.orig.sessVer.pres)?(char*)s->orig.orig.sessVer.val:"Not Present");
/* sdpAddr */
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "\t Net Type = %d \n",
(NOTPRSNT != s->orig.orig.sdpAddr.netType.type.pres)?s->orig.orig.sdpAddr.netType.type.val:-1);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "\t Address Type = %d \n",
(NOTPRSNT != s->orig.orig.sdpAddr.addrType.pres)?s->orig.orig.sdpAddr.addrType.val:-1);
/* print IPV4 address */
if (s->orig.orig.sdpAddr.addrType.pres && s->orig.orig.sdpAddr.addrType.val == CM_SDP_ADDR_TYPE_IPV4 &&
s->orig.orig.sdpAddr.netType.type.val == CM_SDP_NET_TYPE_IN &&
s->orig.orig.sdpAddr.u.ip4.addrType.val == CM_SDP_IPV4_IP_UNI) {
if (s->orig.orig.sdpAddr.u.ip4.addrType.pres) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Address: %d.%d.%d.%d\n",
s->orig.orig.sdpAddr.u.ip4.u.ip.b[0].val,
s->orig.orig.sdpAddr.u.ip4.u.ip.b[1].val,
s->orig.orig.sdpAddr.u.ip4.u.ip.b[2].val,
s->orig.orig.sdpAddr.u.ip4.u.ip.b[3].val);
}
}else{
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "\t O-line not present \n");
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "********** ****** \n");
}
} else{
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "\t O-line not present \n");
}
/************************************************************************************************************************/
/* Session Name (s = line) */
if(NOTPRSNT != s->sessName.pres) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "\t Session Name = %s \n", s->sessName.val);
} else{
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "\t s-line not present \n");
}
/************************************************************************************************************************/
/* Session Info(i= line) */
if(NOTPRSNT != s->info.pres) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "\t Session Info = %s \n", s->info.val);
} else{
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "\t i-line not present \n");
}
/************************************************************************************************************************/
/* Session Uri */
if(NOTPRSNT != s->uri.pres) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "\t Session Uri = %s \n", s->uri.val);
} else{
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "\t uri not present \n");
}
/************************************************************************************************************************/
/* E-Mail */
/* TODO */
if (sdp->numComp.pres == NOTPRSNT) {
return;
}
for (i = 0; i < sdp->numComp.val; i++) {
CmSdpInfo *s = sdp->info[i];
int mediaId;
/************************************************************************************************************************/
/* info presence check */
if(NOTPRSNT == s->pres.pres) continue;
/************************************************************************************************************************/
/* Version */
if(NOTPRSNT != s->ver.pres) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, " SDP Version = %d \n", s->ver.val);
}
/************************************************************************************************************************/
/* Orig */
if(NOTPRSNT != s->orig.pres.pres) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "********** SDP orig line ****** \n \t Type = %d \n", s->orig.type.val);
if(NOTPRSNT != s->orig.orig.pres.pres) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "\t User Name = %s \n",
(NOTPRSNT != s->orig.orig.usrName.pres)?(char*)s->orig.orig.usrName.val:"Not Present");
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "\t Session Id = %s \n",
(NOTPRSNT != s->orig.orig.sessId.pres)?(char*)s->orig.orig.sessId.val:"Not Present");
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "\t Session Version = %s \n",
(NOTPRSNT != s->orig.orig.sessVer.pres)?(char*)s->orig.orig.sessVer.val:"Not Present");
/* sdpAddr */
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "\t Net Type = %d \n",
(NOTPRSNT != s->orig.orig.sdpAddr.netType.type.pres)?s->orig.orig.sdpAddr.netType.type.val:-1);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "\t Address Type = %d \n",
(NOTPRSNT != s->orig.orig.sdpAddr.addrType.pres)?s->orig.orig.sdpAddr.addrType.val:-1);
/* print IPV4 address */
if (s->orig.orig.sdpAddr.addrType.pres && s->orig.orig.sdpAddr.addrType.val == CM_SDP_ADDR_TYPE_IPV4 &&
s->orig.orig.sdpAddr.netType.type.val == CM_SDP_NET_TYPE_IN &&
s->orig.orig.sdpAddr.u.ip4.addrType.val == CM_SDP_IPV4_IP_UNI) {
if (s->orig.orig.sdpAddr.u.ip4.addrType.pres) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Address: %d.%d.%d.%d\n",
s->orig.orig.sdpAddr.u.ip4.u.ip.b[0].val,
s->orig.orig.sdpAddr.u.ip4.u.ip.b[1].val,
s->orig.orig.sdpAddr.u.ip4.u.ip.b[2].val,
s->orig.orig.sdpAddr.u.ip4.u.ip.b[3].val);
}
}else{
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "\t O-line not present \n");
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "********** ****** \n");
}
} else{
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "\t O-line not present \n");
}
/************************************************************************************************************************/
/* Session Name (s = line) */
if(NOTPRSNT != s->sessName.pres) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "\t Session Name = %s \n", s->sessName.val);
} else{
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "\t s-line not present \n");
}
/************************************************************************************************************************/
/* Session Info(i= line) */
if(NOTPRSNT != s->info.pres) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "\t Session Info = %s \n", s->info.val);
} else{
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "\t i-line not present \n");
}
/************************************************************************************************************************/
/* Session Uri */
if(NOTPRSNT != s->uri.pres) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "\t Session Uri = %s \n", s->uri.val);
} else{
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "\t uri not present \n");
}
/************************************************************************************************************************/
/* E-Mail */
/* TODO */
/************************************************************************************************************************/
/* Phone */
/* TODO */
/************************************************************************************************************************/
/* Phone */
/* TODO */
/************************************************************************************************************************/
/* connection line */
mgco_handle_sdp_c_line(&s->conn, term, sdp_type);
/************************************************************************************************************************/
/* Bandwidth */
/* TODO */
/************************************************************************************************************************/
/* SDP Time (t= line)*/
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "*** t-line **************** \n");
if(NOTPRSNT != s->sdpTime.pres.pres) {
if(NOTPRSNT != s->sdpTime.sdpOpTimeSet.numComp.pres) {
int i = 0x00;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "SDP op time present with total component[%d]\n", s->sdpTime.sdpOpTimeSet.numComp.val);
for (i = 0;i<s->sdpTime.sdpOpTimeSet.numComp.val;i++){
CmSdpOpTime* t = s->sdpTime.sdpOpTimeSet.sdpOpTime[i];
if(NOTPRSNT == t->pres.pres) continue;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "\t Start Time = %s \n",
(NOTPRSNT != t->startTime.pres)?(char*)t->startTime.val:"Not Present");
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "\t Stop Time = %s \n",
(NOTPRSNT != t->stopTime.pres)?(char*)t->stopTime.val:"Not Present");
/*repeat time repFieldSet */
if(NOTPRSNT != t->repFieldSet.numComp.pres) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "SDP repeat time present with total component[%d]\n",
t->repFieldSet.numComp.val);
/*TODO - print repeat fields */
}else{
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "SDP repeat time not present \n");
}
} /* sdpOpTimeSet.numComp for loop -- end */
}else{/*sdpOpTimeSet.numComp.pres if -- end */
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "SDP op time not present \n");
}
/*TODO - zoneAdjSet */
}else{
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "t-line not present \n");
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "**************** \n");
/************************************************************************************************************************/
/* connection line */
/************************************************************************************************************************/
/* key type (k= line)*/
mgco_print_sdp_c_line(&s->conn);
/************************************************************************************************************************/
/* Bandwidth */
/* TODO */
if(NOTPRSNT != s->keyType.pres.pres) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "\t Key Type = %d \n",
(NOTPRSNT != s->keyType.keyType.pres)?s->keyType.keyType.val:-1);
/************************************************************************************************************************/
/* SDP Time (t= line)*/
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "\t Key Data = %s \n",
(NOTPRSNT != s->keyType.key_data.pres)?(char*)s->keyType.key_data.val:"Not Present");
}else{
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "k-line not present \n");
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "*** t-line **************** \n");
if(NOTPRSNT != s->sdpTime.pres.pres) {
if(NOTPRSNT != s->sdpTime.sdpOpTimeSet.numComp.pres) {
int i = 0x00;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "SDP op time present with total component[%d]\n", s->sdpTime.sdpOpTimeSet.numComp.val);
for (i = 0;i<s->sdpTime.sdpOpTimeSet.numComp.val;i++){
CmSdpOpTime* t = s->sdpTime.sdpOpTimeSet.sdpOpTime[i];
if(NOTPRSNT == t->pres.pres) continue;
/************************************************************************************************************************/
/* Attribute Set */
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "\t Start Time = %s \n",
(NOTPRSNT != t->startTime.pres)?(char*)t->startTime.val:"Not Present");
mgco_print_sdp_attr_set(&s->attrSet);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "\t Stop Time = %s \n",
(NOTPRSNT != t->stopTime.pres)?(char*)t->stopTime.val:"Not Present");
/************************************************************************************************************************/
/* Media Descriptor Set */
/*repeat time repFieldSet */
if (s->mediaDescSet.numComp.pres) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "****** Media Descriptor Set present with numComp[%d]\n", s->mediaDescSet.numComp.val);
for (mediaId = 0; mediaId < s->mediaDescSet.numComp.val; mediaId++) {
CmSdpMediaDesc *desc = s->mediaDescSet.mediaDesc[mediaId];
if(NOTPRSNT != t->repFieldSet.numComp.pres) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "SDP repeat time present with total component[%d]\n",
t->repFieldSet.numComp.val);
if(NOTPRSNT == desc->pres.pres) continue;
/*TODO - print repeat fields */
}else{
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "SDP repeat time not present \n");
}
} /* sdpOpTimeSet.numComp for loop -- end */
}else{/*sdpOpTimeSet.numComp.pres if -- end */
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "SDP op time not present \n");
}
/* Media Field */
{
CmSdpMediaField* f = &desc->field;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "\t Media Type = %d \n",(NOTPRSNT == f->mediaType.pres)?f->mediaType.val:-1);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "\t Media = %s \n",(NOTPRSNT == f->media.pres)?(char*)f->media.val:"Not Present");
/* Channel ID */
if(NOTPRSNT != f->id.type.pres){
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "\t VcId Type = %d \n", f->id.type.val);
switch(f->id.type.val){
case CM_SDP_VCID_PORT:
{
CmSdpPort *p = &f->id.u.port;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "CM_SDP_VCID_PORT:\n");
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "\t SDP port type = %d \n", (NOTPRSNT == p->type.pres)?p->type.val:-1);
switch(p->type.val)
{
case CM_SDP_PORT_INT:
{
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE,
"\t CM_SDP_PORT_INT: SDP port = %d type = %d \n",
p->u.portInt.port.val.val, p->u.portInt.port.type.val);
if(MG_SDP_REMOTE == sdp_type) {
/* update remote information */
if(MG_TERM_RTP == term->type){
term->u.rtp.remote_port = p->u.portInt.port.val.val;
printf("Update remote port to [%d]\n", term->u.rtp.remote_port);
}
}
break;
}
case CM_SDP_PORT_VPCID:
{
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "\t CM_SDP_PORT_VPCID: \n");
break;
}
default:
break;
}
break;
}
default:
break;
}
}
mgco_print_sdp_media_param(&f->par, term, sdp_type);
}
/*TODO - zoneAdjSet */
}else{
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "t-line not present \n");
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "**************** \n");
/*info */
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "\t Info = %s \n",(NOTPRSNT == desc->info.pres)?(char*)desc->info.val:"Not Present");
/*connection set */
{
int cnt=0x00;
if(NOTPRSNT != desc->connSet.numComp.pres){
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "\t Number of Connection component[%d]\n",desc->connSet.numComp.val);
for(cnt=0;cnt<desc->connSet.numComp.val;cnt++){
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "************************\n");
mgco_handle_sdp_c_line(desc->connSet.connSet[cnt], term, sdp_type);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "************************\n");
}
}
}
/* attribute set */
mgco_print_sdp_attr_set(&desc->attrSet);
/************************************************************************************************************************/
/* key type (k= line)*/
if (desc->field.mediaType.val == CM_SDP_MEDIA_AUDIO &&
desc->field.id.type.val == CM_SDP_VCID_PORT &&
desc->field.id.u.port.type.val == CM_SDP_PORT_INT &&
desc->field.id.u.port.u.portInt.port.type.val == CM_SDP_SPEC) {
int port = desc->field.id.u.port.u.portInt.port.val.val;
if(NOTPRSNT != s->keyType.pres.pres) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "\t Key Type = %d \n",
(NOTPRSNT != s->keyType.keyType.pres)?s->keyType.keyType.val:-1);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "\t Key Data = %s \n",
(NOTPRSNT != s->keyType.key_data.pres)?(char*)s->keyType.key_data.val:"Not Present");
}else{
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "k-line not present \n");
}
/************************************************************************************************************************/
/* Attribute Set */
mgco_print_sdp_attr_set(&s->attrSet);
/************************************************************************************************************************/
/* Media Descriptor Set */
if (s->mediaDescSet.numComp.pres) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "****** Media Descriptor Set present with numComp[%d]\n", s->mediaDescSet.numComp.val);
for (mediaId = 0; mediaId < s->mediaDescSet.numComp.val; mediaId++) {
CmSdpMediaDesc *desc = s->mediaDescSet.mediaDesc[mediaId];
if(NOTPRSNT == desc->pres.pres) continue;
/* Media Field */
{
CmSdpMediaField* f = &desc->field;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "\t Media Type = %d \n",(NOTPRSNT == f->mediaType.pres)?f->mediaType.val:-1);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "\t Media = %s \n",(NOTPRSNT == f->media.pres)?(char*)f->media.val:"Not Present");
/* Channel ID */
if(NOTPRSNT != f->id.type.pres){
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "\t VcId Type = %d \n", f->id.type.val);
switch(f->id.type.val){
case CM_SDP_VCID_PORT:
{
CmSdpPort *p = &f->id.u.port;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "CM_SDP_VCID_PORT:\n");
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "\t SDP port type = %d \n", (NOTPRSNT == p->type.pres)?p->type.val:-1);
switch(p->type.val)
{
case CM_SDP_PORT_INT:
{
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "\t CM_SDP_PORT_INT: SDP port = %d type = %d \n", p->u.portInt.port.val.val, p->u.portInt.port.type.val);
break;
}
case CM_SDP_PORT_VPCID:
{
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "\t CM_SDP_PORT_VPCID: \n");
break;
}
default:
break;
}
break;
}
default:
break;
}
}
mgco_print_sdp_media_param(&f->par);
}
/*info */
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "\t Info = %s \n",(NOTPRSNT == desc->info.pres)?(char*)desc->info.val:"Not Present");
/*connection set */
{
int cnt=0x00;
if(NOTPRSNT != desc->connSet.numComp.pres){
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "\t Number of Connection component[%d]\n",desc->connSet.numComp.val);
for(cnt=0;cnt<desc->connSet.numComp.val;cnt++){
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "************************\n");
mgco_print_sdp_c_line(desc->connSet.connSet[cnt]);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "************************\n");
}
}
}
/* attribute set */
mgco_print_sdp_attr_set(&desc->attrSet);
if (desc->field.mediaType.val == CM_SDP_MEDIA_AUDIO &&
desc->field.id.type.val == CM_SDP_VCID_PORT &&
desc->field.id.u.port.type.val == CM_SDP_PORT_INT &&
desc->field.id.u.port.u.portInt.port.type.val == CM_SDP_SPEC) {
int port = desc->field.id.u.port.u.portInt.port.val.val;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Port: %d\n", port);
}
}
}
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Port: %d\n", port);
}
}
}
}
}
/*****************************************************************************************************************************/

View File

@ -99,6 +99,8 @@ switch_status_t config_profile(megaco_profile_t *profile, switch_bool_t reload)
term->pool = pool;
term->type = MG_TERM_TDM;
term->profile = profile;
term->mg_ctxt = NULL;
term->active_events = NULL;
term->name = switch_core_sprintf(pool, "%s%d", prefix, j);
term->u.tdm.channel = j;
term->u.tdm.span_name = switch_core_strdup(pool, channel_prefix);

View File

@ -639,7 +639,7 @@ void handle_mgco_cmd_ind(Pst *pst, SuId suId, MgMgcoCommand* cmd)
MgMgcoNtfyReply* ntfy = &cmd->u.mgCmdCfm[0]->u.ntfy;
MgMgcoTermId* term = NULL;
char term_name[32];
memset(&term_name[0], 32, 0x00);
memset(&term_name[0], 0x00,32);
strcpy(&term_name[0], "Invalid");
@ -685,7 +685,7 @@ void handle_mgco_cmd_ind(Pst *pst, SuId suId, MgMgcoCommand* cmd)
MgMgcoSvcChgReply* svc = &cmd->u.mgCmdCfm[0]->u.svc;
MgMgcoTermId* term = NULL;
char term_name[32];
memset(&term_name[0], 32, 0x00);
memset(&term_name[0], 0x00, 32);
strcpy(&term_name[0], "Invalid");

View File

@ -94,6 +94,14 @@ enum {
} mg_termination_flags;
struct mg_context_s {
uint32_t context_id;
mg_termination_t *terminations[MG_CONTEXT_MAX_TERMS];
megaco_profile_t *profile;
mg_context_t *next;
switch_memory_pool_t *pool;
};
struct mg_termination_s {
switch_memory_pool_t *pool;
mg_termination_type_t type;
@ -103,6 +111,7 @@ 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 */
mg_context_t* mg_ctxt;
uint32_t flags;
union {
@ -131,13 +140,7 @@ struct mg_termination_s {
};
struct mg_context_s {
uint32_t context_id;
mg_termination_t *terminations[MG_CONTEXT_MAX_TERMS];
megaco_profile_t *profile;
mg_context_t *next;
switch_memory_pool_t *pool;
};
#define MG_CONTEXT_MODULO 16
#define MG_MAX_CONTEXTS 32768
@ -231,6 +234,7 @@ mg_context_t *megaco_choose_context(megaco_profile_t *profile);
void megaco_release_context(mg_context_t *ctx);
switch_status_t megaco_context_sub_termination(mg_context_t *ctx, mg_termination_t *term);
switch_status_t megaco_context_sub_all_termination(mg_context_t *ctx);
switch_status_t megaco_activate_termination(mg_termination_t *term);
mg_termination_t *megaco_choose_termination(megaco_profile_t *profile, const char *prefix);
mg_termination_t *megaco_find_termination(megaco_profile_t *profile, const char *name);

View File

@ -315,7 +315,8 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch
tech_pvt = switch_core_session_get_private(session);
assert(tech_pvt != NULL);
if (!tech_pvt->rtp_session || tech_pvt->mode == RTP_RECVONLY) {
if (!tech_pvt->rtp_session || tech_pvt->mode == RTP_SENDONLY) {
switch_yield(20000); /* replace by local timer XXX */
goto cng;
}
@ -338,6 +339,7 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch
cng:
*frame = &tech_pvt->read_frame;
tech_pvt->read_frame.codec = &tech_pvt->read_codec;
tech_pvt->read_frame.flags |= SFF_CNG;
tech_pvt->read_frame.datalen = 0;
@ -370,8 +372,11 @@ static switch_status_t channel_write_frame(switch_core_session_t *session, switc
tech_pvt->timestamp_send += samples;
#endif
switch_rtp_write_frame(tech_pvt->rtp_session, frame);
if (tech_pvt->mode == RTP_RECVONLY) {
return SWITCH_STATUS_SUCCESS;
}
switch_rtp_write_frame(tech_pvt->rtp_session, frame);
return SWITCH_STATUS_SUCCESS;
}
@ -403,7 +408,11 @@ static switch_bool_t compare_var(switch_event_t *event, switch_channel_t *channe
{
const char *chan_val = switch_channel_get_variable_dup(channel, varname, SWITCH_FALSE, -1);
const char *event_val = switch_event_get_header(event, varname);
if (zstr(chan_val) || zstr(event_val)) {
return 1;
}
return strcasecmp(chan_val, event_val);
}
@ -418,7 +427,7 @@ static switch_status_t channel_receive_event(switch_core_session_t *session, swi
if (compare_var(event, channel, kREMOTEADDR) ||
compare_var(event, channel, kREMOTEPORT)) {
char *remote_addr = switch_event_get_header(event, kREMOTEADDR);
char *szremote_port = switch_event_get_header(event, kREMOTEADDR);
char *szremote_port = switch_event_get_header(event, kREMOTEPORT);
switch_port_t remote_port = !zstr(szremote_port) ? atoi(szremote_port) : 0;
const char *err;
@ -453,6 +462,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)

View File

@ -4154,8 +4154,8 @@ SWITCH_DECLARE(const char *) switch_channel_get_partner_uuid(switch_channel_t *c
{
const char *uuid = NULL;
if (!(uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))) {
uuid = switch_channel_get_variable(channel, SWITCH_ORIGINATE_SIGNAL_BOND_VARIABLE);
if (!(uuid = switch_channel_get_variable_dup(channel, SWITCH_SIGNAL_BOND_VARIABLE, SWITCH_FALSE, -1))) {
uuid = switch_channel_get_variable_dup(channel, SWITCH_ORIGINATE_SIGNAL_BOND_VARIABLE, SWITCH_FALSE, -1);
}
return uuid;

View File

@ -34,8 +34,6 @@
//#define RTP_DEBUG_WRITE_DELTA
//#define DEBUG_MISSED_SEQ
typedef unsigned long u_long;
#include <switch.h>
#include <switch_stun.h>
#include <apr_network_io.h>
@ -2165,7 +2163,7 @@ SWITCH_DECLARE(uint8_t) switch_rtp_ready(switch_rtp_t *rtp_session)
}
switch_mutex_lock(rtp_session->flag_mutex);
ret = (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_IO) && rtp_session->sock_input && rtp_session->sock_output && rtp_session->remote_addr
ret = (switch_test_flag(rtp_session, SWITCH_RTP_FLAG_IO) && rtp_session->sock_input /* && rtp_session->sock_output && rtp_session->remote_addr */
&& rtp_session->ready == 2) ? 1 : 0;
switch_mutex_unlock(rtp_session->flag_mutex);