[asterisk-users] Run AGI while agent ringing instead of	only	when connected
    Danny Nicholas 
    danny at debsinc.com
       
    Tue Apr 10 16:02:05 CDT 2012
    
    
  
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
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20120410/18dd29e8/attachment.htm>
    
    
More information about the asterisk-users
mailing list