[asterisk-users] AMI perl daemon

Ryan Bullock rrb3942 at gmail.com
Mon May 16 14:19:15 CDT 2011


Calling ->action() is going to wait for the originate to finish (even
if you use 'Async'). I think the default timeout for Originate is 60
seconds or so before it fails.

I would recommend reading up on:

http://search.cpan.org/~mlehmann/AnyEvent-5.34/
http://search.cpan.org/~mlehmann/AnyEvent-DBI-2.1/

You could us a timer to periodically poll your database and do
non-blocking originates (with async) with callbacks to catch the
response, update the log, and do the delete.

On Mon, May 16, 2011 at 11:49 AM, vip killa <vipkilla at gmail.com> wrote:
> http://pastebin.com/W5h9AMrQ
> anything else you need to see?
>
> On Mon, May 16, 2011 at 2:45 PM, Ryan Bullock <rrb3942 at gmail.com> wrote:
>>
>> A normal Originate over the AMI will block all other actions until it
>> completes. So to do other commands while the Originate is still going
>> you have to call Originate with the Async option. I would suggest
>> using  an Originate with the 'Async' option and OriginateHack=>1. If
>> that is still not working I would have to see your code. Unfortunately
>> I am not on irc today.
>>
>> On Mon, May 16, 2011 at 11:16 AM, vip killa <vipkilla at gmail.com> wrote:
>> > i was able to create a daemon that queries a database every 2 seconds
>> > for
>> > outbound calls. the daemon originates a call to a destination determined
>> > by
>> > the database. what i've noticed is, after the originate, the script
>> > never
>> > does anything else. it seems i have to use "Async" or the AMI will
>> > disconnect, so i tried using OriginateHack=>1 but still no dice... any
>> > ideas?
>> > On Mon, May 16, 2011 at 11:37 AM, Ryan Bullock <rrb3942 at gmail.com>
>> > wrote:
>> >>
>> >> Alex is pointing you in the right direction. You should want a single
>> >> daemon running that then gets notified by the voicemail script, either
>> >> through a FIFO, a socket, or by dropping a file in a watched
>> >> directory.
>> >>
>> >> If you are going to write a daemon, I would suggest looking at :
>> >>
>> >> http://search.cpan.org/~greenbean/Asterisk-AMI-v0.2.5/
>> >>
>> >> It has integration with event loops and should work well for what you
>> >> are doing. It also has some features for detecting disconnects and
>> >> timeouts.
>> >>
>> >> On Mon, May 16, 2011 at 5:42 AM, Alex Balashov
>> >> <abalashov at evaristesys.com> wrote:
>> >> > On 05/16/2011 08:33 AM, vip killa wrote:
>> >> >
>> >> >> Thank you, that makes sense but actually I would be invoking the
>> >> >> script
>> >> >> using the "externnotify" in voicemail.conf, similar to
>> >> >> "externnotify = /var/lib/asterisk/scripts/notify.pl
>> >> >> <http://notify.pl>"
>> >> >> I assume "externnotify" cannot call the FastAGI server...correct?
>> >> >
>> >> > That is correct.  But you can call a script that notifies the daemon
>> >> > through
>> >> > a FIFO or UNIX domain socket, if local, or network socket if remote.
>> >> >
>> >> > --
>> >> > Alex Balashov - Principal
>> >> > Evariste Systems LLC
>> >> > 260 Peachtree Street NW
>> >> > Suite 2200
>> >> > Atlanta, GA 30303
>> >> > Tel: +1-678-954-0670
>> >> > Fax: +1-404-961-1892
>> >> > Web: http://www.evaristesys.com/
>> >> >
>> >> > --
>> >> > _____________________________________________________________________
>> >> > -- 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
>> >> >
>> >>
>> >> --
>> >> _____________________________________________________________________
>> >> -- 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
>> >
>> >
>> > --
>> > _____________________________________________________________________
>> > -- 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
>> >
>>
>> --
>> _____________________________________________________________________
>> -- 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
>
>
> --
> _____________________________________________________________________
> -- 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