提交 84d56ee5 authored 作者: Mathieu Rene's avatar Mathieu Rene

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

......@@ -74,6 +74,7 @@ mg_context_t *megaco_get_context(megaco_profile_t *profile, uint32_t context_id)
mg_context_t *megaco_choose_context(megaco_profile_t *profile)
{
mg_context_t *ctx;
int i = 0x0;;
switch_thread_rwlock_wrlock(profile->contexts_rwlock);
/* Try the next one */
......@@ -86,7 +87,7 @@ mg_context_t *megaco_choose_context(megaco_profile_t *profile)
if ((profile->contexts_bitmap[profile->next_context_id % 8] & (1 << (profile->next_context_id / 8))) == 0) {
/* Found! */
profile->contexts_bitmap[profile->next_context_id % 8] |= 1 << (profile->next_context_id / 8);
int i = profile->next_context_id % MG_CONTEXT_MODULO;
i = profile->next_context_id % MG_CONTEXT_MODULO;
ctx = malloc(sizeof *ctx);
ctx->context_id = profile->next_context_id;
ctx->profile = profile;
......
......@@ -26,6 +26,7 @@ switch_status_t mg_process_cli_cmd(const char *cmd, switch_stream_handle_t *stre
int argc;
char* argv[10];
char* dup = NULL;
int wild = 0x00;
megaco_profile_t* profile = NULL;
if (zstr(cmd)) {
......@@ -107,12 +108,16 @@ switch_status_t mg_process_cli_cmd(const char *cmd, switch_stream_handle_t *stre
}
if (profile) {
if(!zstr(argv[7]) && !strcasecmp(argv[7],"wild")){
wild = 0x01;
}
printf("Input to Send Service Change command : "
"Profile Name[%s], term-id[%s] method[%s] reason[%s] \n",
profile->name, argv[4], argv[5], argv[6]);
megaco_profile_release(profile);
mg_send_service_change(profile->idx, argv[4], atoi(argv[5]), atoi(argv[6]));
mg_send_service_change(profile->idx, argv[4], atoi(argv[5]), atoi(argv[6]),wild);
} else {
stream->write_function(stream, "-ERR No such profile\n");
}
......
......@@ -273,10 +273,14 @@ switch_status_t handle_mg_audit_cmd( SuId suId, MgMgcoCommand *auditReq)
MgMgcoMediaDesc* media;
MgMgcoCtxt ctxt;
switch_status_t ret;
uint8_t wild = 0x00;
memset(&reply, 0, sizeof(reply));
audit = &auditReq->u.mgCmdReq[0]->cmd.u.aval;
wild = auditReq->u.mgCmdReq[0]->wild.pres;
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_INFO,"%s :: wild card request = %s \n",__FUNCTION__,(1==wild)?"TRUE":"FALSE");
if(NOTPRSNT == audit->pres.pres){
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_ERROR,"Audit structure not present..rejecting \n");
......@@ -498,6 +502,11 @@ switch_status_t handle_mg_audit_cmd( SuId suId, MgMgcoCommand *auditReq)
reply.cmdType.pres = PRSNT_NODEF;
reply.cmdType.val = CH_CMD_TYPE_RSP;
if(wild){
reply.u.mgCmdRsp[0]->wild.pres = PRSNT_NODEF;
}
/* send command reply */
sng_mgco_send_cmd(suId, &reply);
......@@ -942,9 +951,12 @@ switch_status_t mg_send_subtract_rsp(SuId suId, MgMgcoCommand *req)
int ret = 0x00;
MgMgcoTermId *termId;
MgMgcoCtxt ctxt;
uint8_t wild = 0x00;
memset(&cmd,0, sizeof(cmd));
wild = req->u.mgCmdReq[0]->wild.pres;
/*copy transaction-id*/
memcpy(&cmd.transId, &req->transId,sizeof(MgMgcoTransId));
......@@ -959,6 +971,10 @@ switch_status_t mg_send_subtract_rsp(SuId suId, MgMgcoCommand *req)
return ret;
}
if(wild){
cmd.u.mgCmdRsp[0]->wild.pres = PRSNT_NODEF;
}
cmd.u.mgCmdRsp[0]->pres.pres = PRSNT_NODEF;
cmd.u.mgCmdRsp[0]->type.pres = PRSNT_NODEF;
cmd.u.mgCmdRsp[0]->type.val = MGT_SUB;
......@@ -1007,7 +1023,7 @@ U32 get_txn_id(){
* SuId - Service User ID for MG SAP - it will be same like mg_profile_t->idx (refer to media_gateway_xml.c->mg_sap_id)
* term_name - String format defined termination name
*/
switch_status_t mg_send_service_change(SuId suId, const char* term_name, uint8_t method, MgServiceChangeReason_e reason)
switch_status_t mg_send_service_change(SuId suId, const char* term_name, uint8_t method, MgServiceChangeReason_e reason,uint8_t wild)
{
MgMgcoSvcChgPar srvPar;
MgMgcoTermId* termId;
......@@ -1054,9 +1070,6 @@ switch_status_t mg_send_service_change(SuId suId, const char* term_name, uint8_t
/*mgUtlCpyMgMgcoSvcChgPar(&svc->parm, &srvPar, &request.u.mgCmdReq[0]->memCp);*/
printf("reason[%p = %s], len[%d]\n",svc->parm.reason.val, svc->parm.reason.val, svc->parm.reason.len);
if (mgUtlGrowList((void ***)&svc->termIdLst.terms, sizeof(MgMgcoTermIdLst),
&svc->termIdLst.num, &request.u.mgCmdReq[0]->memCp) != ROK)
{
......@@ -1073,8 +1086,12 @@ switch_status_t mg_send_service_change(SuId suId, const char* term_name, uint8_t
mg_fill_mgco_termid(termId, (char*)term_name ,strlen(term_name), &request.u.mgCmdReq[0]->memCp);
if(wild){
request.u.mgCmdReq[0]->wild.pres = PRSNT_NODEF;
}
printf("reason[%p = %s], len[%d]\n",svc->parm.reason.val, svc->parm.reason.val, svc->parm.reason.len);
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_INFO,"Sending %s Service Change for termId[%s] with reason[%s], len[%d]\n",
((1==wild)?"WildCard":"Non Wild Card"), term_name, svc->parm.reason.val, svc->parm.reason.len);
sng_mgco_send_cmd(suId, &request);
......
......@@ -155,7 +155,7 @@ switch_status_t mg_send_heartbeat_audit_rsp( SuId suId, MgMgcoCommand *auditReq)
void mg_get_time_stamp(MgMgcoTimeStamp *timeStamp);
switch_status_t mg_fill_svc_change(MgMgcoSvcChgPar *srvPar, uint8_t method, const char *reason);
void mg_fill_null_context(MgMgcoContextId* ctxt);
switch_status_t mg_send_service_change(SuId suId, const char* term_name, uint8_t method, MgServiceChangeReason_e reason);
switch_status_t mg_send_service_change(SuId suId, const char* term_name, uint8_t method, MgServiceChangeReason_e reason,uint8_t wild);
switch_status_t mg_create_mgco_command(MgMgcoCommand *cmd, uint8_t apiType, uint8_t cmdType);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论