From 28e90addf212c893c85e030cf9bd7a6e9dcc91fd Mon Sep 17 00:00:00 2001 From: Brian West Date: Wed, 9 Jul 2014 08:53:14 -0500 Subject: [PATCH] FS-5501 fire event on profile start --- src/mod/endpoints/mod_sofia/mod_sofia.h | 1 + src/mod/endpoints/mod_sofia/sofia.c | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index 3e8e98fafc..da9c2c4122 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -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_" diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 65ca08c3bb..a32cf56ab1 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -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);