mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-04-26 20:48:21 +00:00
adding echo cancel code based on tdmc package
This commit is contained in:
parent
9537ed3737
commit
b47c9d929c
@ -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,6 +532,18 @@ 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);
|
||||||
|
|
||||||
|
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++;
|
ctx->terminations[0]->profile->mg_stats->total_num_of_call_recvd++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -893,6 +906,9 @@ 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);
|
||||||
|
@ -322,7 +322,7 @@ switch_status_t mg_prc_descriptors(megaco_profile_t* mg_profile, MgMgcoCommand *
|
|||||||
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];
|
||||||
@ -356,7 +356,7 @@ switch_status_t mg_prc_descriptors(megaco_profile_t* mg_profile, MgMgcoCommand *
|
|||||||
|
|
||||||
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];
|
||||||
@ -394,9 +394,26 @@ switch_status_t mg_prc_descriptors(megaco_profile_t* mg_profile, MgMgcoCommand *
|
|||||||
}
|
}
|
||||||
case MGT_LCLCTL_PROPPARM:
|
case MGT_LCLCTL_PROPPARM:
|
||||||
{
|
{
|
||||||
|
MgMgcoPropParm* p = &lclParm->u.propParm;
|
||||||
/* Properties (of a termination) */
|
/* Properties (of a termination) */
|
||||||
/* Matt - See how we can apply this to 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");
|
|
||||||
|
if((MGT_PKG_KNOWN == p->pkg.valType.val) &&
|
||||||
|
(MGT_PKG_TDM_CKT == p->pkg.u.val.val) &&
|
||||||
|
(MGT_GEN_TYPE_KNOWN == p->name.type.val) &&
|
||||||
|
(MGT_PKG_TDMC_PROP_EC == p->name.u.val.val) &&
|
||||||
|
(PRSNT_NODEF == p->val.type.pres) &&
|
||||||
|
(MGT_VALUE_EQUAL == p->val.type.val) &&
|
||||||
|
(NOTPRSNT != p->val.u.eq.type.pres) &&
|
||||||
|
(MGT_VALTYPE_ENUM == p->val.u.eq.type.val)) {
|
||||||
|
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");
|
||||||
|
mg_term_set_ec(term,0x01);
|
||||||
|
}else if(MGT_PKG_ENUM_PROPPARMTDMCEC_OFF == p->val.u.eq.u.enume.val){
|
||||||
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE,"TDMC EC=OFF\n");
|
||||||
|
mg_term_set_ec(term,0x00);
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@ -406,7 +423,7 @@ switch_status_t mg_prc_descriptors(megaco_profile_t* mg_profile, MgMgcoCommand *
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "MGT_MEDIAPAR_LOCCTL");
|
//switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "MGT_MEDIAPAR_LOCCTL\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case MGT_MEDIAPAR_TERMST:
|
case MGT_MEDIAPAR_TERMST:
|
||||||
@ -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++;
|
||||||
|
@ -167,6 +167,8 @@ typedef enum {
|
|||||||
(_reqId)->id.val = 0xFFFFFFFF;
|
(_reqId)->id.val = 0xFFFFFFFF;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
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);
|
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);
|
||||||
|
@ -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));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*****************************************************************************************************************************/
|
||||||
|
@ -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 {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user