Asterisk variables are parsed before the command is looked up, so I imagine that it is failing to find the variable and substituting it as an empty string.
You may be able to avoid this by using \ on the $ and/or the {}, but it would be easier to use a shell script to hide the details.
Also, I don’t believe system provides any access to standard output. For that, there is a function, whose name I forget.
Why do you actually need to do this? Using asterisk -r is quite expensive, so I hope you don’t do it for every single call.
I built a php script, which changes the active user-profile of my phone when somebody calls a specific number and specifies an extension.
But if the new profile of phone 1 is still active in phone 2, I also need to change the profile of phone 2.
Example:
Phone 1 has Profile_ABC
Phone 2 has Profile_XYZ
I change the profile of Phone 1 to Profile_XYZ. It is still active on Phone 2. This is why I need the IP of the original Phone of a profile (which is Phone 2 here).
I am using sip show peers to get a list of all active profiles and their current IP so I can connect to the current IP of Phone 2 and remove profile_XYZ.
Using \ didn’t help.
You said there is a function for standard output.
Did you mean the SHELL function? voip-info.org/wiki/view/Asterisk+func+shell
We are unable to use this function as we are still on asterisk 1.4.
| not : (some fonts show a break in the bar - it produces neater vertical lines, given there will be a gap between lines).
${callerid} when referencing the value.
There is an easier way of substring extensions (and functions), see the sample extensions.conf, the channelvariables.tex file, or the relevant chapter in Asterisk: The Future of Telephony