From 51b96c33cbadcefa19f7e767f020bbe252244fd9 Mon Sep 17 00:00:00 2001 From: lazedo Date: Tue, 29 Aug 2017 22:41:55 +0100 Subject: [PATCH] FS-10623 [mod_conference] emit conference vars in events and allow setting them in profiles --- .../applications/mod_conference/conference_event.c | 2 ++ src/mod/applications/mod_conference/mod_conference.c | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/src/mod/applications/mod_conference/conference_event.c b/src/mod/applications/mod_conference/conference_event.c index cd9b5c2b81..d966a7310b 100644 --- a/src/mod/applications/mod_conference/conference_event.c +++ b/src/mod/applications/mod_conference/conference_event.c @@ -741,10 +741,12 @@ switch_status_t conference_event_add_data(conference_obj_t *conference, switch_e switch_status_t status = SWITCH_STATUS_SUCCESS; switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Conference-Name", conference->name); + switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Conference-Domain", conference->domain); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Size", "%u", conference->count); switch_event_add_header(event, SWITCH_STACK_BOTTOM, "Conference-Ghosts", "%u", conference->count_ghosts); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Conference-Profile-Name", conference->profile_name); switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Conference-Unique-ID", conference->uuid_str); + switch_event_merge(event, conference->variables); return status; } diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index 02eb2542c7..f9834df60f 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -3682,6 +3682,18 @@ conference_obj_t *conference_new(char *name, conference_xml_cfg_t cfg, switch_co } } + if(cfg.profile) { + switch_xml_t xml_profile_variables; + if((xml_profile_variables = switch_xml_child(cfg.profile, "variables")) != NULL) { + for (xml_kvp = switch_xml_child(xml_profile_variables, "variable"); xml_kvp; xml_kvp = xml_kvp->next) { + char *var = (char *) switch_xml_attr_soft(xml_kvp, "name"); + char *val = (char *) switch_xml_attr_soft(xml_kvp, "value"); + if(var && val) { + conference_set_variable(conference, var, val); + } + } + } + } switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, CONF_EVENT_MAINT); conference_event_add_data(conference, event);