[asterisk-users] using variables in the shell function

Danny Nicholas danny at debsinc.com
Wed Sep 14 09:04:56 CDT 2011


+1 Dale - although it would be a good idea for OP to know the in's and out's
of both System and AGI, this is a simpler way for him to catch a fish today.

-----Original Message-----
From: asterisk-users-bounces at lists.digium.com
[mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of Dale Noll
Sent: Tuesday, September 13, 2011 9:27 PM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: Re: [asterisk-users] using variables in the shell function

On 09/13/2011 07:49 PM, Israel Gottlieb wrote:
> is it possible to pas variables to the shell function
>
> Set(recordingavail=${SHELL("ls
> /var/lib/asterisk/sounds/custom/${TOPMENU}")})
>
> im trying to see if a file is available before playing the file
>
> or does anybody have a different idea but not using agi
>
> asterisk 1.6.2.20
> thanks
>

You should check out the STAT function.

core show function STAT



This should evaluate to 1
  ${STAT(e,/var/lib/asterisk/sounds/en/vm-goodbye.gsm)})

This should evaluate to 0
  ${STAT(e,/var/lib/asterisk/sounds/en/xyzzy.gsm)}


Dale


--
_____________________________________________________________________
-- 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




More information about the asterisk-users mailing list