[asterisk-users] quoting arguments to System command in dialplan

John Kiniston johnkiniston at gmail.com
Wed Jul 2 19:00:47 CDT 2014


How about using the FILTER function to strip out anything you don't like
from the CALLERID variables?

Set(CIDNAME=${FILTER(A-Z,${CALLERID(NAME)})})
Set(CIDNUM=${FILTER(0-9,${CALLERID(NUM)})})




On Wed, Jul 2, 2014 at 2:25 PM, Eric Cooper <ecc at cmu.edu> wrote:

> I'm trying to invoke a program to send a received
> fax.  I'd like to *safely* pass the value of ${CALLERID(all)} as an
> argument to the program, executed by System(...).  The problem is that
> the callerid can have quotes or other dangerous characters as far as
> the shell is concerned.
>
> For example, the test-fax service that I'm using sets the callerid to
>     "UNAVAILABLE  " <888NNNNNNN>
> (I forget the actual N digits, that's unimportant).  What's important
> is the quotation marks.
>
> I haven't been able to figure out a way using the QUOTE function to
> accomplish what I want.  I either get too few or too many quotes, both
> resulting in multiple arguments being passed to my program instead of one.
>
> I can paste some logging output if that would help.
>
> Any suggestions would be appreciated.
>
> --
> Eric Cooper             e c c @ c m u . e d u
>
> --
> _____________________________________________________________________
> -- 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
>



-- 
A human being should be able to change a diaper, plan an invasion, butcher
a hog, conn a ship, design a building, write a sonnet, balance accounts,
build a wall, set a bone, comfort the dying, take orders, give orders,
cooperate, act alone, solve equations, analyze a new problem, pitch manure,
program a computer, cook a tasty meal, fight efficiently, die gallantly.
Specialization is for insects.
---Heinlein
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20140702/2a2ad34d/attachment.html>


More information about the asterisk-users mailing list