Gilles Ganault
2007-May-28 19:38 UTC
[asterisk-users] [1.2.18] Wrong steps in extensions.conf?
Hello, Sometimes, when a call comes in from the PSTN through our VoIP gateway, the information that is sent to our web page that logs calls includes the original CID name instead of the one that is we expect to be rewritten on the fly using Asterisk's LookupCIDName: ================;extensions.conf [internal] exten => group,1,LookupCIDName exten => group,n,AGI(web.agi|${CALLERID(num)}|${CALLERID(name)}) exten => group,n,Dial(${EXT204}) ========;/var/lib/asterisk/agi-bin/web.agi #!/usr/bin/perl #use LWP::Simple; use URI::Escape; use LWP 5.64; open STDOUT, '>/dev/null'; #Causes double entry? fork and exit; my $cidnum = $ARGV[0]; my $cidname = $ARGV[1]; $safe_cidname = uri_escape($cidname); my $browser = LWP::UserAgent->new; my $url = "http://www.acme.com/input.php?"; $url .= "name=" . $safe_cidname . "&"; $url .= "number=" . $cidnum . "&"; ($min, $hrs, $day, $month, $year) = (localtime) [1,2,3,4,5]; $currentdate = sprintf("%02d/%02d/%02d", $day, $month+1, $year % 100); $currenttime = sprintf("%02d:%02d", $hrs,$min); $url .= "date=" . $currentdate . "&"; $url .= "time=" . $currenttime; #print $url . "\n"; my $response = $browser->get( $url ); die "Can't get $url -- ", $response->status_line unless $response->is_success; print $response->content; ================ Could it be that, sometimes, Asterisk doesn't wait for the previous step to be completed before moving on to the next? Thank you.
Luis Morales
2007-May-29 04:42 UTC
[asterisk-users] [1.2.18] Wrong steps in extensions.conf?
Hi Gilles, I think that you must be take the incomming call control using AGI perl scripting. Take a look on this script: ;extensions.conf [internal] exten => group,1,LookupCIDName exten => group,n,AGI(web.agi|${CALLERID(num)}|${CALLERID(name)}| ${EXT204}) ===================== web.agi====================#!/usr/bin/perl use LWP::Simple; use URI::Escape; use LWP 5.64; use Asterisk::AGI; my $AGI = new Asterisk::AGI; open STDOUT, '>/dev/null'; #Causes double entry? fork and exit; my $cidnum = $ARGV[0]; my $cidname = $ARGV[1]; my $ext = $ARGV[2] $safe_cidname = uri_escape($cidname); my $browser = LWP::UserAgent->new; my $url = "http://www.acme.com/input.php?"; $url .= "name=" . $safe_cidname . "&"; $url .= "number=" . $cidnum . "&"; ($min, $hrs, $day, $month, $year) = (localtime) [1,2,3,4,5]; $currentdate = sprintf("%02d/%02d/%02d", $day, $month+1, $year % 100); $currenttime = sprintf("%02d:%02d", $hrs,$min); $url .= "date=" . $currentdate . "&"; $url .= "time=" . $currenttime; #print $url . "\n"; my $response = $browser->get( $url ); die "Can't get $url -- ", $response->status_line unless $response->is_success; print $response->content; # send the result over callerid ;-) $AGI->exec('SetCallerId', $response->content); $AGI->exec('Dial', "$ext"); $AGI->hangup(); # ================================================= exten => group,n,Dial(${EXT204}) On Tue, 2007-05-29 at 04:38 +0200, Gilles Ganault wrote:> Hello, > > Sometimes, when a call comes in from the PSTN through our VoIP > gateway, > the information that is sent to our web page that logs calls includes > the > original CID name instead of the one that is we expect to be rewritten > on > the fly using Asterisk's LookupCIDName: > > ================> ;extensions.conf > [internal] > exten => group,1,LookupCIDName > exten => group,n,AGI(web.agi|${CALLERID(num)}|${CALLERID(name)}) > exten => group,n,Dial(${EXT204}) > ========> ;/var/lib/asterisk/agi-bin/web.agi > #!/usr/bin/perl > > #use LWP::Simple; > use URI::Escape; > use LWP 5.64; > > open STDOUT, '>/dev/null'; > #Causes double entry? > fork and exit; > > my $cidnum = $ARGV[0]; > my $cidname = $ARGV[1]; > > $safe_cidname = uri_escape($cidname); > > my $browser = LWP::UserAgent->new; > > my $url = "http://www.acme.com/input.php?"; > $url .= "name=" . $safe_cidname . "&"; > $url .= "number=" . $cidnum . "&"; > > ($min, $hrs, $day, $month, $year) = (localtime) [1,2,3,4,5]; > $currentdate = sprintf("%02d/%02d/%02d", $day, $month+1, $year % 100); > $currenttime = sprintf("%02d:%02d", $hrs,$min); > $url .= "date=" . $currentdate . "&"; > $url .= "time=" . $currenttime; > #print $url . "\n"; > > my $response = $browser->get( $url ); > die "Can't get $url -- ", $response->status_line unless > $response->is_success; > print $response->content; > ================> > Could it be that, sometimes, Asterisk doesn't wait for the previous > step to > be completed before moving on to the next? > > Thank you. > > _______________________________________________ > --Bandwidth and Colocation provided by Easynews.com -- > > asterisk-users mailing list > To UNSUBSCRIBE or update options visit: > http://lists.digium.com/mailman/listinfo/asterisk-users-- .-.-.-.-.-.-.-.-.-.-.-.-.--.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-. Sigma Dental Plan Jefe de Soporte y Sistemas Telf. Oficina : +58(212)2646811 Cel. : +58(416)4242091 Caracas, Venezuela .-.-.-.-.-.-.-.-.-.-.-.-.--.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.