[Home]

Summary:ASTERISK-23756: setvar directive when used in template and a child of said template, results in duplicate variable names
Reporter:Michael Goryainov (gms)Labels:patch
Date Opened:2014-05-19 07:46:15Date Closed:2019-09-13 07:48:26
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Core/Configuration
Versions:11.9.0 13.18.4 Frequency of
Occurrence
Constant
Related
Issues:
is related toASTERISK-16197 [patch] "setvar" can add multiple variables with the same name to a channel
is related toASTERISK-28955 "setvar" doesn't work properly in dahdi-channels.conf
Environment:it doesn't matterAttachments:( 0) setvar-multiplie.patch
Description:When we use templates in sip.conf, iax.conf, chan_dahdi.conf,
the setvar directive in a peer defenition section doesn't override a variable value from the template, instead it create a new variable with the same name.

e.g.
sip.conf:
{noformat}
[sip-tmpl](!)
type=friend
host=dynamic
disallow=all
allow=alaw
setvar=EXT_CLID=111111

[sip-peer1](sip-tmpl)
callerid=555
setvar=EXT_CLID=333333

asterisk*CLI>sip show peer sip-peer1
...........................
 Variables    :
                EXT_CLID = 333333
                EXT_CLID = 111111
.............................
{noformat}
Comments:By: Rusty Newton (rnewton) 2014-05-22 08:00:45.068-0500

Yup, reproduced in 12.  It isn't clear what should happen from documentation, but I'm pretty sure we shouldn't get duplicate variables.

By: Matt Jordan (mjordan) 2014-05-27 09:50:34.162-0500

This would be a bug all the way back to 1.8.

Given that there was a patch that fixed in this for {{chan_dahdi}}, constructing a similar patch for {{chan_sip}} (and other affected channel drivers, if the author felt kind enough) shouldn't be terribly difficult. :-)

By: Michael Goryainov (gms) 2014-06-06 06:35:00.642-0500

I've written patch myself for chan_sip snd chan_iax2.

By: Guido Falsi (madpilot) 2019-01-28 13:41:06.370-0600

Hi,

This issue has been reported in the FreeBSD bugzilla ere:

https://bugs.freebsd.org/235236

I'd like to push for this patch to be included in current asterisk versions.

As the maintainer of the FreeBSD port I'd rather see this patch in the official asterisk releases than adding it to the port, causing it to diverge from upstream sources.

I'm going to put it up for code review in gerrit shortly, I hope it is up to standards and can be accepted. I'm anyway going to address any feedback I get, the best I can.

By: Friendly Automation (friendly-automation) 2019-09-13 07:48:28.782-0500

Change 12744 merged by Friendly Automation:
channels: Allow updating variable value

[https://gerrit.asterisk.org/c/asterisk/+/12744|https://gerrit.asterisk.org/c/asterisk/+/12744]

By: Friendly Automation (friendly-automation) 2019-09-13 09:46:44.376-0500

Change 12745 merged by George Joseph:
channels: Allow updating variable value

[https://gerrit.asterisk.org/c/asterisk/+/12745|https://gerrit.asterisk.org/c/asterisk/+/12745]

By: Friendly Automation (friendly-automation) 2019-09-13 09:47:22.833-0500

Change 10930 merged by George Joseph:
channels: Allow updating variable value

[https://gerrit.asterisk.org/c/asterisk/+/10930|https://gerrit.asterisk.org/c/asterisk/+/10930]

By: Friendly Automation (friendly-automation) 2019-09-13 09:47:50.271-0500

Change 12746 merged by George Joseph:
channels: Allow updating variable value

[https://gerrit.asterisk.org/c/asterisk/+/12746|https://gerrit.asterisk.org/c/asterisk/+/12746]