Retrieve variabled

Hello, I’m trying to retrieve my peer’s IP for a comparison.
I use this line of code:

Set(ramal=‘200’);
Set(IP=${SHELL(asterisk -rx “sip show peer ${ramal}” |grep Addr |gawk ‘{print $3}’ |cut -f 1 -d ‘:’)});

But I can’t retrieve the output of this code which would be my peers IP. Can someone help me?

chan_sip is deprecated.

Your solution is over-engineered; use:

https://wiki.asterisk.org/wiki/display/AST/Function_SIPPEER

instead.