[asterisk-users] using variables in the shell function

Israel Gottlieb isrlgb at gmail.com
Wed Sep 14 07:42:49 CDT 2011


On Wed, Sep 14, 2011 at 4:08 AM, Steve Edwards <asterisk.org at sedwards.com>wrote:

> 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 agi
>>
>
> Why 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?
>

i know it has the same impact
im using asterisk since 0.4 yup lots of years mostly for the hobby and i
have written some stuff in bash and php  but never really got connected to
real programming. i read code no problem and understand exacttly what its
doing and do fix up what i need but most of the time just dont have the
patience to do it myself  (i have full time work in IT)

in this instance i was just writing a simple ivr maybe 10 lines were you
could descend down the ivr as long as there is a recording and if it could
be done simple within the dialplan i prefer that

i have made sophisticated ivr with lots up webservices and databases but
then i of course use a external language  (a function to speak to
webservices with xml parsing  i think would be a great addition to the
dialplan )

thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20110914/2a19f80a/attachment.htm>


More information about the asterisk-users mailing list