]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-5501 fire event on profile start
authorBrian West <brian@freeswitch.org>
Wed, 9 Jul 2014 13:53:14 +0000 (08:53 -0500)
committerBrian West <brian@freeswitch.org>
Wed, 9 Jul 2014 13:53:14 +0000 (08:53 -0500)
src/mod/endpoints/mod_sofia/mod_sofia.h
src/mod/endpoints/mod_sofia/sofia.c

index 3e8e98fafca2a5ee0224f4487dab0b48a7fb0c86..da9c2c412289154b1331d866f500b7ebd3c6001f 100644 (file)
@@ -92,6 +92,7 @@ typedef struct private_object private_object_t;
 #define MY_EVENT_RECOVERY_SEND "sofia::recovery_send"
 #define MY_EVENT_RECOVERY_RECOVERED "sofia::recovery_recovered"
 #define MY_EVENT_ERROR "sofia::error"
+#define MY_EVENT_PROFILE_START "sofia::profile_start"
 
 #define MULTICAST_EVENT "multicast::event"
 #define SOFIA_REPLACES_HEADER "_sofia_replaces_"
index 65ca08c3bb875fc571223e50db96adf574b88d00..a32cf56ab1d81bbf766d99506b203a0dc231f53c 100644 (file)
@@ -5438,6 +5438,7 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name)
                                        }
 
                                        if (profile->sipip) {
+                                               switch_event_t *s_event;
                                                if (!profile->extsipport) profile->extsipport = profile->sip_port;
 
                                                launch_sofia_profile_thread(profile);
@@ -5447,6 +5448,14 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name)
                                                } else {
                                                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Started Profile %s [%s]\n", profile->name, url);
                                                }
+                                               if ((switch_event_create_subclass(&s_event, SWITCH_EVENT_CUSTOM, MY_EVENT_PROFILE_START) == SWITCH_STATUS_SUCCESS)) {
+                                                       switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "module_name", "mod_sofia");
+                                                       switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "profile_name", profile->name);
+                                                       if (profile) {
+                                                               switch_event_add_header_string(s_event, SWITCH_STACK_BOTTOM, "profile_uri", profile->url);
+                                                       }
+                                                       switch_event_fire(&s_event);
+                                               }
                                        } else {
                                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Unable to start Profile %s due to no configured sip-ip\n", profile->name);
                                                sofia_profile_start_failure(profile, profile->name);