adding API to send T.38 CNG tone notify to MGC

This commit is contained in:
Kapil 2012-07-30 16:48:53 -04:00
parent 39b6233abb
commit 4423077a4e
3 changed files with 73 additions and 7 deletions

View File

@ -146,23 +146,39 @@ switch_status_t mg_process_cli_cmd(const char *cmd, switch_stream_handle_t *stre
} }
case 5: case 5:
{ {
/* mg profile <profile-name> send ito notify */
if(zstr(argv[3])){ if(zstr(argv[3])){
goto usage; goto usage;
} }
if(strcasecmp(argv[3],"ito")){ /*************************************************************************/
stream->write_function(stream, "-ERR wrong input \n"); if(!strcasecmp(argv[3],"ito")){
goto usage; /* mg profile <profile-name> send ito notify */
}
printf("Sending In-Activity NOTIFY \n"); printf("Sending In-Activity NOTIFY \n");
megaco_profile_release(profile); megaco_profile_release(profile);
mg_send_ito_notify(profile); mg_send_ito_notify(profile);
/*************************************************************************/
}else if(!strcasecmp(argv[3],"cng")){
/*************************************************************************/
/* mg profile <profile-name> send cng <term-id> */
if(zstr(argv[4])){
goto usage;
}
megaco_profile_release(profile);
mg_send_t38_cng_notify(profile, argv[4]);
/*************************************************************************/
}else {
stream->write_function(stream, "-ERR wrong input \n");
goto usage;
}
/*************************************************************************/
break; break;
} }
default: default:
{ {
goto usage; goto usage;

View File

@ -2480,6 +2480,53 @@ switch_status_t mg_send_ito_notify(megaco_profile_t* mg_profile )
return mg_send_notify(mg_profile, "ROOT", oevt); return mg_send_notify(mg_profile, "ROOT", oevt);
} }
/*****************************************************************************************************************************/
/* API to send T.38 CNG tone Notification */
switch_status_t mg_send_t38_cng_notify(megaco_profile_t* mg_profile, const char* term_name)
{
MgMgcoObsEvt *oevt;
MgMgcoEvtPar* param;
switch_assert(term_name);
switch_assert(mg_profile);
mg_stack_alloc_mem((Ptr*)&oevt, sizeof(MgMgcoObsEvt));
oevt->pres.pres = PRSNT_NODEF;
mg_get_time_stamp(&oevt->time);
MG_INIT_TOKEN_VALUE(&(oevt->pkg.pkgType), MGT_PKG_KNOWN);
MG_INIT_TOKEN_VALUE(&(oevt->pkg.valType), MGT_PKG_KNOWN);
MG_INIT_TOKEN_VALUE(&(oevt->pkg.u.val), MGT_PKG_CALL_TYP_DISCR);
MG_INIT_TOKEN_VALUE(&(oevt->name.type),MGT_GEN_TYPE_KNOWN);
MG_INIT_TOKEN_VALUE(&(oevt->name.u.val),(U8)MGT_PKG_ENUM_OBSEVTOTHERCALLTYPDISCRDISCTONEDETDISCTONETYPCNG);
if (mgUtlGrowList((void ***)&oevt->pl.parms, sizeof(MgMgcoEvtPar), &oevt->pl.num, NULL) != ROK) {
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_ERROR,"Grow List failed\n");
return SWITCH_STATUS_FALSE;
}
param = oevt->pl.parms[0];
MG_INIT_TOKEN_VALUE(&(param->type),(U8)MGT_EVTPAR_OTHER);
MG_INIT_TOKEN_VALUE(&(param->u.other.name.type),MGT_GEN_TYPE_KNOWN);
MG_INIT_TOKEN_VALUE(&(param->u.other.name.u.val), MGT_PKG_ENUM_OBSEVTOTHERCALLTYPDISCRDISCTONEDETDISCTONETYP);
MG_INIT_TOKEN_VALUE(&(param->u.other.val.type),MGT_VALUE_EQUAL);
MG_INIT_TOKEN_VALUE(&(param->u.other.val.u.eq.type),MGT_VALTYPE_ENUM);
MG_INIT_TOKEN_VALUE(&(param->u.other.val.u.eq.u.enume),MGT_PKG_ENUM_OBSEVTOTHERCALLTYPDISCRDISCTONEDETDISCTONETYPCNG);
return mg_send_notify(mg_profile, term_name, oevt);
}
/*****************************************************************************************************************************/ /*****************************************************************************************************************************/
/* API to send DTMF Digits Notification */ /* API to send DTMF Digits Notification */

View File

@ -167,6 +167,9 @@ switch_status_t mg_add_local_descriptor(MgMgcoMediaDesc* media, megaco_profile_t
switch_status_t mg_send_term_service_change(char *span_name, char *chan_number, mg_term_states_e term_state); switch_status_t mg_send_term_service_change(char *span_name, char *chan_number, mg_term_states_e term_state);
switch_status_t mg_send_t38_cng_notify(megaco_profile_t* mg_profile, const char* term_name);
switch_status_t sng_mgco_cfg(megaco_profile_t* profile); switch_status_t sng_mgco_cfg(megaco_profile_t* profile);
switch_status_t sng_mgco_init(sng_mg_event_interface_t* event); switch_status_t sng_mgco_init(sng_mg_event_interface_t* event);
switch_status_t sng_mgco_stack_shutdown(void); switch_status_t sng_mgco_stack_shutdown(void);