Thanks again Danny, Perl was the first thing I tinkered with back in the 90's but haven't messed with it for years.<div><br></div><div>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.</div>
<div><br></div><div>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).</div><div><br></div><div>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.</div>
<div><br></div><div>--Todd<br><br><div class="gmail_quote">On Tue, Apr 10, 2012 at 4:02 PM, Danny Nicholas <span dir="ltr"><<a href="mailto:danny@debsinc.com">danny@debsinc.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div lang="EN-US" link="blue" vlink="purple"><div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Were this my task, I would do a PERL/C daemon to run the AGI. This is how I do it in PERL<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> my $astman = new Asterisk::Manager;<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> $astman->user('user');<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> $astman->secret('secret');<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> my $man_addr='127.0.0.1';<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><this section is for if your asterisk isn’t on 127.0.0.1><u></u><u></u></span></p><p class="MsoNormal">
<span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> my $man_ok=1;<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> open (my $man_in, "/etc/asterisk/manager.conf") or $man_ok=undef;<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> if ($man_ok) {<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> while (<$man_in>) {<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> if ($_ =~ /^bindaddr/) {<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> (undef,$man_addr) = split /\=/, $_;<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> }<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> }<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> close $man_in;<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> }<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> $man_addr =~ s/\s//g;<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><untaint><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> ( $man_addr )=( $man_addr =~ /(.*)/ );<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><end of reassign section><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> $astman->host($man_addr);<u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> $astman->connect || die "Could not connect to " . $astman->host . "!\n";<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> my %resp = $astman->sendcommand( Action => 'Originate',<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> Channel => $extval,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> Variable => "ARG1=$fileval",<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> Exten => $extval,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> Context => 'playit',<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> priority => 1,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> Number => 5551212<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> );<u></u><u></u></span></p><p class="MsoNormal">
<span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><loop through %resp and find desired value; launch AGI><u></u><u></u></span></p><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> sleep 2;<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> %resp = $astman->sendcommand( Action => 'Logoff');<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p><p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> <a href="mailto:asterisk-users-bounces@lists.digium.com" target="_blank">asterisk-users-bounces@lists.digium.com</a> [mailto:<a href="mailto:asterisk-users-bounces@lists.digium.com" target="_blank">asterisk-users-bounces@lists.digium.com</a>] <b>On Behalf Of </b>Todd Routhier<br>
<b>Sent:</b> Tuesday, April 10, 2012 3:55 PM</span></p><div class="im"><br><b>To:</b> Asterisk Users Mailing List - Non-Commercial Discussion<br></div><b>Subject:</b> Re: [asterisk-users] Run AGI while agent ringing instead of only when connected<u></u><u></u><p>
</p><div><div class="h5"><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">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.<u></u><u></u></p>
<div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal">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.<u></u><u></u></p>
</div><div><p class="MsoNormal"><u></u> <u></u></p></div><div><p class="MsoNormal" style="margin-bottom:12.0pt">Thanks for your help so far.<u></u><u></u></p><div><p class="MsoNormal">On Tue, Apr 10, 2012 at 3:42 PM, Danny Nicholas <<a href="mailto:danny@debsinc.com" target="_blank">danny@debsinc.com</a>> wrote:<u></u><u></u></p>
<div><div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">You have read this thread? <a href="http://www.voip-info.org/wiki/view/Asterisk+cmd+Queue" target="_blank">http://www.voip-info.org/wiki/view/Asterisk+cmd+Queue</a> </span><u></u><u></u></p>
<div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> </span><u></u><u></u></p><p class="MsoNormal"><b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> <a href="mailto:asterisk-users-bounces@lists.digium.com" target="_blank">asterisk-users-bounces@lists.digium.com</a> [mailto:<a href="mailto:asterisk-users-bounces@lists.digium.com" target="_blank">asterisk-users-bounces@lists.digium.com</a>] <b>On Behalf Of </b>Todd Routhier<br>
<b>Sent:</b> Tuesday, April 10, 2012 3:15 PM<br><b>To:</b> Asterisk Users Mailing List - Non-Commercial Discussion<br><b>Subject:</b> [asterisk-users] Run AGI while agent ringing instead of only when connected</span><u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p></div><p class="MsoNormal">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.<u></u><u></u></p>
<div><div><div><p class="MsoNormal"> <u></u><u></u></p></div><div><p class="MsoNormal">Strangely, I can't find anything real useful on this after searching Google, this list, various Asterisk forums etc.<u></u><u></u></p>
</div><div><p class="MsoNormal"> <u></u><u></u></p></div><div><p class="MsoNormal">Is this supported? If not, is there some other maybe not so supported way to accomplish this?<u></u><u></u></p></div><div><p class="MsoNormal">
<u></u><u></u></p></div><div><p class="MsoNormal">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.<u></u><u></u></p></div><div><p class="MsoNormal">
<u></u><u></u></p></div><div><p class="MsoNormal">Thanks in advance for any help!<u></u><u></u></p></div><div><p class="MsoNormal"> <u></u><u></u></p></div><div><p class="MsoNormal">--Todd<u></u><u></u></p></div><div><p class="MsoNormal">
<u></u><u></u></p></div></div></div></div></div><p class="MsoNormal"><br>--<br>_____________________________________________________________________<br>-- Bandwidth and Colocation Provided by <a href="http://www.api-digital.com" target="_blank">http://www.api-digital.com</a> --<br>
New to Asterisk? Join us for a live introductory webinar every Thurs:<br> <a href="http://www.asterisk.org/hello" target="_blank">http://www.asterisk.org/hello</a><br><br>asterisk-users mailing list<br>To UNSUBSCRIBE or update options visit:<br>
<a href="http://lists.digium.com/mailman/listinfo/asterisk-users" target="_blank">http://lists.digium.com/mailman/listinfo/asterisk-users</a><u></u><u></u></p></div><p class="MsoNormal"><u></u> <u></u></p></div></div></div>
</div></div><br>--<br>
_____________________________________________________________________<br>
-- Bandwidth and Colocation Provided by <a href="http://www.api-digital.com" target="_blank">http://www.api-digital.com</a> --<br>
New to Asterisk? Join us for a live introductory webinar every Thurs:<br>
<a href="http://www.asterisk.org/hello" target="_blank">http://www.asterisk.org/hello</a><br>
<br>
asterisk-users mailing list<br>
To UNSUBSCRIBE or update options visit:<br>
<a href="http://lists.digium.com/mailman/listinfo/asterisk-users" target="_blank">http://lists.digium.com/mailman/listinfo/asterisk-users</a><br></blockquote></div><br></div>