diff --git a/conf/rayo/autoload_configs/rayo.conf.xml b/conf/rayo/autoload_configs/rayo.conf.xml index 47a3a14bc1..a5f8748416 100644 --- a/conf/rayo/autoload_configs/rayo.conf.xml +++ b/conf/rayo/autoload_configs/rayo.conf.xml @@ -2,8 +2,14 @@ + + + + + + diff --git a/src/mod/event_handlers/mod_rayo/conf/autoload_configs/rayo.conf.xml b/src/mod/event_handlers/mod_rayo/conf/autoload_configs/rayo.conf.xml index 47a3a14bc1..a5f8748416 100644 --- a/src/mod/event_handlers/mod_rayo/conf/autoload_configs/rayo.conf.xml +++ b/src/mod/event_handlers/mod_rayo/conf/autoload_configs/rayo.conf.xml @@ -2,8 +2,14 @@ + + + + + + diff --git a/src/mod/event_handlers/mod_rayo/mod_rayo.c b/src/mod/event_handlers/mod_rayo/mod_rayo.c index cc7fc65037..614975ee15 100644 --- a/src/mod/event_handlers/mod_rayo/mod_rayo.c +++ b/src/mod/event_handlers/mod_rayo/mod_rayo.c @@ -229,6 +229,8 @@ static struct { int pause_when_offline; /** flag to reduce log noise */ int offline_logged; + /** if true, channel variables are added to offer */ + int add_variables_to_offer; } globals; /** @@ -3682,18 +3684,23 @@ static iks *rayo_create_offer(struct rayo_call *call, switch_core_session_t *ses iks_insert_attrib(offer, "to", profile->destination_number); } - /* add signaling headers */ + /* add headers to offer */ { switch_event_header_t *var; add_header(offer, "from", switch_channel_get_variable(channel, "sip_full_from")); add_header(offer, "to", switch_channel_get_variable(channel, "sip_full_to")); add_header(offer, "via", switch_channel_get_variable(channel, "sip_full_via")); - /* get all variables prefixed with sip_h_ */ + /* add all SIP header variables and (if configured) all other variables */ for (var = switch_channel_variable_first(channel); var; var = var->next) { if (!strncmp("sip_h_", var->name, 6)) { add_header(offer, var->name + 6, var->value); } + if (globals.add_variables_to_offer) { + char var_name[1024]; + snprintf(var_name, 1024, "variable-%s", var->name); + add_header(offer, var_name, var->value); + } } switch_channel_variable_last(channel); } @@ -4066,6 +4073,7 @@ static switch_status_t do_config(switch_memory_pool_t *pool, const char *config_ globals.num_message_threads = 8; globals.offer_uri = 1; globals.pause_when_offline = 0; + globals.add_variables_to_offer = 0; /* get params */ { @@ -4102,6 +4110,10 @@ static switch_status_t do_config(switch_memory_pool_t *pool, const char *config_ if (switch_true(val)) { globals.pause_when_offline = 1; } + } else if (!strcasecmp(var, "add-variables-to-offer")) { + if (switch_true(val)) { + globals.add_variables_to_offer = 1; + } } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Unsupported param: %s\n", var); }