diff --git a/src/mod/endpoints/mod_media_gateway/media_gateway_cmd_handler.c b/src/mod/endpoints/mod_media_gateway/media_gateway_cmd_handler.c index 3e1aeb462d..8c86389e96 100644 --- a/src/mod/endpoints/mod_media_gateway/media_gateway_cmd_handler.c +++ b/src/mod/endpoints/mod_media_gateway/media_gateway_cmd_handler.c @@ -521,6 +521,7 @@ switch_status_t handle_mg_audit_cmd( SuId suId, MgMgcoCommand *auditReq) (MGT_TERMID_ROOT == termId->type.val)) && ((NOTPRSNT != ctxtId->type.pres) && (MGT_CXTID_OTHER == ctxtId->type.val))) { + switch_log_printf(SWITCH_CHANNEL_LOG_CLEAN, SWITCH_LOG_ERROR, "failed, Term: Invalid combination, ROOT Term with OTHER CONTEXT\n"); @@ -1199,6 +1200,37 @@ U32 get_txn_id(){ return outgoing_txn_id; } /*****************************************************************************************************************************/ +/* Note : API to send Service Change when termination is coming up(in-service) */ +/* INPUT : MG Profile structure and termination name */ +/* wild flag will tell if service change request needs to be in W-SC format as we can have W-SC=A01* or SC=A01* */ +switch_status_t mg_send_ins_service_change(megaco_profile_t* mg_profile, const char* term_name, int wild) +{ + switch_assert(term_name); + switch_assert(mg_profile); + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, + "Sending In-Service Service Change for termination[%s] configured in mg profile[%s], suId[%d]\n", + term_name, mg_profile->name, mg_profile->idx); + + return mg_send_service_change(mg_profile->idx, term_name, MGT_SVCCHGMETH_RESTART, MG_SVC_REASON_900_RESTORED, wild); +} + +/*****************************************************************************************************************************/ +/* Note : API to send Service Change when termination is going down (out-of-service) */ +/* INPUT : MG Profile structure and termination name */ +/* wild flag will tell if service change request needs to be in W-SC format as we can have W-SC=A01* or SC=A01* */ +switch_status_t mg_send_oos_service_change(megaco_profile_t* mg_profile, const char* term_name, int wild) +{ + switch_assert(term_name); + switch_assert(mg_profile); + + switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, + "Sending Out-Of-Service Service Change for termination[%s] configured in mg profile[%s], suId[%d]\n", + term_name, mg_profile->name, mg_profile->idx); + + return mg_send_service_change(mg_profile->idx, term_name, MGT_SVCCHGMETH_FORCED, MG_SVC_REASON_905_TERM_OOS, wild); +} +/*****************************************************************************************************************************/ /* 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)) diff --git a/src/mod/endpoints/mod_media_gateway/media_gateway_stack.h b/src/mod/endpoints/mod_media_gateway/media_gateway_stack.h index 8225ee9570..bbc3141d37 100644 --- a/src/mod/endpoints/mod_media_gateway/media_gateway_stack.h +++ b/src/mod/endpoints/mod_media_gateway/media_gateway_stack.h @@ -160,6 +160,9 @@ 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,uint8_t wild); switch_status_t mg_create_mgco_command(MgMgcoCommand *cmd, uint8_t apiType, uint8_t cmdType); +switch_status_t mg_send_oos_service_change(megaco_profile_t* mg_profile, const char* term_name, int wild); +switch_status_t mg_send_ins_service_change(megaco_profile_t* mg_profile, const char* term_name, int wild); + /****************************************************************************************************************/