Sponsor: VoiceMeUp - Corporate & Wholesale VoIP Services

VoIP Mailing List Archives
Mailing list archives for the VoIP community
 SearchSearch 

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


 
Post new topic   Reply to topic    VoIP Mailing List Archives Forum Index -> Asterisk Users
View previous topic :: View next topic  
Author Message
ecc at cmu.edu
Guest





PostPosted: Wed Jul 02, 2014 4:25 pm    Post subject: [asterisk-users] quoting arguments to System command in dial Reply with quote

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
Back to top
johnkiniston at gmail.com
Guest





PostPosted: Wed Jul 02, 2014 7:01 pm    Post subject: [asterisk-users] quoting arguments to System command in dial Reply with quote

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@cmu.edu (ecc@cmu.edu)> wrote:
Quote:
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
Back to top
ecc at cmu.edu
Guest





PostPosted: Fri Jul 04, 2014 12:30 pm    Post subject: [asterisk-users] quoting arguments to System command in dial Reply with quote

On Wed, Jul 02, 2014 at 05:00:47PM -0700, John Kiniston wrote:
Quote:
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)})})

Thanks for the suggestion; I'll try it. I'm still bothered that I
can't figure out how to reliably quote the characters rather than just
stripping them out.

--
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
Back to top
jnovack at stromberg-c...
Guest





PostPosted: Fri Jul 04, 2014 1:21 pm    Post subject: [asterisk-users] quoting arguments to System command in dial Reply with quote

Eric Cooper wrote:
Quote:
On Wed, Jul 02, 2014 at 05:00:47PM -0700, John Kiniston wrote:
Quote:
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)})})
Thanks for the suggestion; I'll try it. I'm still bothered that I
can't figure out how to reliably quote the characters rather than just
stripping them out.

I have found that this varies from version to version
The parser in 1.4 is quite different than in 1.8 or 11
I ran into this with MSQL commands within the dialplan
Escapes (\) single and double quotes are not uniform from 1.4 through 11.
YMMV

John Novack

--

Dog is my Co-pilot


--
_____________________________________________________________________
-- 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
Back to top
Display posts from previous:   
Post new topic   Reply to topic    VoIP Mailing List Archives Forum Index -> Asterisk Users All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group

VoiceMeUp - Corporate & Wholesale VoIP Services