} else {
tech_pvt->invite_contact = switch_core_session_strdup(nsession, gateway_ptr->register_contact);
}
+
+ if (gateway_ptr->vars) {
+ switch_event_header_t *hp;
+ for(hp = gateway_ptr->vars->headers; hp; hp = hp->next) {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s setting variable [%s]=[%s]\n",
+ switch_channel_get_name(nchannel), hp->name, hp->value);
+ switch_channel_set_variable(nchannel, hp->name, hp->value);
+ }
+ }
+
} else {
if (!(dest = strchr(profile_name, '/'))) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid URL\n");
switch_core_hash_delete(mod_sofia_globals.gateway_hash, gateway_ptr->register_from);
switch_core_hash_delete(mod_sofia_globals.gateway_hash, gateway_ptr->register_contact);
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Deleted gateway %s\n", gateway_ptr->name);
+ if (gateway_ptr->vars) {
+ switch_event_destroy(&gateway_ptr->vars);
+ }
} else {
last = gateway_ptr;
}