[asterisk-bugs] [JIRA] (ASTERISK-27438) Custom variable at endpoint definition are duplicated

Richard Mudgett (JIRA) noreply at issues.asterisk.org
Wed Nov 22 11:53:07 CST 2017


    [ https://issues.asterisk.org/jira/browse/ASTERISK-27438?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=240235#comment-240235 ] 

Richard Mudgett commented on ASTERISK-27438:
--------------------------------------------

This is not a bug.  Config templates act like text substitution.  So given the below templates and section using the templates:
{noformat}
[my_template](!)
set_var=my_var=0
my_setting=yes

[my_template2](!)
set_var=my_var=1
my_setting2=yes

[my_setup](my_template,my_template2)
set_var=my_var=2
{noformat}

The section expands as if you had explicitly written:
{noformat}
[my_setup]
set_var=my_var=0
my_setting=yes
set_var=my_var=1
my_setting2=yes
set_var=my_var=2
{noformat}

{quote}
*CLI> config show help res_pjsip endpoint set_var 
\[endpoint]
set_var = \[Custom] (Default: ) (Regex: false)

Variable set on a channel involving the endpoint.

 When a new channel is created using the endpoint set the specified variable(s)
on that channel. For multiple channel variables specify multiple 'set_var'(s).
{quote}
In your case, when the PJSIP channel is created the configured set_var variables are set in the order you specified.  Thus your followme channel variable winds up with the last set value of 1.  When you show the endpoint configuration it simply lists off the set_var's you configured.

> Custom variable at endpoint definition are duplicated
> -----------------------------------------------------
>
>                 Key: ASTERISK-27438
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-27438
>             Project: Asterisk
>          Issue Type: Bug
>      Security Level: None
>          Components: Channels/chan_pjsip
>    Affects Versions: 15.1.2
>         Environment: GNU/Linux 3.10.0-693.5.2.el7.x86_64 #1 SMP
>            Reporter: Alexander Rozes
>            Severity: Minor
>              Labels: NewSIP
>
> If you override a custom variable in pjsip.conf, it is duplicated instead of overriding the value.
> {noformat}
> ;================================ ENDPOINT TEMPLATES ==
> [phones-tpl](!)
> type = endpoint
> ...
> set_var=followme=0
> [auth-tpl](!)
> type = auth
> auth_type = userpass
> [aor-tpl](!)
> type = aor
> ...
> max_contacts = 1
> ;================================ ENDPOINT DEFINITIONS ==
> ;----- 101 -----
> [101](phones-tpl)
> aors = 101
> auth = 101
> callerid = 101 <101>
> [101](aor-tpl)
> [101](auth-tpl)
> username = 101
> password = fake_password
> ;----- 102 -----
> [102](phones-tpl)
> aors = 102
> auth = 102
> callerid = 102 <102>
> set_var=followme=1
> [102](aor-tpl)
> [102](auth-tpl)
> username = 102
> password = fake_password
> ...
> {noformat}
> That's what happens:
> {noformat}
> aster*CLI> pjsip show endpoint 101
> ...
> followme                           : 0
> ...
> {noformat}
> {noformat}
> aster*CLI> pjsip show endpoint 102
> ...
> followme                           : 0
> followme                           : 1
> ...
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list