Israel Gottlieb
2011-Sep-14 00:49 UTC
[asterisk-users] using variables in the shell function
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 -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20110914/8ec6a5f2/attachment.htm>
Steve Edwards
2011-Sep-14 01:08 UTC
[asterisk-users] using variables in the shell function
On Wed, 14 Sep 2011, 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 agiWhy not AGI? They both ('shelling out' or calling an AGI) have the same 'impact' on system resources. You can even write an AGI in shell if you lack the skills for other languages like C, PHP, or Perl. You should be able to cobble up an AGI in PHP (or Perl, but I'm not much of a Perl coder myself) just by cutting and pasting from some of the examples on voip-info.org. This simple task would be a great way for you to 'get your feet wet.' What will you do if the file is not available? -- Thanks in advance, ------------------------------------------------------------------------- Steve Edwards sedwards at sedwards.com Voice: +1-760-468-3867 PST Newline Fax: +1-760-731-3000
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
Israel Gottlieb
2011-Sep-14 12:27 UTC
[asterisk-users] using variables in the shell function
On Wed, Sep 14, 2011 at 5:27 AM, Dale Noll <dnoll at wi.rr.com> wrote:> 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 >Thanks never noticed that function> > > -- > ______________________________**______________________________**_________ > -- 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<http://lists.digium.com/mailman/listinfo/asterisk-users> >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20110914/7ce7639c/attachment.htm>