[asterisk-users] Properly Escaping Quotes and Commas

Cody Harris qbasicer at gmail.com
Thu Dec 22 10:34:48 CST 2011


Hello all,
I have a setup where Asterisk sends a message to a few jabber users on each
incoming call, like:

exten => s,n,Macro(sendim,"Incoming call from ${CALLERID(all)}")

The macro looks like this:

[macro-sendimuser2]
exten => s,n,JabberSend(asterisk,user2 at gmail.com,${ARG1})
exten => s,n,JabberSend(asterisk,user2 at internal.jabber.server.tld,${ARG1})

[macro-sendim]
exten => s,1,Noop("Holder");
same  => n,Macro(sendimuser1,${ARG1})
same  => n,Macro(sendimuser2,${ARG1})

The issue I'm having, is if the callerID contains a command, such as:
Lastname, Firstname, ${CALLERID(all)} turns into "Lastname, Firstname"
<number>.

This seems to mess up the quoting, as the macro argument expands to be
"Incoming call from "Lastname, Firstname" <number>, and the ${ARG1} as the
macro sees it is set to "Incoming call from "Lastname

The comma ends up outside the double quotes and then it splits the macro
arguments.

What's the best way to do this right?


Thanks!!!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20111222/70e01288/attachment.htm>


More information about the asterisk-users mailing list