FS-5480 --resolve

This commit is contained in:
Anthony Minessale 2013-05-28 08:17:44 -05:00
parent acc8eb5cb6
commit 4d5ea55924

View File

@ -1040,6 +1040,7 @@ SWITCH_DECLARE(switch_status_t) switch_channel_set_profile_var(switch_channel_t
channel->caller_profile->chan_name = v; channel->caller_profile->chan_name = v;
} else { } else {
profile_node_t *pn, *n = switch_core_alloc(channel->caller_profile->pool, sizeof(*n)); profile_node_t *pn, *n = switch_core_alloc(channel->caller_profile->pool, sizeof(*n));
int var_found;
n->var = switch_core_strdup(channel->caller_profile->pool, name); n->var = switch_core_strdup(channel->caller_profile->pool, name);
n->val = v; n->val = v;
@ -1047,9 +1048,21 @@ SWITCH_DECLARE(switch_status_t) switch_channel_set_profile_var(switch_channel_t
if (!channel->caller_profile->soft) { if (!channel->caller_profile->soft) {
channel->caller_profile->soft = n; channel->caller_profile->soft = n;
} else { } else {
for(pn = channel->caller_profile->soft; pn && pn->next; pn = pn->next); var_found = 0;
if (pn) { for(pn = channel->caller_profile->soft; pn ; pn = pn->next) {
if (!strcasecmp(pn->var,n->var)) {
pn->val = n->val;
var_found = 1;
break;
}
if(!pn->next) {
break;
}
}
if (pn && !pn->next && !var_found) {
pn->next = n; pn->next = n;
} }
} }