[Asterisk-Users] AGI - CallerID ??
PBX
pbx at tuxnetworking.com
Wed Nov 26 17:22:03 MST 2003
I have a client who needs an application for there field techs to call
in when they arrive on site and when they leave. The logic behind it
seems pretty simple. I am going to write something in AGI to capture
some DTMF tones and update this data into MySQL to run some reports
from.
But here's my initial problem. I have started to create a simple AGI
script to capture the CallerID, but I keep on receiving unknown's for
the callerid.
I can get the callerid if I call from an internal extension. But if I
call from an outside line it comes up unknown. And if I were to call a
internal extension the callerid comes up on the phone.
Any pointers....
<script>
use Asterisk::AGI;
$AGI = new Asterisk::AGI;
my %input = $AGI->ReadParse();
print STDERR "AGI Environment Dump:\n";
foreach $i (sort keys %input) {
print STDERR " -- $i = $input{$i}\n";
}
if (my $callerid = $input{'callerid'}) {
$AGI->say_digits($callerid);
}
exit;
</script>
<results>
== CDR updated on Zap/1-1
-- Executing Answer("Zap/1-1", "") in new stack
-- Executing AGI("Zap/1-1", "agi-test2.agi") in new stack
-- Launched AGI Script /var/lib/asterisk/agi-bin/agi-test2.agi
AGI Environment Dump:
-- accountcode =
-- callerid = unknown
-- channel = Zap/1-1
-- context = default
-- dnid = unknown
-- enhanced = 0.0
-- extension = 5100
-- language = en
-- priority = 2
-- rdnis = unknown
-- request = agi-test2.agi
-- type = Zap
-- uniqueid = 1069890052.6
-- AGI Script agi-test2.agi completed, returning 0
-- Executing Hangup("Zap/1-1", "") in new stack
== Spawn extension (default, 5100, 3) exited non-zero on 'Zap/1-1'
-- Hungup 'Zap/1-1'
</results>
Thanks,
-gcc
More information about the asterisk-users
mailing list