Asterisk SIPPEER chanvarname item

Hello guys. I have a sip account defined in sip.conf like that:

[7265]
type=friend
context=office
host=dynamic
secret=1234
insecure=invite,port
nat=no
setvar=TESTVAR=YUP

‘sip show peer 7265’ confirms that variable is set properly:

Variables :
TESTVAR = YUP

I would like to check status of this variable in my dialplan so I’m trying to use chanvarname item of SIPPEER function according to: https://wiki.asterisk.org/wiki/display/AST/Asterisk+11+Function_SIPPEER but it constantly gives me nothing. I tried like below

NoOp(${SIPPEER(7265,chanvarname)})
NoOp(${SIPPEER(7265,chanvarTESTVAR)})
NoOp(${SIPPEER(7265,chanvarname(TESTVAR))})
NoOp(${SIPPEER(7265,chanvarname,TESTVAR)})

and many others but did not succeed - always returns nothing. What do I miss? Other items like ip, port etc are returned correctly. Hope you can help.

Tested on Asterisk 11.6-cert4 built by root on a x86_64 running Linux on 2017-04-19 13:31:04 UTC but checked also on 13-cert and behaves the same way.

I always something like:


Set (Mailbox=${SIPPEER(${Peer},@variable)}))

Tried

NoOp(${SIPPEER(7265,@TESTVAR)})

and it also gave me nothing. Where did you find this “@” syntax?

I’ve been using it a very long time, It may be from back in the 1.2 days.

Hello again,
I found the proper syntax for what I tried to do and it goes as follows:

chanvar[name] - A channel variable configured with setvar for this peer.

No SIPPEER documentation available on wiki.asterisk.org reveales this square bracket based syntax. Fortunately it is described properly when you type “core show function SIPPEER” in CLI.

Issue solved. Thank you johnkiniston for your help.