提交 63c53a85 authored 作者: Kapil's avatar Kapil

fixing issues found during seagull testing and add single common descriptors api

上级 0bb82599
...@@ -166,6 +166,7 @@ mg_termination_t *megaco_choose_termination(megaco_profile_t *profile, const cha ...@@ -166,6 +166,7 @@ mg_termination_t *megaco_choose_termination(megaco_profile_t *profile, const cha
term = switch_core_alloc(pool, sizeof *term); term = switch_core_alloc(pool, sizeof *term);
term->pool = pool; term->pool = pool;
term->type = termtype; term->type = termtype;
term->active_events = NULL;
if (termtype == MG_TERM_RTP) { if (termtype == MG_TERM_RTP) {
/* Fill in local address and reserve an rtp port */ /* Fill in local address and reserve an rtp port */
......
...@@ -112,6 +112,15 @@ typedef enum { ...@@ -112,6 +112,15 @@ typedef enum {
cmMemcpy((U8 *)(_tkn)->val, (CONSTANT U8 *)(_val), (_len)); \ cmMemcpy((U8 *)(_tkn)->val, (CONSTANT U8 *)(_val), (_len)); \
} }
#define MG_SET_TKNSTROSXL(_tkn, _len, _val, _mem)\
{\
(_tkn).pres = PRSNT_NODEF;\
(_tkn).len = (_len);\
cmGetMem((Ptr)_mem, (Size)((_len)*sizeof(U8)), (Ptr*)&((_tkn).val));\
cmMemcpy((U8*)((_tkn).val), (U8*)(_val), _len);\
}
switch_status_t mg_prc_descriptors(megaco_profile_t* mg_profile, MgMgcoCommand *inc_cmd, mg_termination_t* term);
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);
void handle_mgco_txn_sta_ind(Pst *pst, SuId suId, MgMgcoInd* msg); void handle_mgco_txn_sta_ind(Pst *pst, SuId suId, MgMgcoInd* msg);
......
...@@ -438,6 +438,9 @@ void handle_mgco_cmd_ind(Pst *pst, SuId suId, MgMgcoCommand* cmd) ...@@ -438,6 +438,9 @@ void handle_mgco_cmd_ind(Pst *pst, SuId suId, MgMgcoCommand* cmd)
memset(&out_ctxt,0,sizeof(out_ctxt)); memset(&out_ctxt,0,sizeof(out_ctxt));
inc_context = &cmd->contextId;
memcpy(&out_ctxt, inc_context,sizeof(MgMgcoContextId));
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "%s: Received Command Type[%s] \n", __PRETTY_FUNCTION__, PRNT_MG_CMD_TYPE(cmd->cmdType.val)); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "%s: Received Command Type[%s] \n", __PRETTY_FUNCTION__, PRNT_MG_CMD_TYPE(cmd->cmdType.val));
/* validate Transaction Id */ /* validate Transaction Id */
...@@ -506,7 +509,6 @@ void handle_mgco_cmd_ind(Pst *pst, SuId suId, MgMgcoCommand* cmd) ...@@ -506,7 +509,6 @@ void handle_mgco_cmd_ind(Pst *pst, SuId suId, MgMgcoCommand* cmd)
/* Validate Context - if context is specified then check if its present with us */ /* Validate Context - if context is specified then check if its present with us */
inc_context = &cmd->contextId;
MG_ZERO(&ctxtId, sizeof(MgMgcoContextId)); MG_ZERO(&ctxtId, sizeof(MgMgcoContextId));
memcpy(&ctxtId, inc_context, sizeof(MgMgcoContextId)); memcpy(&ctxtId, inc_context, sizeof(MgMgcoContextId));
...@@ -535,7 +537,6 @@ void handle_mgco_cmd_ind(Pst *pst, SuId suId, MgMgcoCommand* cmd) ...@@ -535,7 +537,6 @@ void handle_mgco_cmd_ind(Pst *pst, SuId suId, MgMgcoCommand* cmd)
goto error1; goto error1;
} }
memcpy(&out_ctxt, inc_context,sizeof(MgMgcoContextId));
switch(cmd->cmdType.val) switch(cmd->cmdType.val)
{ {
...@@ -557,7 +558,7 @@ void handle_mgco_cmd_ind(Pst *pst, SuId suId, MgMgcoCommand* cmd) ...@@ -557,7 +558,7 @@ void handle_mgco_cmd_ind(Pst *pst, SuId suId, MgMgcoCommand* cmd)
{ {
/*MgMgcoAmmReq *addReq = &cmdReq->cmd.u.mod;*/ /*MgMgcoAmmReq *addReq = &cmdReq->cmd.u.mod;*/
handle_mg_modify_cmd(mg_profile, cmd); handle_mg_modify_cmd(mg_profile, cmd);
mg_send_modify_rsp(suId, cmd); /*mg_send_modify_rsp(suId, cmd);*/
break; break;
} }
case MGT_MOVE: case MGT_MOVE:
...@@ -619,9 +620,10 @@ void handle_mgco_cmd_ind(Pst *pst, SuId suId, MgMgcoCommand* cmd) ...@@ -619,9 +620,10 @@ void handle_mgco_cmd_ind(Pst *pst, SuId suId, MgMgcoCommand* cmd)
return; return;
} }
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. /* END OF TXN received - means last command in txn to process.
* Send response to peer */ * Send response to peer */
if(CH_CMD_STATUS_END_OF_TXN == cmd->cmdStatus.val){ /*if(CH_CMD_STATUS_END_OF_TXN == cmd->cmdStatus.val)*/{
mg_send_end_of_axn(suId, &cmd->transId, &out_ctxt, &cmd->peerId); mg_send_end_of_axn(suId, &cmd->transId, &out_ctxt, &cmd->peerId);
} }
...@@ -635,6 +637,9 @@ error: ...@@ -635,6 +637,9 @@ error:
mg_build_mgco_err_request(&mgErr, txn_id, &ctxtId, err_code, &errTxt)) { mg_build_mgco_err_request(&mgErr, txn_id, &ctxtId, err_code, &errTxt)) {
sng_mgco_send_err(suId, mgErr); sng_mgco_send_err(suId, mgErr);
} }
if(CH_CMD_STATUS_END_OF_TXN == cmd->cmdStatus.val){
mg_send_end_of_axn(suId, &cmd->transId, &out_ctxt, &cmd->peerId);
}
error1: error1:
mg_free_cmd(cmd); mg_free_cmd(cmd);
return; return;
...@@ -654,7 +659,7 @@ void handle_mgco_txn_sta_ind(Pst *pst, SuId suId, MgMgcoInd* txn_sta_ind) ...@@ -654,7 +659,7 @@ void handle_mgco_txn_sta_ind(Pst *pst, SuId suId, MgMgcoInd* txn_sta_ind)
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "%s\n", __PRETTY_FUNCTION__); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CONSOLE, "%s\n", __PRETTY_FUNCTION__);
/*dump information*/ /*dump information*/
/*mgAccEvntPrntMgMgcoInd(txn_sta_ind, stdout);*/ mgAccEvntPrntMgMgcoInd(txn_sta_ind, stdout);
} }
/*****************************************************************************************************************************/ /*****************************************************************************************************************************/
......
...@@ -42,7 +42,7 @@ typedef enum { ...@@ -42,7 +42,7 @@ typedef enum {
MEGACO_CODEC_ILBC, MEGACO_CODEC_ILBC,
/* Nothing below this line */ /* Nothing below this line */
MEGACO_CODEC_INVALID = 0xFFFFFFFF MEGACO_CODEC_INVALID = 0xFFFFFF
} megaco_codec_t; } megaco_codec_t;
typedef struct mg_peer_profile_s{ typedef struct mg_peer_profile_s{
...@@ -90,6 +90,7 @@ typedef struct mg_termination_s { ...@@ -90,6 +90,7 @@ typedef struct mg_termination_s {
const char *uuid; /*!< UUID of the associated FS channel, or NULL if it's not activated */ const char *uuid; /*!< UUID of the associated FS channel, or NULL if it's not activated */
mg_context_t *context; /*!< Context in which this termination is connected, or NULL */ mg_context_t *context; /*!< Context in which this termination is connected, or NULL */
megaco_profile_t *profile; /*!< Parent MG profile */ megaco_profile_t *profile; /*!< Parent MG profile */
MgMgcoReqEvtDesc *active_events; /* !< active megaco events */
union { union {
struct { struct {
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论