提交 96fd063a authored 作者: Kapil's avatar Kapil

adding add/mod/sub api and alloc context during add and release context while…

adding add/mod/sub api and alloc context during add and release context while processing subtract code
上级 d6d13650
...@@ -140,6 +140,8 @@ done: ...@@ -140,6 +140,8 @@ done:
switch_core_session_rwunlock(session); switch_core_session_rwunlock(session);
} }
switch_event_destroy(&var_event); switch_event_destroy(&var_event);
return SWITCH_STATUS_SUCCESS;
} }
mg_termination_t *megaco_choose_termination(megaco_profile_t *profile, const char *prefix) mg_termination_t *megaco_choose_termination(megaco_profile_t *profile, const char *prefix)
...@@ -154,7 +156,7 @@ mg_termination_t *megaco_choose_termination(megaco_profile_t *profile, const cha ...@@ -154,7 +156,7 @@ mg_termination_t *megaco_choose_termination(megaco_profile_t *profile, const cha
return NULL; return NULL;
} }
return SWITCH_STATUS_SUCCESS;
} }
mg_termination_t *megaco_find_termination(megaco_profile_t *profile, const char *name) mg_termination_t *megaco_find_termination(megaco_profile_t *profile, const char *name)
...@@ -210,6 +212,8 @@ switch_status_t megaco_context_add_termination(mg_context_t *ctx, mg_termination ...@@ -210,6 +212,8 @@ switch_status_t megaco_context_add_termination(mg_context_t *ctx, mg_termination
switch_ivr_uuid_bridge(ctx->terminations[0]->uuid, ctx->terminations[1]->uuid); switch_ivr_uuid_bridge(ctx->terminations[0]->uuid, ctx->terminations[1]->uuid);
} }
return SWITCH_STATUS_SUCCESS;
} }
...@@ -226,17 +230,19 @@ switch_status_t megaco_context_sub_termination(mg_context_t *ctx, mg_termination ...@@ -226,17 +230,19 @@ switch_status_t megaco_context_sub_termination(mg_context_t *ctx, mg_termination
} }
megaco_termination_destroy(term); megaco_termination_destroy(term);
return SWITCH_STATUS_SUCCESS;
} }
switch_status_t megaco_context_move_termination(mg_context_t *dst, mg_termination_t *term) switch_status_t megaco_context_move_termination(mg_context_t *dst, mg_termination_t *term)
{ {
return SWITCH_STATUS_SUCCESS;
} }
mg_context_t *megaco_find_context_by_suid(SuId suId, uint32_t context_id) mg_context_t *megaco_find_context_by_suid(SuId suId, uint32_t context_id)
{ {
mg_context_t *result = NULL;
megaco_profile_t* profile = NULL; megaco_profile_t* profile = NULL;
if(NULL == (profile = megaco_get_profile_by_suId(suId))){ if(NULL == (profile = megaco_get_profile_by_suId(suId))){
......
...@@ -47,10 +47,11 @@ MgPackage_t mg_pkg_list [] = ...@@ -47,10 +47,11 @@ MgPackage_t mg_pkg_list [] =
1, /* Version 1 */ 1, /* Version 1 */
"tdmc", /* Package name */ "tdmc", /* Package name */
}, },
/* TODO - not sure IF we need this */
{ /* INDEX : 7 */ { /* INDEX : 7 */
MGT_PKG_QTY_ALT, /*55*/ MGT_PKG_SEGMENTATION,
1, /* Version 1 */ 1, /* Version 1 */
"qac", /* Package name */ "seg", /* Package name */
}, },
{ /* INDEX : 8 */ { /* INDEX : 8 */
MGT_PKG_EN_ALERT, /*59*/ MGT_PKG_EN_ALERT, /*59*/
...@@ -58,9 +59,9 @@ MgPackage_t mg_pkg_list [] = ...@@ -58,9 +59,9 @@ MgPackage_t mg_pkg_list [] =
"alert", /* Package name */ "alert", /* Package name */
}, },
{ /* INDEX : 9 */ { /* INDEX : 9 */
MGT_PKG_AN_DISP, /*60*/ MGT_PKG_CONTINUITY, /*60*/
2, /* Version 1 */ 2, /* Version 1 */
"andisp", /* Package name */ "ct", /* Package name */
}, },
{ /* INDEX : 10 */ { /* INDEX : 10 */
MGT_PKG_INACTTIMER, /*69*/ MGT_PKG_INACTTIMER, /*69*/
...@@ -97,6 +98,31 @@ MgPackage_t mg_pkg_list [] = ...@@ -97,6 +98,31 @@ MgPackage_t mg_pkg_list [] =
1, /* Version 1 */ 1, /* Version 1 */
"etsi_nr", /* Package name */ "etsi_nr", /* Package name */
}, },
{ /* INDEX : 17 */
MGT_PKG_TONEGEN,
1, /* Version 1 */
"tonegen", /* Package name */
},
{ /* INDEX : 18 */
MGT_PKG_DTMFGEN,
1, /* Version 1 */
"tonegen", /* Package name */
},
{ /* INDEX : 19 */
MGT_PKG_CALLPROGGEN,
1, /* Version 1 */
"tonegen", /* Package name */
},
{ /* INDEX : 20 */
MGT_PKG_CALLPROGDET,
1, /* Version 1 */
"tonedet", /* Package name */
},
{ /* INDEX : 21 */
MGT_PKG_ANALOG,
1, /* Version 1 */
"analog", /* Package name */
},
/* Add more packages */ /* Add more packages */
}; };
......
...@@ -133,7 +133,8 @@ int sng_mgco_mg_get_status(int elemId, MgMngmt* cfm, megaco_profile_t* mg_cfg, m ...@@ -133,7 +133,8 @@ int sng_mgco_mg_get_status(int elemId, MgMngmt* cfm, megaco_profile_t* mg_cfg, m
switch_status_t mg_send_end_of_axn(SuId suId, MgMgcoTransId* transId, MgMgcoContextId* ctxtId, TknU32* peerId); switch_status_t mg_send_end_of_axn(SuId suId, MgMgcoTransId* transId, MgMgcoContextId* ctxtId, TknU32* peerId);
void mgco_print_sdp(CmSdpInfoSet *sdp); void mgco_print_sdp(CmSdpInfoSet *sdp);
void mg_util_set_ctxt_string ( MgStr *errTxt, MgMgcoContextId *ctxtId); void mg_util_set_ctxt_string ( MgStr *errTxt, MgMgcoContextId *ctxtId);
switch_status_t handle_mg_add_cmd(megaco_profile_t* mg_profile, MgMgcoCommand *cmd); switch_status_t handle_mg_add_cmd(megaco_profile_t* mg_profile, MgMgcoCommand *inc_cmd, MgMgcoContextId* new_ctxtId);
switch_status_t handle_mg_subtract_cmd(megaco_profile_t* mg_profile, MgMgcoCommand *inc_cmd);
switch_status_t handle_mg_modify_cmd(megaco_profile_t* mg_profile, MgMgcoCommand *cmd); switch_status_t handle_mg_modify_cmd(megaco_profile_t* mg_profile, MgMgcoCommand *cmd);
switch_status_t mg_stack_free_mem(void* msg); switch_status_t mg_stack_free_mem(void* msg);
switch_status_t mg_stack_alloc_mem( Ptr* _memPtr, Size _memSize ); switch_status_t mg_stack_alloc_mem( Ptr* _memPtr, Size _memSize );
......
...@@ -424,6 +424,7 @@ void handle_mgco_txn_ind(Pst *pst, SuId suId, MgMgcoMsg* msg) ...@@ -424,6 +424,7 @@ void handle_mgco_txn_ind(Pst *pst, SuId suId, MgMgcoMsg* msg)
/*****************************************************************************************************************************/ /*****************************************************************************************************************************/
void handle_mgco_cmd_ind(Pst *pst, SuId suId, MgMgcoCommand* cmd) void handle_mgco_cmd_ind(Pst *pst, SuId suId, MgMgcoCommand* cmd)
{ {
MgMgcoContextId out_ctxt;
U32 txn_id = 0x00; U32 txn_id = 0x00;
MgMgcoInd *mgErr; MgMgcoInd *mgErr;
MgStr errTxt; MgStr errTxt;
...@@ -435,6 +436,8 @@ void handle_mgco_cmd_ind(Pst *pst, SuId suId, MgMgcoCommand* cmd) ...@@ -435,6 +436,8 @@ void handle_mgco_cmd_ind(Pst *pst, SuId suId, MgMgcoCommand* cmd)
int err_code; int err_code;
megaco_profile_t* mg_profile; megaco_profile_t* mg_profile;
memset(&out_ctxt,0,sizeof(out_ctxt));
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 */
...@@ -532,6 +535,8 @@ void handle_mgco_cmd_ind(Pst *pst, SuId suId, MgMgcoCommand* cmd) ...@@ -532,6 +535,8 @@ 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)
{ {
case CH_CMD_TYPE_IND: case CH_CMD_TYPE_IND:
...@@ -543,8 +548,8 @@ void handle_mgco_cmd_ind(Pst *pst, SuId suId, MgMgcoCommand* cmd) ...@@ -543,8 +548,8 @@ void handle_mgco_cmd_ind(Pst *pst, SuId suId, MgMgcoCommand* cmd)
{ {
case MGT_ADD: case MGT_ADD:
{ {
handle_mg_add_cmd(mg_profile, cmd); handle_mg_add_cmd(mg_profile, cmd, &out_ctxt);
mg_send_add_rsp(suId, cmd); /*mg_send_add_rsp(suId, cmd);*/
break; break;
} }
...@@ -565,7 +570,8 @@ void handle_mgco_cmd_ind(Pst *pst, SuId suId, MgMgcoCommand* cmd) ...@@ -565,7 +570,8 @@ void handle_mgco_cmd_ind(Pst *pst, SuId suId, MgMgcoCommand* cmd)
case MGT_SUB: case MGT_SUB:
{ {
/*MgMgcoSubAudReq *addReq = &cmdReq->cmd.u.sub;*/ /*MgMgcoSubAudReq *addReq = &cmdReq->cmd.u.sub;*/
mg_send_subtract_rsp(suId, cmd); handle_mg_subtract_cmd(mg_profile, cmd);
/*mg_send_subtract_rsp(suId, cmd);*/
break; break;
} }
case MGT_SVCCHG: case MGT_SVCCHG:
...@@ -613,6 +619,12 @@ void handle_mgco_cmd_ind(Pst *pst, SuId suId, MgMgcoCommand* cmd) ...@@ -613,6 +619,12 @@ void handle_mgco_cmd_ind(Pst *pst, SuId suId, MgMgcoCommand* cmd)
return; return;
} }
/* 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){
mg_send_end_of_axn(suId, &cmd->transId, &out_ctxt, &cmd->peerId);
}
return; return;
ctxt_error: ctxt_error:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论