FS-5501 fire event on profile start

This commit is contained in:
Brian West 2014-07-09 08:53:14 -05:00
parent ec008234e9
commit 28e90addf2
2 changed files with 10 additions and 0 deletions

View 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_"

View 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);