From 4d5ea559242c892e83e19a8837328c3fefb1e5b5 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 28 May 2013 08:17:44 -0500 Subject: [PATCH] FS-5480 --resolve --- src/switch_channel.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/switch_channel.c b/src/switch_channel.c index de9bf7da4f..e35d159407 100644 --- a/src/switch_channel.c +++ b/src/switch_channel.c @@ -1040,16 +1040,29 @@ SWITCH_DECLARE(switch_status_t) switch_channel_set_profile_var(switch_channel_t channel->caller_profile->chan_name = v; } else { 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->val = v; if (!channel->caller_profile->soft) { channel->caller_profile->soft = n; } 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; } }