[asterisk-users] Run AGI while agent ringing instead of only when connected
Satish Barot
satish4asterisk at gmail.com
Wed Apr 11 00:20:30 CDT 2012
I would implement it in a different way.
As you seem to be a seasoned player just a hint here.
How about adding local channels as queue members and executing agi in local
channel context before actual dial()?
Only limitation is, AGI will get executed for each dial irrespective of
whether an extension rings or not. But at least you can identify which
extension is being dialed.
See 'Using Local Channels' on
http://ofps.oreilly.com/titles/9780596517342/asterisk-ACD.html
--Satish Barot
On Wed, Apr 11, 2012 at 2:45 AM, Todd Routhier <fonemasta at gmail.com> wrote:
> Thanks again Danny, Perl was the first thing I tinkered with back in the
> 90's but haven't messed with it for years.
>
> Looking over what you sent, I get about 90% of what's going on there. With
> a little searching and brushing up on my Perl, I think I will be able to
> make this work.
>
> This is a good solution and, if I can get this to work, I won't even need
> the AGI. I can basically just hit what I need using CURL within the Perl
> script (I think).
>
> All the AGI was going to do for me is hit a URL with some parameters out
> on the Internet. So, pretty sure I can do all that within the Perl Script
> and leave AGI out of it completely.
>
> --Todd
>
>
> On Tue, Apr 10, 2012 at 4:02 PM, Danny Nicholas <danny at debsinc.com> wrote:
>
>> Were this my task, I would do a PERL/C daemon to run the AGI. This is
>> how I do it in PERL****
>>
>> my $astman = new Asterisk::Manager;****
>>
>> $astman->user('user');****
>>
>> $astman->secret('secret');****
>>
>> my $man_addr='127.0.0.1';****
>>
>> <this section is for if your asterisk isn’t on 127.0.0.1>****
>>
>> my $man_ok=1;****
>>
>> open (my $man_in, "/etc/asterisk/manager.conf") or
>> $man_ok=undef;****
>>
>> if ($man_ok) {****
>>
>> while (<$man_in>) {****
>>
>> if ($_ =~ /^bindaddr/) {****
>>
>> (undef,$man_addr) = split /\=/, $_;****
>>
>> }****
>>
>> }****
>>
>> close $man_in;****
>>
>> }****
>>
>> $man_addr =~ s/\s//g;****
>>
>> <untaint>****
>>
>> ( $man_addr )=( $man_addr =~ /(.*)/ );****
>>
>> <end of reassign section>****
>>
>> $astman->host($man_addr);****
>>
>> $astman->connect || die "Could not connect to " .
>> $astman->host . "!\n";****
>>
>> ** **
>>
>> my %resp = $astman->sendcommand( Action => 'Originate',**
>> **
>>
>> Channel =>
>> $extval,****
>>
>> Variable =>
>> "ARG1=$fileval",****
>>
>> Exten =>
>> $extval,****
>>
>> Context =>
>> 'playit',****
>>
>> priority => 1,
>> ****
>>
>> Number =>
>> 5551212****
>>
>> );****
>>
>> <loop through %resp and find desired value; launch AGI>****
>>
>> sleep 2;****
>>
>> %resp = $astman->sendcommand( Action => 'Logoff');****
>>
>> ** **
>>
>> *From:* asterisk-users-bounces at lists.digium.com [mailto:
>> asterisk-users-bounces at lists.digium.com] *On Behalf Of *Todd Routhier
>> *Sent:* Tuesday, April 10, 2012 3:55 PM
>>
>> *To:* Asterisk Users Mailing List - Non-Commercial Discussion
>> *Subject:* Re: [asterisk-users] Run AGI while agent ringing instead of
>> only when connected****
>>
>> ** **
>>
>> Yes Sir.. Studied it pretty hard, did I miss a solution? Trust me, been
>> at this for a number of years off and on, I never post unless I have dug
>> hard, searching all the Asterisk resources I know of.****
>>
>> ** **
>>
>> This is where I got most of my info but the solutions mentioned on that
>> page require the call to be "Connected" to the agent before the AGI fires.
>> Once the agent is connected, I can get all sorts of info from Channel Vars.
>> Still, once the agent is connected, it's sort of too late, I need the AGI
>> to fire will the agent is ringing.****
>>
>> ** **
>>
>> Thanks for your help so far.****
>>
>> On Tue, Apr 10, 2012 at 3:42 PM, Danny Nicholas <danny at debsinc.com>
>> wrote:****
>>
>> You have read this thread?
>> http://www.voip-info.org/wiki/view/Asterisk+cmd+Queue ****
>>
>> ****
>>
>> *From:* asterisk-users-bounces at lists.digium.com [mailto:
>> asterisk-users-bounces at lists.digium.com] *On Behalf Of *Todd Routhier
>> *Sent:* Tuesday, April 10, 2012 3:15 PM
>> *To:* Asterisk Users Mailing List - Non-Commercial Discussion
>> *Subject:* [asterisk-users] Run AGI while agent ringing instead of only
>> when connected****
>>
>> ****
>>
>> What I am trying to accomplish is to run an AGI script each time an
>> agent's line starts ringing. I currently have the AGI firing when the agent
>> answers the call using the Queue command, something like
>> queue(MyQueue,,,,,MyAgi.php). Works great but I need the AGI to run when
>> the agent's phone starts ringing.****
>>
>> ****
>>
>> Strangely, I can't find anything real useful on this after searching
>> Google, this list, various Asterisk forums etc.****
>>
>> ****
>>
>> Is this supported? If not, is there some other maybe not so supported way
>> to accomplish this?****
>>
>> ****
>>
>> I get how I can just fire an AGI from the dial plan but once I leave
>> control to the queue, I can't really do that, I don't think.****
>>
>> ****
>>
>> Thanks in advance for any help!****
>>
>> ****
>>
>> --Todd****
>>
>> ****
>>
>>
>> --
>> _____________________________________________________________________
>> -- 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20120411/2afb1485/attachment.htm>
More information about the asterisk-users
mailing list