mod_rayo: new configuration parameter, add-variables-to-offer (default=false). When true, all channel variables are included in the offer to rayo client

This commit is contained in:
Chris Rienzo 2014-11-14 13:22:53 -05:00
parent c39e301efc
commit e1c0ef5008
3 changed files with 26 additions and 2 deletions

View File

@ -2,8 +2,14 @@
<!-- rayo params --> <!-- rayo params -->
<settings> <settings>
<!-- ends idle calls : unbridged calls that have not been controlled by client in some time -->
<param name="max-idle-sec" value="300"/> <param name="max-idle-sec" value="300"/>
<!-- conference profile to use for mixers- sla = shared line appearance / conference /w no audio -->
<param name="mixer-conf-profile" value="sla"/> <param name="mixer-conf-profile" value="sla"/>
<!-- if true, to attribute in offer uses URI instead of name/number -->
<param name="offer-uri" value="true"/>
<!-- if true, channel variables are added to rayo client offer -->
<param name="add-variables-to-offer" value="false"/>
</settings> </settings>
<!-- record component params --> <!-- record component params -->

View File

@ -2,8 +2,14 @@
<!-- rayo params --> <!-- rayo params -->
<settings> <settings>
<!-- ends idle calls : unbridged calls that have not been controlled by client in some time -->
<param name="max-idle-sec" value="300"/> <param name="max-idle-sec" value="300"/>
<!-- conference profile to use for mixers- sla = shared line appearance / conference /w no audio -->
<param name="mixer-conf-profile" value="sla"/> <param name="mixer-conf-profile" value="sla"/>
<!-- if true, to attribute in offer uses URI instead of name/number -->
<param name="offer-uri" value="true"/>
<!-- if true, channel variables are added to rayo client offer -->
<param name="add-variables-to-offer" value="false"/>
</settings> </settings>
<!-- record component params --> <!-- record component params -->

View File

@ -229,6 +229,8 @@ static struct {
int pause_when_offline; int pause_when_offline;
/** flag to reduce log noise */ /** flag to reduce log noise */
int offline_logged; int offline_logged;
/** if true, channel variables are added to offer */
int add_variables_to_offer;
} globals; } 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); iks_insert_attrib(offer, "to", profile->destination_number);
} }
/* add signaling headers */ /* add headers to offer */
{ {
switch_event_header_t *var; switch_event_header_t *var;
add_header(offer, "from", switch_channel_get_variable(channel, "sip_full_from")); 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, "to", switch_channel_get_variable(channel, "sip_full_to"));
add_header(offer, "via", switch_channel_get_variable(channel, "sip_full_via")); 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) { for (var = switch_channel_variable_first(channel); var; var = var->next) {
if (!strncmp("sip_h_", var->name, 6)) { if (!strncmp("sip_h_", var->name, 6)) {
add_header(offer, var->name + 6, var->value); 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); 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.num_message_threads = 8;
globals.offer_uri = 1; globals.offer_uri = 1;
globals.pause_when_offline = 0; globals.pause_when_offline = 0;
globals.add_variables_to_offer = 0;
/* get params */ /* get params */
{ {
@ -4102,6 +4110,10 @@ static switch_status_t do_config(switch_memory_pool_t *pool, const char *config_
if (switch_true(val)) { if (switch_true(val)) {
globals.pause_when_offline = 1; globals.pause_when_offline = 1;
} }
} else if (!strcasecmp(var, "add-variables-to-offer")) {
if (switch_true(val)) {
globals.add_variables_to_offer = 1;
}
} else { } else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Unsupported param: %s\n", var); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Unsupported param: %s\n", var);
} }