]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-5480 --resolve
authorAnthony Minessale <anthm@freeswitch.org>
Tue, 28 May 2013 13:17:44 +0000 (08:17 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Tue, 28 May 2013 13:18:00 +0000 (08:18 -0500)
src/switch_channel.c

index de9bf7da4f16819066b0c69e7b4f1f10848f969b..e35d159407b66f67abf1723deb8d06ff8179627f 100644 (file)
@@ -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;
+                       
+                       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) {
+                       if (pn && !pn->next && !var_found) {
                                pn->next = n;
                        }
                }