adding echo cancel code based on tdmc package

This commit is contained in:
Kapil Gupta 2012-09-10 18:26:39 -04:00
parent 9537ed3737
commit b47c9d929c
5 changed files with 351 additions and 284 deletions

View File

@ -493,6 +493,7 @@ switch_status_t megaco_context_is_term_present(mg_context_t *ctx, mg_termination
switch_status_t megaco_context_add_termination(mg_context_t *ctx, mg_termination_t *term) switch_status_t megaco_context_add_termination(mg_context_t *ctx, mg_termination_t *term)
{ {
mg_termination_t* tdm_term = NULL;
switch_status_t status = SWITCH_STATUS_SUCCESS; switch_status_t status = SWITCH_STATUS_SUCCESS;
switch_assert(ctx != NULL); switch_assert(ctx != NULL);
@ -531,7 +532,19 @@ switch_status_t megaco_context_add_termination(mg_context_t *ctx, mg_termination
switch_ivr_uuid_bridge(ctx->terminations[0]->uuid, ctx->terminations[1]->uuid); switch_ivr_uuid_bridge(ctx->terminations[0]->uuid, ctx->terminations[1]->uuid);
ctx->terminations[0]->profile->mg_stats->total_num_of_call_recvd++; if(MG_TERM_TDM == ctx->terminations[0]->type){
tdm_term = ctx->terminations[0];
}else{
tdm_term = ctx->terminations[1];
}
if(MG_EC_ENABLE == tdm_term->ec_type){
mg_term_set_ec(tdm_term,0x01);
}else if(MG_EC_DISABLE == tdm_term->ec_type){
mg_term_set_ec(tdm_term,0x00);
}
mg_set_term_ec_status(tdm_term, MG_EC_UNDEFINED);
ctx->terminations[0]->profile->mg_stats->total_num_of_call_recvd++;
} }
return SWITCH_STATUS_SUCCESS; return SWITCH_STATUS_SUCCESS;
@ -893,7 +906,10 @@ void mg_term_set_ec(mg_termination_t *term, int enable)
switch_core_session_rwunlock(session); switch_core_session_rwunlock(session);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Sent echo_cancel event to [%s] to [%s]\n", term->uuid, enable ? "enable" : "disable"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Sent echo_cancel event to [%s] to [%s]\n", term->uuid, enable ? "enable" : "disable");
} }else{
mg_ec_types_t status = ((enable)?MG_EC_ENABLE:MG_EC_DISABLE);
mg_set_term_ec_status(term, status);
}
switch_event_destroy(&event); switch_event_destroy(&event);
} }

View File

@ -248,319 +248,336 @@ switch_status_t mg_prc_sig_desc(MgMgcoSignalsReq* req, megaco_profile_t* mg_prof
* *
* *
*/ */
switch_status_t mg_prc_descriptors(megaco_profile_t* mg_profile, MgMgcoCommand *cmd, mg_termination_t* term, CmMemListCp *memCp) switch_status_t mg_prc_descriptors(megaco_profile_t* mg_profile, MgMgcoCommand *cmd, mg_termination_t* term, CmMemListCp *memCp)
{ {
CmSdpMedProtoFmts *format; CmSdpMedProtoFmts *format;
TknU8 *fmt; TknU8 *fmt;
CmSdpMedFmtRtpList *fmt_list; CmSdpMedFmtRtpList *fmt_list;
MgMgcoTermStateDesc *tstate; MgMgcoTermStateDesc *tstate;
int fmtCnt; int fmtCnt;
int i; int i;
int descId = 0x00; int descId = 0x00;
int j; int j;
MgMgcoLocalParm *lclParm; MgMgcoLocalParm *lclParm;
CmSdpInfo *sdp; CmSdpInfo *sdp;
MgMgcoLclCtlDesc *locCtl; MgMgcoLclCtlDesc *locCtl;
MgMgcoTermStateParm *tsp; MgMgcoTermStateParm *tsp;
MgMgcoAmmReq* desc = NULL; MgMgcoAmmReq* desc = NULL;
MgMgcoLocalDesc *local; MgMgcoLocalDesc *local;
MgMgcoRemoteDesc* remote; MgMgcoRemoteDesc* remote;
switch (cmd->cmdType.val) switch (cmd->cmdType.val)
{ {
case CH_CMD_TYPE_IND: case CH_CMD_TYPE_IND:
switch(cmd->u.mgCmdInd[0]->cmd.type.val) switch(cmd->u.mgCmdInd[0]->cmd.type.val)
{ {
case MGT_ADD: case MGT_ADD:
{ {
desc = &cmd->u.mgCmdInd[0]->cmd.u.add; desc = &cmd->u.mgCmdInd[0]->cmd.u.add;
break; break;
} }
case MGT_MOVE: case MGT_MOVE:
{ {
desc = &cmd->u.mgCmdInd[0]->cmd.u.move; desc = &cmd->u.mgCmdInd[0]->cmd.u.move;
break; break;
} }
case MGT_MODIFY: case MGT_MODIFY:
{ {
desc = &cmd->u.mgCmdInd[0]->cmd.u.mod; desc = &cmd->u.mgCmdInd[0]->cmd.u.mod;
break; break;
} }
default: default:
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,"Invalid cmd.type[%d] for descriptor processing \n", switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,"Invalid cmd.type[%d] for descriptor processing \n",
cmd->u.mgCmdInd[0]->cmd.type.val); cmd->u.mgCmdInd[0]->cmd.type.val);
return SWITCH_STATUS_FALSE; return SWITCH_STATUS_FALSE;
} }
break; break;
default: default:
{ {
return SWITCH_STATUS_FALSE; return SWITCH_STATUS_FALSE;
} }
} }
if(NULL == desc){ if(NULL == desc){
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,"No Valid descriptor found \n"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,"No Valid descriptor found \n");
return SWITCH_STATUS_FALSE; return SWITCH_STATUS_FALSE;
} }
//switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,"descriptors[%d] found in-coming megaco request \n", desc->dl.num.val); //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,"descriptors[%d] found in-coming megaco request \n", desc->dl.num.val);
if(NOTPRSNT == desc->dl.num.pres){ if(NOTPRSNT == desc->dl.num.pres){
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,"No descriptor found in-coming megaco request \n"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,"No descriptor found in-coming megaco request \n");
return SWITCH_STATUS_SUCCESS; return SWITCH_STATUS_SUCCESS;
} }
for (descId = 0; descId < desc->dl.num.val; descId++) { for (descId = 0; descId < desc->dl.num.val; descId++) {
//switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,"descriptors[%d] type in-coming megaco request \n", desc->dl.descs[descId]->type.val); //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR,"descriptors[%d] type in-coming megaco request \n", desc->dl.descs[descId]->type.val);
switch (desc->dl.descs[descId]->type.val) { switch (desc->dl.descs[descId]->type.val) {
case MGT_MEDIADESC: case MGT_MEDIADESC:
{ {
int mediaId; int mediaId;
for (mediaId = 0; mediaId < desc->dl.descs[descId]->u.media.num.val; mediaId++) { for (mediaId = 0; mediaId < desc->dl.descs[descId]->u.media.num.val; mediaId++) {
MgMgcoMediaPar *mediaPar = desc->dl.descs[descId]->u.media.parms[mediaId]; MgMgcoMediaPar *mediaPar = desc->dl.descs[descId]->u.media.parms[mediaId];
switch (mediaPar->type.val) { switch (mediaPar->type.val) {
case MGT_MEDIAPAR_LOCAL: case MGT_MEDIAPAR_LOCAL:
{ {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "MGT_MEDIAPAR_LOCAL"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "MGT_MEDIAPAR_LOCAL\n");
/* Matt - check local descriptor processing */ /* Matt - check local descriptor processing */
local = &mediaPar->u.local; local = &mediaPar->u.local;
sdp = local->sdp.info[0]; sdp = local->sdp.info[0];
for (i = 0; i < sdp->mediaDescSet.numComp.val; i++) { for (i = 0; i < sdp->mediaDescSet.numComp.val; i++) {
/* sdp formats */ /* sdp formats */
for (j = 0; j < for (j = 0; j <
sdp->mediaDescSet.mediaDesc[i]->field.par.numProtFmts.val; j++) sdp->mediaDescSet.mediaDesc[i]->field.par.numProtFmts.val; j++)
{ {
format = sdp->mediaDescSet.mediaDesc[i]->field.par.pflst[j]; format = sdp->mediaDescSet.mediaDesc[i]->field.par.pflst[j];
/* Matt - format has field for T38 also */ /* Matt - format has field for T38 also */
if ((format->protType.pres != NOTPRSNT) && if ((format->protType.pres != NOTPRSNT) &&
(format->protType.val == CM_SDP_MEDIA_PROTO_RTP)) { (format->protType.val == CM_SDP_MEDIA_PROTO_RTP)) {
/* protocol type RTP */ /* protocol type RTP */
fmt_list = &format->u.rtp; fmt_list = &format->u.rtp;
/* print format */ /* print format */
for(fmtCnt = 0; fmtCnt < fmt_list->num.val; fmtCnt++){ for(fmtCnt = 0; fmtCnt < fmt_list->num.val; fmtCnt++){
fmt = &fmt_list->fmts[i]->val; fmt = &fmt_list->fmts[i]->val;
if(fmt->pres == NOTPRSNT) continue; if(fmt->pres == NOTPRSNT) continue;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE,"Format [%d]\n", fmt->val); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE,"Format [%d]\n", fmt->val);
} }
} }
} }
} }
mgco_handle_incoming_sdp(&local->sdp, term, MG_SDP_LOCAL, mg_profile, memCp); mgco_handle_incoming_sdp(&local->sdp, term, MG_SDP_LOCAL, mg_profile, memCp);
break; break;
} }
case MGT_MEDIAPAR_REMOTE: case MGT_MEDIAPAR_REMOTE:
{ {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "MGT_MEDIAPAR_REMOTE"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "MGT_MEDIAPAR_REMOTE\n");
/* Matt - check remote descriptor processing */ /* Matt - check remote descriptor processing */
remote = &mediaPar->u.remote; remote = &mediaPar->u.remote;
sdp = remote->sdp.info[0]; sdp = remote->sdp.info[0];
/* for Matt - same like local descriptor */ /* for Matt - same like local descriptor */
mgco_handle_incoming_sdp(&remote->sdp, term, MG_SDP_REMOTE, mg_profile, memCp); mgco_handle_incoming_sdp(&remote->sdp, term, MG_SDP_REMOTE, mg_profile, memCp);
break; break;
} }
case MGT_MEDIAPAR_LOCCTL: case MGT_MEDIAPAR_LOCCTL:
{ {
/* Matt - check Local Control descriptor processing */ /* Matt - check Local Control descriptor processing */
locCtl = &mediaPar->u.locCtl; locCtl = &mediaPar->u.locCtl;
for (i = 0; i < locCtl->num.val; i++){ for (i = 0; i < locCtl->num.val; i++){
lclParm = locCtl->parms[i]; lclParm = locCtl->parms[i];
if (PRSNT_NODEF == lclParm->type.pres){ if (PRSNT_NODEF == lclParm->type.pres){
switch(lclParm->type.val) switch(lclParm->type.val)
{ {
case MGT_LCLCTL_MODE: case MGT_LCLCTL_MODE:
{ {
/* Mode Property */ /* Mode Property */
//switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE,"MGT_LCLCTL_MODE - Mode value [%d]\n", lclParm->u.mode.val); //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE,"MGT_LCLCTL_MODE - Mode value [%d]\n", lclParm->u.mode.val);
break; break;
} }
case MGT_LCLCTL_RESVAL: case MGT_LCLCTL_RESVAL:
{ {
/* Reserve Value */ /* Reserve Value */
//switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE,"MGT_LCLCTL_RESVAL: Reserve Value[%d] \n", lclParm->u.resVal.val); //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE,"MGT_LCLCTL_RESVAL: Reserve Value[%d] \n", lclParm->u.resVal.val);
break; break;
} }
case MGT_LCLCTL_RESGRP: case MGT_LCLCTL_RESGRP:
{ {
/* Reserve group */ /* Reserve group */
//switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE,"MGT_LCLCTL_RESGRP: Reserve Group[%d]\n", lclParm->u.resGrp.val); //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE,"MGT_LCLCTL_RESGRP: Reserve Group[%d]\n", lclParm->u.resGrp.val);
break; break;
} }
case MGT_LCLCTL_PROPPARM: case MGT_LCLCTL_PROPPARM:
{ {
/* Properties (of a termination) */ MgMgcoPropParm* p = &lclParm->u.propParm;
/* Matt - See how we can apply this to a termination */ /* Properties (of a termination) */
//switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE,"MGT_LCLCTL_PROPPARM: \n"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE,"MGT_LCLCTL_PROPPARM: \n");
break;
}
default:
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE,"Invalid local control descriptor type[%d]\n",lclParm->type.val);
break;
}
}
}
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "MGT_MEDIAPAR_LOCCTL"); if((MGT_PKG_KNOWN == p->pkg.valType.val) &&
break; (MGT_PKG_TDM_CKT == p->pkg.u.val.val) &&
} (MGT_GEN_TYPE_KNOWN == p->name.type.val) &&
case MGT_MEDIAPAR_TERMST: (MGT_PKG_TDMC_PROP_EC == p->name.u.val.val) &&
{ (PRSNT_NODEF == p->val.type.pres) &&
/* Matt - apply termination state descriptor */ (MGT_VALUE_EQUAL == p->val.type.val) &&
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "MGT_MEDIAPAR_TERMST"); (NOTPRSNT != p->val.u.eq.type.pres) &&
tstate = &mediaPar->u.tstate; (MGT_VALTYPE_ENUM == p->val.u.eq.type.val)) {
for (i = 0; i < tstate->numComp.val; i++) if(MGT_PKG_ENUM_PROPPARMTDMCEC_ON == p->val.u.eq.u.enume.val){
{ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE,"TDMC EC=ON\n");
/* Matt to see how to apply below descriptors to a termination */ mg_term_set_ec(term,0x01);
tsp = tstate->trmStPar[i]; }else if(MGT_PKG_ENUM_PROPPARMTDMCEC_OFF == p->val.u.eq.u.enume.val){
if (PRSNT_NODEF == tsp->type.pres) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE,"TDMC EC=OFF\n");
switch(tsp->type.val) mg_term_set_ec(term,0x00);
{ }
case MGT_TERMST_PROPLST: }
{ break;
/* Matt to see how to apply properties to a termination */ }
/* Properties of a termination */ default:
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE,"MGT_TERMST_PROPLST:\n"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE,"Invalid local control descriptor type[%d]\n",lclParm->type.val);
break; break;
} }
case MGT_TERMST_EVTBUFCTL: }
{ }
/* Event /buffer Control Properties */
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE," MGT_TERMST_EVTBUFCTL: value[%d]\n", tsp->u.evtBufCtl.val);
break;
}
case MGT_TERMST_SVCST:
{
/* Service State Properties */
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE," MGT_TERMST_SVCST: value[%d]\n", tsp->u.svcState.val);
break;
}
default:
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE,"Invalid termination state descriptor type[%d]\n",tsp->type.val);
break;
}
}
}
break;
}
case MGT_MEDIAPAR_STRPAR:
{
MgMgcoStreamDesc *mgStream = &mediaPar->u.stream;
if (mgStream->sl.remote.pres.pres) { //switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "MGT_MEDIAPAR_LOCCTL\n");
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Got remote stream media description:\n"); break;
mgco_handle_incoming_sdp(&mgStream->sl.remote.sdp, term, MG_SDP_LOCAL, mg_profile, memCp); }
} case MGT_MEDIAPAR_TERMST:
{
/* Matt - apply termination state descriptor */
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "MGT_MEDIAPAR_TERMST");
tstate = &mediaPar->u.tstate;
for (i = 0; i < tstate->numComp.val; i++)
{
/* Matt to see how to apply below descriptors to a termination */
tsp = tstate->trmStPar[i];
if (PRSNT_NODEF == tsp->type.pres) {
switch(tsp->type.val)
{
case MGT_TERMST_PROPLST:
{
/* Matt to see how to apply properties to a termination */
/* Properties of a termination */
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE,"MGT_TERMST_PROPLST:\n");
break;
}
case MGT_TERMST_EVTBUFCTL:
{
/* Event /buffer Control Properties */
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE," MGT_TERMST_EVTBUFCTL: value[%d]\n", tsp->u.evtBufCtl.val);
break;
}
case MGT_TERMST_SVCST:
{
/* Service State Properties */
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE," MGT_TERMST_SVCST: value[%d]\n", tsp->u.svcState.val);
break;
}
default:
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE,"Invalid termination state descriptor type[%d]\n",tsp->type.val);
break;
}
}
}
break;
}
case MGT_MEDIAPAR_STRPAR:
{
MgMgcoStreamDesc *mgStream = &mediaPar->u.stream;
if (mgStream->sl.local.pres.pres) { if (mgStream->sl.remote.pres.pres) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Got local stream media description:\n"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Got remote stream media description:\n");
mgco_handle_incoming_sdp(&mgStream->sl.local.sdp, term, MG_SDP_REMOTE, mg_profile, memCp); mgco_handle_incoming_sdp(&mgStream->sl.remote.sdp, term, MG_SDP_LOCAL, mg_profile, memCp);
} }
break; if (mgStream->sl.local.pres.pres) {
} switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Got local stream media description:\n");
} mgco_handle_incoming_sdp(&mgStream->sl.local.sdp, term, MG_SDP_REMOTE, mg_profile, memCp);
} }
break;
}
case MGT_REQEVTDESC:
{
MgMgcoReqEvtDesc* evt = &desc->dl.descs[descId]->u.evts;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG," Requested Event descriptor\n"); break;
}
}
}
break;
}
case MGT_REQEVTDESC:
{
MgMgcoReqEvtDesc* evt = &desc->dl.descs[descId]->u.evts;
/* If we receive events from MGC , means clear any ongoing events */ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG," Requested Event descriptor\n");
/* as such we dont apply any events to term, so for us (as of now) clear events means clear active_events structure*/
if(NULL != term->active_events){ /* If we receive events from MGC , means clear any ongoing events */
mgUtlDelMgMgcoReqEvtDesc(term->active_events); /* as such we dont apply any events to term, so for us (as of now) clear events means clear active_events structure*/
MG_STACK_MEM_FREE(term->active_events, sizeof(MgMgcoReqEvtDesc));
}
MG_STACK_MEM_ALLOC(&term->active_events, sizeof(MgMgcoReqEvtDesc)); if(NULL != term->active_events){
mgUtlDelMgMgcoReqEvtDesc(term->active_events);
MG_STACK_MEM_FREE(term->active_events, sizeof(MgMgcoReqEvtDesc));
}
if(NULL == term->active_events){ MG_STACK_MEM_ALLOC(&term->active_events, sizeof(MgMgcoReqEvtDesc));
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR," term->active_events Memory Alloc failed \n");
return SWITCH_STATUS_FALSE;
}
/* copy requested event */ if(NULL == term->active_events){
if(RFAILED == mgUtlCpyMgMgcoReqEvtDesc(term->active_events, evt, NULLP)){ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR," term->active_events Memory Alloc failed \n");
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR," copy new events to term->active_events failed \n"); return SWITCH_STATUS_FALSE;
MG_STACK_MEM_FREE(term->active_events, sizeof(MgMgcoReqEvtDesc)); }
return SWITCH_STATUS_FALSE;
}
/* print Requested event descriptor */ /* copy requested event */
/*mgAccEvntPrntMgMgcoReqEvtDesc(term->active_events, stdout);*/ if(RFAILED == mgUtlCpyMgMgcoReqEvtDesc(term->active_events, evt, NULLP)){
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR," copy new events to term->active_events failed \n");
MG_STACK_MEM_FREE(term->active_events, sizeof(MgMgcoReqEvtDesc));
return SWITCH_STATUS_FALSE;
}
break; /* print Requested event descriptor */
} /*mgAccEvntPrntMgMgcoReqEvtDesc(term->active_events, stdout);*/
case MGT_SIGNALSDESC:
{
MgMgcoSignalsDesc* sig = &desc->dl.descs[descId]->u.sig;
MgMgcoSignalsParm* param = NULL;
int i = 0x00;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG," Requested Signal descriptor\n");
if((NOTPRSNT != sig->pres.pres) && (NOTPRSNT != sig->num.pres) && (0 != sig->num.val)){ break;
}
case MGT_SIGNALSDESC:
{
MgMgcoSignalsDesc* sig = &desc->dl.descs[descId]->u.sig;
MgMgcoSignalsParm* param = NULL;
int i = 0x00;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG," Requested Signal descriptor\n");
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO," Total number of Signal descriptors[%d]\n", sig->num.val); if((NOTPRSNT != sig->pres.pres) && (NOTPRSNT != sig->num.pres) && (0 != sig->num.val)){
for(i=0; i< sig->num.val; i++){ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO," Total number of Signal descriptors[%d]\n", sig->num.val);
param = sig->parms[i];
if(NOTPRSNT == param->type.pres) continue; for(i=0; i< sig->num.val; i++){
param = sig->parms[i];
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO," Signal Descriptor[%d] type[%s]\n", if(NOTPRSNT == param->type.pres) continue;
i, ((MGT_SIGSPAR_LST == param->type.val)?"MGT_SIGSPAR_LST":"MGT_SIGSPAR_REQ"));
switch(param->type.val) switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO," Signal Descriptor[%d] type[%s]\n",
{ i, ((MGT_SIGSPAR_LST == param->type.val)?"MGT_SIGSPAR_LST":"MGT_SIGSPAR_REQ"));
case MGT_SIGSPAR_LST:
{
MgMgcoSignalsLst* lst = &param->u.lst;
int sigId = 0x00;
if((NOTPRSNT == lst->pl.num.pres) || (0 == lst->pl.num.val)) break; switch(param->type.val)
{
case MGT_SIGSPAR_LST:
{
MgMgcoSignalsLst* lst = &param->u.lst;
int sigId = 0x00;
for(sigId = 0; sigId < lst->pl.num.val; sigId++){ if((NOTPRSNT == lst->pl.num.pres) || (0 == lst->pl.num.val)) break;
mg_prc_sig_desc(lst->pl.reqs[sigId], mg_profile, term);
}
break; for(sigId = 0; sigId < lst->pl.num.val; sigId++){
} mg_prc_sig_desc(lst->pl.reqs[sigId], mg_profile, term);
case MGT_SIGSPAR_REQ: }
{
MgMgcoSignalsReq* req = &param->u.req;
mg_prc_sig_desc(req, mg_profile, term);
break;
}
default:
break;
}
}
}
break; break;
} }
case MGT_MODEMDESC: case MGT_SIGSPAR_REQ:
case MGT_MUXDESC: {
case MGT_EVBUFDESC: MgMgcoSignalsReq* req = &param->u.req;
case MGT_DIGMAPDESC: mg_prc_sig_desc(req, mg_profile, term);
case MGT_AUDITDESC: break;
case MGT_STATSDESC: }
break; default:
break;
}
}
}
} break;
} }
case MGT_MODEMDESC:
case MGT_MUXDESC:
case MGT_EVBUFDESC:
case MGT_DIGMAPDESC:
case MGT_AUDITDESC:
case MGT_STATSDESC:
break;
return SWITCH_STATUS_SUCCESS; }
}
return SWITCH_STATUS_SUCCESS;
} }
@ -744,6 +761,7 @@ switch_status_t handle_mg_add_cmd(megaco_profile_t* mg_profile, MgMgcoCommand *i
mg_apply_tdm_dtmf_removal(term, mg_ctxt); mg_apply_tdm_dtmf_removal(term, mg_ctxt);
mg_apply_tdm_ec(term, mg_ctxt); mg_apply_tdm_ec(term, mg_ctxt);
mg_print_t38_attributes(term); mg_print_t38_attributes(term);
@ -1063,10 +1081,9 @@ switch_status_t handle_mg_modify_cmd(megaco_profile_t* mg_profile, MgMgcoCommand
mg_apply_tdm_dtmf_removal(term, mg_ctxt); mg_apply_tdm_dtmf_removal(term, mg_ctxt);
mg_apply_tdm_ec(term, mg_ctxt); mg_apply_tdm_ec(term, mg_ctxt);
mg_print_t38_attributes(term); mg_print_t38_attributes(term);
/* SDP updated to termination */ /* SDP updated to termination */
if(SWITCH_STATUS_SUCCESS != megaco_activate_termination(term)) { if(SWITCH_STATUS_SUCCESS != megaco_activate_termination(term)) {
mg_profile->mg_stats->total_num_of_term_activation_failed_error++; mg_profile->mg_stats->total_num_of_term_activation_failed_error++;

View File

@ -167,7 +167,9 @@ typedef enum {
(_reqId)->id.val = 0xFFFFFFFF; (_reqId)->id.val = 0xFFFFFFFF;
switch_status_t mg_prc_descriptors(megaco_profile_t* mg_profile, MgMgcoCommand *inc_cmd, mg_termination_t* term, CmMemListCp *memCp);
void mg_set_term_ec_status(mg_termination_t* term, mg_ec_types_t status);
switch_status_t mg_prc_descriptors(megaco_profile_t* mg_profile, MgMgcoCommand *inc_cmd, mg_termination_t* term, CmMemListCp *memCp);
void handle_sng_log(uint8_t level, char *fmt, ...); void handle_sng_log(uint8_t level, char *fmt, ...);
void handle_mgco_sta_ind(Pst *pst, SuId suId, MgMgtSta* msg); void handle_mgco_sta_ind(Pst *pst, SuId suId, MgMgtSta* msg);
void handle_mgco_txn_sta_ind(Pst *pst, SuId suId, MgMgcoInd* msg); void handle_mgco_txn_sta_ind(Pst *pst, SuId suId, MgMgcoInd* msg);

View File

@ -2397,3 +2397,11 @@ void mg_apply_tdm_ec(mg_termination_t* term, mg_context_t *mg_ctxt)
} }
} }
/*****************************************************************************************************************************/ /*****************************************************************************************************************************/
void mg_set_term_ec_status(mg_termination_t* term, mg_ec_types_t status)
{
if(NULL != term) {
term->ec_type = status;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO,"Setting Term EC[%s]\n",mg_ec_types_tostr(term->ec_type));
}
}
/*****************************************************************************************************************************/

View File

@ -132,6 +132,29 @@ typedef enum {
MG_T38_FAX_NOTIFY_INVALID, MG_T38_FAX_NOTIFY_INVALID,
} mg_t38_fax_notify_t; } mg_t38_fax_notify_t;
typedef enum {
MG_EC_UNDEFINED = 0,
MG_EC_ENABLE,
MG_EC_DISABLE,
MG_EC_INVALID
} mg_ec_types_t;
static inline const char *mg_ec_types_tostr(mg_ec_types_t type) {
switch (type) {
case MG_EC_UNDEFINED:
return "UNDEFINED";
case MG_EC_ENABLE:
return "ENABLE";
case MG_EC_DISABLE:
return "DISABLE";
case MG_EC_INVALID:
return "INVALID";
default:
return "Invalid";
}
return NULL;
}
typedef enum { typedef enum {
MGM_AUDIO = 0, MGM_AUDIO = 0,
@ -205,6 +228,7 @@ struct mg_termination_s {
int *mg_error_code; /* MEGACO error code */ int *mg_error_code; /* MEGACO error code */
uint32_t flags; uint32_t flags;
const char *tech; /* Endpoint controlling the TDM interface - only FreeTDM tested so far */ const char *tech; /* Endpoint controlling the TDM interface - only FreeTDM tested so far */
mg_ec_types_t ec_type;
union { union {
struct { struct {