adding code for sending termination service change and respective CLI
command
This commit is contained in:
parent
de70e3c08c
commit
642b1a2e6d
|
@ -94,6 +94,28 @@ switch_status_t mg_process_cli_cmd(const char *cmd, switch_stream_handle_t *stre
|
|||
} else {
|
||||
stream->write_function(stream, "-ERR No such profile\n");
|
||||
}
|
||||
/**********************************************************************************/
|
||||
}else if(!strcmp(argv[2], "send")) {
|
||||
/**********************************************************************************/
|
||||
/* mg profile <profile-name> send sc <term-id> <method> <reason>*/
|
||||
printf("count = %d \n",argc);
|
||||
if(argc < 7){
|
||||
goto usage;
|
||||
}
|
||||
if(zstr(argv[3]) || zstr(argv[4]) || zstr(argv[5]) || zstr(argv[6])){
|
||||
goto usage;
|
||||
}
|
||||
|
||||
if (profile) {
|
||||
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]));
|
||||
} else {
|
||||
stream->write_function(stream, "-ERR No such profile\n");
|
||||
}
|
||||
/**********************************************************************************/
|
||||
}else {
|
||||
/**********************************************************************************/
|
||||
|
|
|
@ -9,6 +9,15 @@
|
|||
#include "mod_media_gateway.h"
|
||||
#include "media_gateway_stack.h"
|
||||
|
||||
U32 outgoing_txn_id;
|
||||
|
||||
/*****************************************************************************************************************************/
|
||||
const char *mg_service_change_reason[] = {
|
||||
"\"NOT USED\"",
|
||||
"\"900 ServiceRestored\"",
|
||||
"\"905 Termination taken out of service\"",
|
||||
0
|
||||
};
|
||||
|
||||
/*****************************************************************************************************************************/
|
||||
|
||||
|
@ -134,7 +143,7 @@ switch_status_t mg_send_add_rsp(SuId suId, MgMgcoCommand *req)
|
|||
#else
|
||||
termId = &(cmd.u.mgCmdRsp[0]->u.add.termId);
|
||||
#endif
|
||||
mg_fill_mgco_termid(termId, (CONSTANT U8*)"term1",&req->u.mgCmdRsp[0]->memCp);
|
||||
/*mg_fill_mgco_termid(termId, (char*)"term1",&req->u.mgCmdRsp[0]->memCp);*/
|
||||
|
||||
/* We will always send one command at a time..*/
|
||||
cmd.cmdStatus.pres = PRSNT_NODEF;
|
||||
|
@ -197,7 +206,7 @@ switch_status_t mg_send_end_of_axn(SuId suId, MgMgcoTransId* transId, MgMgcoCont
|
|||
|
||||
switch_status_t mg_build_mgco_err_request(MgMgcoInd **errcmd,U32 trans_id, MgMgcoContextId *ctxt_id, U32 err, MgStr *errTxt)
|
||||
{
|
||||
MgMgcoInd *mgErr;
|
||||
MgMgcoInd *mgErr = NULL;
|
||||
S16 ret;
|
||||
|
||||
mgErr = NULLP;
|
||||
|
@ -584,6 +593,8 @@ switch_status_t mg_send_heartbeat_audit_rsp( SuId suId, MgMgcoCommand *auditReq)
|
|||
}
|
||||
|
||||
/*****************************************************************************************************************************/
|
||||
#if 0
|
||||
/* Kapil - Not using any more */
|
||||
switch_status_t handle_media_audit( SuId suId, MgMgcoCommand *auditReq)
|
||||
{
|
||||
switch_status_t ret;
|
||||
|
@ -788,7 +799,10 @@ switch_status_t handle_pkg_audit( SuId suId, MgMgcoCommand *auditReq)
|
|||
|
||||
|
||||
}
|
||||
#endif
|
||||
/*****************************************************************************************************************************/
|
||||
#if 0
|
||||
/* Kapil - Not using any more */
|
||||
switch_status_t mg_send_audit_rsp(SuId suId, MgMgcoCommand *req)
|
||||
{
|
||||
MgMgcoCommand cmd;
|
||||
|
@ -858,6 +872,7 @@ switch_status_t mg_send_audit_rsp(SuId suId, MgMgcoCommand *req)
|
|||
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*****************************************************************************************************************************/
|
||||
switch_status_t mg_send_modify_rsp(SuId suId, MgMgcoCommand *req)
|
||||
|
@ -897,7 +912,7 @@ switch_status_t mg_send_modify_rsp(SuId suId, MgMgcoCommand *req)
|
|||
#else
|
||||
termId = &(cmd.u.mgCmdRsp[0]->u.mod.termId);
|
||||
#endif
|
||||
mg_fill_mgco_termid(termId, (CONSTANT U8*)"term1",&req->u.mgCmdRsp[0]->memCp);
|
||||
/*mg_fill_mgco_termid(termId, (char*)"term1",&req->u.mgCmdRsp[0]->memCp);*/
|
||||
|
||||
/* We will always send one command at a time..*/
|
||||
cmd.cmdStatus.pres = PRSNT_NODEF;
|
||||
|
@ -958,7 +973,7 @@ switch_status_t mg_send_subtract_rsp(SuId suId, MgMgcoCommand *req)
|
|||
#else
|
||||
termId = &(cmd.u.mgCmdRsp[0]->u.sub.termId);
|
||||
#endif
|
||||
mg_fill_mgco_termid(termId, (CONSTANT U8*)"term1",&req->u.mgCmdRsp[0]->memCp);
|
||||
/*mg_fill_mgco_termid(termId, (char *)"term1",&req->u.mgCmdRsp[0]->memCp);*/
|
||||
|
||||
/* We will always send one command at a time..*/
|
||||
cmd.cmdStatus.pres = PRSNT_NODEF;
|
||||
|
@ -979,3 +994,94 @@ switch_status_t mg_send_subtract_rsp(SuId suId, MgMgcoCommand *req)
|
|||
|
||||
return ret;
|
||||
}
|
||||
/*****************************************************************************************************************************/
|
||||
U32 get_txn_id(){
|
||||
outgoing_txn_id++;
|
||||
return outgoing_txn_id;
|
||||
}
|
||||
/*****************************************************************************************************************************/
|
||||
/* Note : API to send Service Change */
|
||||
/* INPUT :
|
||||
* method - Service change method type (can be MGT_SVCCHGMETH_RESTART/MGT_SVCCHGMETH_FORCED (please refer to sng_ss7/cm/mgt.h for more values))
|
||||
* MgServiceChangeReason_e - Service Change reason
|
||||
* 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)
|
||||
{
|
||||
MgMgcoSvcChgPar srvPar;
|
||||
MgMgcoTermId* termId;
|
||||
switch_status_t ret;
|
||||
MgMgcoCommand request;
|
||||
MgMgcoSvcChgReq *svc;
|
||||
|
||||
MG_ZERO(&srvPar, sizeof(MgMgcoSvcChgPar));
|
||||
MG_ZERO(&request, sizeof(request));
|
||||
|
||||
|
||||
|
||||
if(SWITCH_STATUS_FALSE == (ret = mg_create_mgco_command(&request, CH_CMD_TYPE_REQ, MGT_SVCCHG))){
|
||||
goto err;
|
||||
}
|
||||
|
||||
/*fill txn id */
|
||||
request.transId.pres = PRSNT_NODEF;
|
||||
request.transId.val = get_txn_id();
|
||||
|
||||
request.contextId.type.pres = PRSNT_NODEF;
|
||||
request.contextId.type.val = MGT_CXTID_NULL;
|
||||
|
||||
#if 0
|
||||
/* TODO - fill of below fields */
|
||||
#ifdef GCP_MGCO
|
||||
#ifdef GCP_VER_2_1
|
||||
MgMgcoSegNum segNum;
|
||||
MgMgcoSegCmpl segCmpl;
|
||||
#endif
|
||||
#endif /* GCP_MGCO */
|
||||
#endif
|
||||
request.cmdStatus.pres = PRSNT_NODEF;
|
||||
request.cmdStatus.val = CH_CMD_STATUS_END_OF_TXN;
|
||||
|
||||
request.cmdType.pres = PRSNT_NODEF;
|
||||
request.cmdType.val = CH_CMD_TYPE_REQ;
|
||||
|
||||
svc = &request.u.mgCmdReq[0]->cmd.u.svc;
|
||||
|
||||
if(SWITCH_STATUS_FALSE == (ret = mg_fill_svc_change(&svc->parm, method, mg_service_change_reason[reason]))){
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*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)
|
||||
{
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_ERROR,"Grow List failed\n");
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
#ifdef GCP_VER_2_1
|
||||
termId = svc->termIdLst.terms[0];
|
||||
#else
|
||||
termId = &(svc->termId);
|
||||
#endif
|
||||
|
||||
|
||||
mg_fill_mgco_termid(termId, (char*)term_name ,strlen(term_name), &request.u.mgCmdReq[0]->memCp);
|
||||
|
||||
|
||||
printf("reason[%p = %s], len[%d]\n",svc->parm.reason.val, svc->parm.reason.val, svc->parm.reason.len);
|
||||
|
||||
sng_mgco_send_cmd(suId, &request);
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
|
||||
err:
|
||||
mgUtlDelMgMgcoSvcChgPar(&srvPar);
|
||||
return ret;
|
||||
}
|
||||
/*****************************************************************************************************************************/
|
||||
|
|
|
@ -60,6 +60,13 @@ typedef struct _mgPackage
|
|||
|
||||
extern MgPackage_t mg_pkg_list[];
|
||||
|
||||
/* Service change Reason */
|
||||
typedef enum {
|
||||
MG_SVC_REASON_NOTUSED = 0,
|
||||
MG_SVC_REASON_900_RESTORED = 1,
|
||||
MG_SVC_REASON_905_TERM_OOS = 2,
|
||||
MG_SVC_REASON_LAST = 4
|
||||
} MgServiceChangeReason_e;
|
||||
|
||||
#define MG_TXN_INVALID 0
|
||||
|
||||
|
@ -74,6 +81,12 @@ extern MgPackage_t mg_pkg_list[];
|
|||
MG_SET_PRES((tkn).pres); \
|
||||
(tkn).val = _val;
|
||||
|
||||
#define MG_SET_TKN_VAL_PRES(_tkn, _val, _pres) \
|
||||
{ \
|
||||
(_tkn)->val = _val; \
|
||||
(_tkn)->pres = _pres; \
|
||||
}
|
||||
|
||||
|
||||
#define MG_MEM_COPY(_dst, _src, _len) \
|
||||
cmMemcpy((U8*) (_dst), (const U8*) (_src), _len)
|
||||
|
@ -126,7 +139,7 @@ switch_status_t mg_stack_alloc_mem( Ptr* _memPtr, Size _memSize );
|
|||
MgMgcoMediaDesc* get_default_media_desc(void);
|
||||
switch_status_t handle_media_audit( SuId suId, MgMgcoCommand *auditReq);
|
||||
switch_status_t mg_send_add_rsp(SuId suId, MgMgcoCommand *req);
|
||||
S16 mg_fill_mgco_termid ( MgMgcoTermId *termId, CONSTANT U8 *str, CmMemListCp *memCp);
|
||||
S16 mg_fill_mgco_termid ( MgMgcoTermId *termId, char* term_str, int term_len, CmMemListCp *memCp);
|
||||
void mg_util_set_txn_string(MgStr *errTxt, U32 *txnId);
|
||||
switch_status_t mg_build_mgco_err_request(MgMgcoInd **errcmd,U32 trans_id, MgMgcoContextId *ctxt_id, U32 err, MgStr *errTxt);
|
||||
switch_status_t mg_send_audit_rsp(SuId suId, MgMgcoCommand *req);
|
||||
|
@ -139,6 +152,11 @@ MgMgcoTermIdLst *mg_get_term_id_list(MgMgcoCommand *cmd);
|
|||
switch_status_t handle_pkg_audit( SuId suId, MgMgcoCommand *auditReq);
|
||||
switch_status_t mg_build_pkg_desc(MgMgcoPkgsDesc* pkg);
|
||||
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_create_mgco_command(MgMgcoCommand *cmd, uint8_t apiType, uint8_t cmdType);
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -208,6 +208,9 @@ void handle_mg_alarm(Pst *pst, MgMngmt *usta)
|
|||
case LMG_EVENT_PEER_ENABLED:
|
||||
{
|
||||
len = len + sprintf(prBuf+len, "gateway enabled");
|
||||
/* gateway enabled now we can send termination service change */
|
||||
/*TODO - probably we cannt immediate send Service change - we have to find proper place */
|
||||
/*mg_send_service_change(0x01, "A01", MGT_SVCCHGMETH_RESTART,MG_SVC_REASON_900_RESTORED );*/
|
||||
break;
|
||||
}
|
||||
case LMG_EVENT_PEER_DISCOVERED:
|
||||
|
|
|
@ -80,24 +80,40 @@ switch_status_t mg_stack_free_mem(void* msg)
|
|||
|
||||
/*****************************************************************************************************************************/
|
||||
|
||||
S16 mg_fill_mgco_termid ( MgMgcoTermId *termId, CONSTANT U8 *str, CmMemListCp *memCp)
|
||||
S16 mg_fill_mgco_termid ( MgMgcoTermId *termId, char* term_str, int term_len, CmMemListCp *memCp)
|
||||
{
|
||||
#ifdef GCP_ASN
|
||||
Size size;
|
||||
#endif
|
||||
S16 ret = ROK;
|
||||
|
||||
termId->type.pres = PRSNT_NODEF;
|
||||
termId->type.val = MGT_TERMID_OTHER;
|
||||
|
||||
termId->name.dom.pres = NOTPRSNT;
|
||||
termId->name.dom.len = 0x00;
|
||||
|
||||
termId->name.pres.pres = PRSNT_NODEF;
|
||||
/* mg011.105: Bug fixes */
|
||||
termId->name.lcl.pres = PRSNT_NODEF;
|
||||
termId->name.lcl.len = cmStrlen((CONSTANT U8*)str);
|
||||
MG_GETMEM(termId->name.lcl.val, termId->name.lcl.len, memCp, ret);
|
||||
termId->name.lcl.len = term_len;
|
||||
/*MG_GETMEM(termId->name.lcl.val, termId->name.lcl.len , memCp, ret);*/
|
||||
ret = mg_stack_alloc_mem((Ptr*)&termId->name.lcl.val,term_len);
|
||||
|
||||
printf("termId->name.lcl.val[%p]\n",termId->name.lcl.val);
|
||||
|
||||
if( ret != ROK)
|
||||
RETVALUE(ret);
|
||||
|
||||
cmMemcpy((U8*)(termId->name.lcl.val), (CONSTANT U8*)str,termId->name.lcl.len);
|
||||
/*cmMemcpy((U8*)(termId->name.lcl.val), (CONSTANT U8*)term_str,termId->name.lcl.len);*/
|
||||
strncpy((char*)(termId->name.lcl.val), term_str, termId->name.lcl.len);
|
||||
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
|
||||
if((termId->type.val == MGT_TERMID_ALL) ||
|
||||
(termId->type.val == MGT_TERMID_CHOOSE)){
|
||||
/* Remove comment to fill other term ID
|
||||
termId->wildcard.num.pres = NOTPRSNT; */
|
||||
/* Remove comment to fill wilcard term ID */
|
||||
|
@ -116,6 +132,10 @@ S16 mg_fill_mgco_termid ( MgMgcoTermId *termId, CONSTANT U8 *str, CmMemListCp
|
|||
termId->wildcard.wildcard[0]->pres = PRSNT_NODEF;
|
||||
termId->wildcard.wildcard[0]->len = 1;
|
||||
termId->wildcard.wildcard[0]->val[0] = 0x55;
|
||||
|
||||
}else{
|
||||
termId->wildcard.num.pres = NOTPRSNT;
|
||||
}
|
||||
#endif /* GCP_ASN */
|
||||
|
||||
RETVALUE(ROK);
|
||||
|
@ -495,3 +515,176 @@ MgMgcoMediaDesc* get_default_media_desc()
|
|||
return media;
|
||||
}
|
||||
/*****************************************************************************************************************************/
|
||||
|
||||
switch_status_t mg_fill_svc_change(MgMgcoSvcChgPar *srvPar, uint8_t method, const char *reason)
|
||||
{
|
||||
MG_SET_TKN_VAL_PRES(&srvPar->pres, 0, PRSNT_NODEF);
|
||||
MG_SET_TKN_VAL_PRES(&srvPar->meth.pres, 0, PRSNT_NODEF);
|
||||
MG_SET_TKN_VAL_PRES(&srvPar->meth.type, method, PRSNT_NODEF);
|
||||
|
||||
/* Set the reason */
|
||||
srvPar->reason.pres = PRSNT_NODEF;
|
||||
srvPar->reason.len = cmStrlen((const U8 *)reason);
|
||||
|
||||
mg_stack_alloc_mem((Ptr*)&srvPar->reason.val, srvPar->reason.len);
|
||||
if (NULL == srvPar->reason.val)
|
||||
{
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_ERROR, "failed, memory alloc\n");
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
strncpy((char*)srvPar->reason.val,
|
||||
(const char *)reason,
|
||||
srvPar->reason.len);
|
||||
|
||||
srvPar->reason.val[srvPar->reason.len] = '\0';
|
||||
|
||||
mg_get_time_stamp(&srvPar->time);
|
||||
|
||||
printf("reason[%s], len[%d]\n",srvPar->reason.val, srvPar->reason.len);
|
||||
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
/*****************************************************************************************************************************/
|
||||
|
||||
void mg_get_time_stamp(MgMgcoTimeStamp *timeStamp)
|
||||
{
|
||||
DateTime dt;
|
||||
Txt dmBuf[16];
|
||||
U32 usec;
|
||||
|
||||
usec = 0;
|
||||
|
||||
/*-- Get system date and time via Trillium stack API --*/
|
||||
SGetRefDateTimeAdj(0, 0, &dt, &usec);
|
||||
|
||||
/*-- Now fill the time and date in the target --*/
|
||||
MG_ZERO(&dmBuf[0], 16);
|
||||
|
||||
sprintf(dmBuf, "%04d%02d%02d",
|
||||
(S16)(dt.year) + 1900, (S16)(dt.month), (S16)(dt.day));
|
||||
cmMemcpy((U8*) &timeStamp->date.val[0], (U8*) &dmBuf[0], 8);
|
||||
|
||||
MG_ZERO(&dmBuf[0], 16);
|
||||
sprintf(dmBuf, "%02d%02d%02d%02d",
|
||||
(S16)(dt.hour), (S16)(dt.min), (S16)(dt.sec), (S16)(usec/10000));
|
||||
cmMemcpy((U8*) &timeStamp->time.val[0], (U8*) &dmBuf[0], 8);
|
||||
|
||||
/*-- Setup the other stuff --*/
|
||||
timeStamp->pres.pres = PRSNT_NODEF;
|
||||
timeStamp->date.pres = PRSNT_NODEF;
|
||||
timeStamp->date.len = 8;
|
||||
timeStamp->time.pres = PRSNT_NODEF;
|
||||
timeStamp->time.len = 8;
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_INFO,"mg_get_time_stamp: time(%s)\n", dmBuf);
|
||||
}
|
||||
/*****************************************************************************************************************************/
|
||||
switch_status_t mg_create_mgco_command(MgMgcoCommand *cmd, uint8_t apiType, uint8_t cmdType)
|
||||
{
|
||||
MgMgcoCommandReq *cmdReq;
|
||||
MgMgcoCmdReply *cmdRep;
|
||||
switch_status_t ret;
|
||||
|
||||
cmdReq = NULL;
|
||||
cmdRep = NULL;
|
||||
|
||||
cmMemset((U8 *)cmd, 0, sizeof(MgMgcoCommand));
|
||||
|
||||
MG_SET_VAL_PRES(cmd->cmdType, apiType);
|
||||
|
||||
/* Allocate the event structure */
|
||||
switch(apiType)
|
||||
{
|
||||
/* For command Request */
|
||||
case CH_CMD_TYPE_REQ:
|
||||
{
|
||||
if(SWITCH_STATUS_FALSE == (ret = mg_stack_alloc_mem((Ptr*)&cmd->u.mgCmdReq[0],sizeof(MgMgcoCommandReq)))){
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (NULL == cmd->u.mgCmdReq[0]) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_ERROR,"mg_create_mgco_command: failed, memory alloc\n");
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
cmdReq = cmd->u.mgCmdReq[0];
|
||||
cmdReq->pres.pres = PRSNT_NODEF;
|
||||
cmdReq->cmd.type.pres = PRSNT_NODEF;
|
||||
cmdReq->cmd.type.val = cmdType;
|
||||
switch (cmdType)
|
||||
{
|
||||
case MGT_SVCCHG:
|
||||
cmdReq->cmd.u.svc.pres.pres = PRSNT_NODEF;
|
||||
break;
|
||||
|
||||
case MGT_NTFY:
|
||||
cmdReq->cmd.u.ntfy.pres.pres = PRSNT_NODEF;
|
||||
break;
|
||||
} /* switch cmdType */
|
||||
break;
|
||||
}
|
||||
|
||||
/* For command Response */
|
||||
case CH_CMD_TYPE_RSP:
|
||||
{
|
||||
if(SWITCH_STATUS_FALSE == (ret = mg_stack_alloc_mem((Ptr*)&cmd->u.mgCmdRsp[0],sizeof(MgMgcoCmdReply)))){
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (NULL == cmd->u.mgCmdRsp[0]) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_ERROR,"mg_create_mgco_command: failed, memory alloc\n");
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
cmdRep = cmd->u.mgCmdRsp[0];
|
||||
cmdRep->pres.pres = PRSNT_NODEF;
|
||||
cmdRep->type.pres = PRSNT_NODEF;
|
||||
cmdRep->type.val = cmdType;
|
||||
switch (cmdType)
|
||||
{
|
||||
case MGT_ADD:
|
||||
cmdRep->u.add.pres.pres = PRSNT_NODEF;
|
||||
break;
|
||||
|
||||
case MGT_MOVE:
|
||||
cmdRep->u.move.pres.pres = PRSNT_NODEF;
|
||||
break;
|
||||
|
||||
case MGT_MODIFY:
|
||||
cmdRep->u.mod.pres.pres = PRSNT_NODEF;
|
||||
break;
|
||||
|
||||
case MGT_SUB:
|
||||
cmdRep->u.sub.pres.pres = PRSNT_NODEF;
|
||||
break;
|
||||
|
||||
case MGT_SVCCHG:
|
||||
cmdRep->u.svc.pres.pres = PRSNT_NODEF;
|
||||
break;
|
||||
|
||||
case MGT_AUDITVAL:
|
||||
cmdRep->u.aval.type.pres = PRSNT_NODEF;
|
||||
break;
|
||||
case MGT_AUDITCAP:
|
||||
cmdRep->u.acap.type.pres = PRSNT_NODEF;
|
||||
break;
|
||||
|
||||
} /* switch cmdType */
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_ERROR,"mg_create_mgco_command: failed, invalid Cmd type[%d]\n",apiType);
|
||||
return SWITCH_STATUS_FALSE;
|
||||
} /* switch -apiType */
|
||||
|
||||
return SWITCH_STATUS_SUCCESS;
|
||||
}
|
||||
/*****************************************************************************************************************************/
|
||||
|
||||
void mg_fill_null_context(MgMgcoContextId* ctxt)
|
||||
{
|
||||
MG_SET_TKN_VAL_PRES(&ctxt->type, MGT_CXTID_NULL, PRSNT_NODEF);
|
||||
}
|
||||
/*****************************************************************************************************************************/
|
||||
|
|
Loading…
Reference in New Issue