You could use the REPLACE function to zap the quotes and commas. asterisk -rx "core show function REPLACE"
-= Info about function 'REPLACE' =- [Synopsis] Replace a set of characters in a given string with another character. [Description] Iterates through a string replacing all the <find-chars> with <replace-ch ar>. <replace-char> may be either empty or contain one character. If empty, all <find-chars> will be deleted from the output. NOTE: The replacement only occurs in the output. The original variable is not altered. [Syntax] REPLACE(varname,find-chars[,replace-char]) [Arguments] Not available [See Also] Not available From: [email protected] [mailto:[email protected]] On Behalf Of Cody Harris Sent: Thursday, December 22, 2011 10:35 AM To: [email protected] Subject: [asterisk-users] Properly Escaping Quotes and Commas 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,[email protected],${ARG1}) exten => s,n,JabberSend(asterisk,[email protected],${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!!!
-- _____________________________________________________________________ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- New to Asterisk? Join us for a live introductory webinar every Thurs: http://www.asterisk.org/hello asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
