Hi guys .. <br><br>I am a total noob on all this FS and asterisk thing .. <br>I have a system already running on Asterisk and i want to migrate it to FS<br>I have an AGI made in perl that runs everytime and i need to be at least pointed out on how i can approach on transferring this to FS<br>
<br>Here is the AGI .. its simple ...<br><br><br>#!/usr/bin/perl<br>use Asterisk::AGI;<br>use DBI;<br>use strict;<br><br>my $AGI = new Asterisk::AGI;<br>my %input = $AGI-&gt;ReadParse();<br>$input{&#39;callerid&#39;} =~ /(^.+&lt;(\d+)&gt;$)|((^\d+$))/;<br>
$input{&#39;calleridani&#39;} = $2 || $3;<br>#my $userid = $input{&#39;calleridani&#39;};<br>my $userid=$input{&#39;extension&#39;};<br>#my $userid=&#39;1001&#39;;<br># Config options<br>my %MYSQL = (<br>    hostname    =&gt;    &quot;localhost&quot;,<br>
    username    =&gt;    &quot;callmeuser&quot;,<br>    password    =&gt;    &quot;mycallmepass&quot;,<br>    database    =&gt;    &quot;executives&quot;<br>);<br><br>my $dbh = DBI-&gt;connect(&quot;dbi:mysql:$MYSQL{database}:$MYSQL{hostname}&quot;,&quot;$MYSQL{username}&quot;,&quot;$MYSQL{password}&quot;)|| die(&quot;Couldn&#39;t connect to database!\n&quot;); <br>
#============<br>$AGI-&gt;verbose(&quot;Connected to database.&quot;);<br>$AGI-&gt;verbose(&quot;Call for : $userid&quot;);<br>#======<br><br><br> print STDERR &quot;$userid&quot;;<br> print STDERR &quot;hello testing db connected&quot;;<br>
my $debug=2;<br>my $phone=&quot;&quot;;<br>#debug(&quot;Connect to database&quot;);<br>#debug(&quot;Transferred call, using original cid: $name&quot;,5);<br>my $str =&quot;select phone from timetable where exten=&#39;$userid&#39; and online=&#39;Y&#39; &quot;;<br>
$AGI-&gt;verbose(&quot;Checking if $userid is online right now and get his phone number from db.&quot;);<br>$AGI-&gt;verbose(&quot;$str&quot;);<br>print STDERR &quot;$str&quot;;<br>my $sth =$dbh-&gt;prepare($str);<br>$sth-&gt;execute || die(&quot;Couldn&#39;t exec sth2!&quot;);<br>
#my $pin = $sth-&gt;fetchrow_hashref;<br>#print STDERR &quot;xxxx&quot;;<br>#print STDERR &quot;$pin&quot;;<br><br>while (my @row = $sth-&gt;fetchrow_array)<br>{<br>$phone = $row[0];<br>print STDERR &quot;xxxx&quot;;<br>print STDERR &quot;$phone&quot;;<br>
print STDERR &quot;vvvvx&quot;;<br>$AGI-&gt;verbose(&quot;$userid is online and his phone number is $phone&quot;);<br>#$AGI-&gt;exec(&#39;DIAL&#39;, &quot;SIP/$phone&quot;);<br> }<br>if  ($phone!=&quot;&quot;)<br><br>{<br>
$AGI-&gt;verbose(&quot;Calling  $userid at $phone&quot;);<br>my $dialstr=&quot;SIP/$phone&quot;.&quot;@&quot;.&quot;209.9.9.34&quot;;<br>$AGI-&gt;set_callerid(7347777777);<br><br>$AGI-&gt;exec(&#39;DIAL&#39;, $dialstr);<br>
my $st=$AGI-&gt;get_full_variable(&#39;status&#39;,$dialstr);<br>$AGI-&gt;verbose(&quot;channel status is : $st&quot;);<br>}<br><br>else<br><br>{<br>$AGI-&gt;verbose(&quot;$userid is not online.&quot;);<br>#$AGI-&gt;stream_file(&#39;custom/myrecording&#39;);<br>
$AGI-&gt;stream_file(&#39;followme/sorry&#39;);<br>$AGI-&gt;stream_file(&#39;en/vm-nobodyavail&#39;);<br>}<br><br>$AGI-&gt;hangup();<br><br><br>Thanks everyone for all the help.<br>Ed<br>