]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
adding service change wrapper APIs
authorKapil <kgupta@sangoma.com>
Wed, 18 Jul 2012 14:11:51 +0000 (10:11 -0400)
committerKapil <kgupta@sangoma.com>
Wed, 18 Jul 2012 14:11:51 +0000 (10:11 -0400)
src/mod/endpoints/mod_media_gateway/media_gateway_cmd_handler.c
src/mod/endpoints/mod_media_gateway/media_gateway_stack.h

index 3e1aeb462d02acbdb7e8fff5294427edc5754242..8c86389e96dd885cf95ac787e19d11b508c4e83c 100644 (file)
@@ -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))
index 8225ee95700997b8f22731fe2297abb95090ab68..bbc3141d37c8206a5347ba3660759374c154846b 100644 (file)
@@ -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);
+
 
 
 /****************************************************************************************************************/