adding API to send "In-Activity" timer expiry NOTIFY to MGC for IT/ITO package

This commit is contained in:
Kapil 2012-07-24 13:34:02 -04:00
parent 390dabb351
commit 12e8e481b5
5 changed files with 93 additions and 29 deletions

View File

@ -142,6 +142,25 @@ switch_status_t mg_process_cli_cmd(const char *cmd, switch_stream_handle_t *stre
megaco_profile_release(profile);
mg_send_dtmf_notify(profile, argv[4], (char*)argv[5], (int)strlen(argv[5]));
break;
}
case 5:
{
/* mg profile <profile-name> send ito notify */
if(zstr(argv[3])){
goto usage;
}
if(strcasecmp(argv[3],"ito")){
stream->write_function(stream, "-ERR wrong input \n");
goto usage;
}
printf("Sending In-Activity NOTIFY \n");
megaco_profile_release(profile);
mg_send_ito_notify(profile);
break;
}
default:

View File

@ -2134,6 +2134,36 @@ err:
mgUtlDelMgMgcoSvcChgPar(&srvPar);
return ret;
}
/*****************************************************************************************************************************/
/* API to send In-Activity Timeout NOTIFY to MGC */
switch_status_t mg_send_ito_notify(megaco_profile_t* mg_profile )
{
MgMgcoObsEvt *oevt;
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_INACTTIMER);
MG_INIT_TOKEN_VALUE(&(oevt->name.type),MGT_GEN_TYPE_KNOWN);
MG_INIT_TOKEN_VALUE(&(oevt->name.u.val),(U8)MGT_PKG_ENUM_REQEVT_INACTTIMER_INACT_TIMOUT);
oevt->pl.num.pres = PRSNT_NODEF;
oevt->pl.num.val = 0x00;
return mg_send_notify(mg_profile, "ROOT", oevt);
}
/*****************************************************************************************************************************/
/* API to send DTMF Digits Notification */
@ -2255,6 +2285,8 @@ switch_status_t mg_send_notify(megaco_profile_t* mg_profile, const char* term_n
MG_ZERO(&request, sizeof(request));
MG_ZERO(&reqId, sizeof(reqId));
if(strcmp(term_name, "ROOT")){
/* Not ROOT term then --- */
term = megaco_find_termination(mg_profile, (char*)term_name);
if(!term){
@ -2272,6 +2304,10 @@ switch_status_t mg_send_notify(megaco_profile_t* mg_profile, const char* term_n
}else{
MG_MEM_COPY(&reqId, &term->active_events->reqId, sizeof(MgMgcoRequestId));
}
}else{
MG_SET_DEF_REQID(&reqId);
}
if(SWITCH_STATUS_FALSE == (ret = mg_create_mgco_command(&request, CH_CMD_TYPE_REQ, MGT_NTFY))){

View File

@ -183,6 +183,7 @@ switch_status_t mg_send_oos_service_change(megaco_profile_t* mg_profile, const c
switch_status_t mg_send_ins_service_change(megaco_profile_t* mg_profile, const char* term_name, int wild);
switch_status_t mg_send_notify(megaco_profile_t* mg_profile, const char* term_name, MgMgcoObsEvt* oevt);
switch_status_t mg_send_dtmf_notify(megaco_profile_t* mg_profile, const char* term_name, char* digits, int num_of_collected_digits);
switch_status_t mg_send_ito_notify(megaco_profile_t* mg_profile);
switch_status_t mg_util_build_obs_evt_desc (MgMgcoObsEvt *obs_event, MgMgcoRequestId *request_id, MgMgcoObsEvtDesc **ptr_obs_desc);

View File

@ -96,6 +96,11 @@ S16 mg_fill_mgco_termid ( MgMgcoTermId *termId, char* term_str, int term_len, C
S16 ret = ROK;
termId->type.pres = PRSNT_NODEF;
if(!strcmp(term_str,"ROOT")){
/* ROOT Termination */
termId->type.val = MGT_TERMID_ROOT;
} else {
termId->type.val = MGT_TERMID_OTHER;
termId->name.dom.pres = NOTPRSNT;
@ -117,6 +122,7 @@ S16 mg_fill_mgco_termid ( MgMgcoTermId *termId, char* term_str, int term_len, C
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);
}
#ifdef GCP_ASN

View File

@ -613,6 +613,7 @@ void handle_mgco_cmd_ind(Pst *pst, SuId suId, MgMgcoCommand* cmd)
}
case CH_CMD_TYPE_CFM:
{
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "Received Command txn[%d] Response/Confirmation \n",txn_id);
break;
}
default:
@ -623,7 +624,8 @@ void handle_mgco_cmd_ind(Pst *pst, SuId suId, MgMgcoCommand* cmd)
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "cmd->cmdStatus.val[%d]\n",cmd->cmdStatus.val);
/* END OF TXN received - means last command in txn to process.
* Send response to peer */
/*if(CH_CMD_STATUS_END_OF_TXN == cmd->cmdStatus.val)*/{
if(CH_CMD_TYPE_IND == cmd->cmdType.val){
/*if(CH_CMD_STATUS_END_OF_TXN == cmd->cmdStatus.val)*/
mg_send_end_of_axn(suId, &cmd->transId, &out_ctxt, &cmd->peerId);
}