The end result is:
I’m wanting a webpage popup for the number dialed (of incoming calls). This is for a Call Center so agents have instructions on how to answer the phone.
Specifically, I’m looking at how the popups work with Sugar/vTiger, and wanting to modify it so the CallerID being relayed is actually the DNIS.
Can you explain how or know of any example on how to pull that out of the channel into an AGI script?
(I’ve gone through agi-bin and searched for FROM_DID and AGI in the forums, but all I get are a bunch of CLI outputs)
As far as I know in FreePBX, accountcode is tied to extensions… is it possible to set that input on the inbound route, or would we be undermining its use? (We also use Guru’s Queuestats for reporting)
Right now, this is what I’m sitting on (in vTiger, ident.agi):
#!/usr/bin/perl -w
use LWP::Simple;
use Asterisk::AGI;
$AGI = new Asterisk::AGI;
my %input = $AGI->ReadParse(); #Read in the initial data
my $id = $input{"callerid"};
my $ex = $input{"extension"};
$id =~ s/([^A-Za-z0-9])/sprintf("%%%02X", ord($1))/seg;
$ex =~ s/([^A-Za-z0-9])/sprintf("%%%02X", ord($1))/seg;
my $url = 'http://localhost/crm/asterisk/call_ident.php?callerid=' . $id . '&extension=' . $ex;
use LWP::Simple;
my $content = get $url;
look in dialparties.agi, there’s a function in there that pulls out channel variables and several examples of various channel variables that are being accessed.
That was very helpful… thanx so much for your help.
I’ll say that the agi for vTiger is written in perl, while dialparties.agi is written in php (better imho)… so that took me a second to digest, but it set me on the right track! I’ve still got a whole lot of adding/modifying to the plugin to do (lots of work), but I’ve tested it succesful… now pulls up contacts based on dnis (nod cid), w00t!
For those interested, this is what got it going:
$AGI->get_variable(FROM_DID);
And this is what you’ll see in CLI (so you know it’s working):