[Asterisk-Users] DISA and AGI: authenticate by caller ID?
awesome at surfbest.net
awesome at surfbest.net
Thu Jul 1 11:50:36 MST 2004
matthew,
I'm still in New orleans. If you get this email before 5pm, give me a
a call 504-833-4806.
Ron wynn
---- Original Message ----
From: matthew at txlink.net
To: asterisk-users at lists.digium.com
Subject: RE: [Asterisk-Users] DISA and AGI: authenticate by caller ID?
Date: Thu, 1 Jul 2004 12:08:56 -0500
>I'm having trouble getting an AGI exec command to spawn app_disa.
>The
>script executes properly, but does not spawn DISA. The CLI gives no
>helpful
>clues. Am I doing the exec incorrectly?
>
>I want to have a way to authenticate callers to the extension by
>Caller
>ID... if their caller ID is in my database and set to active, they
>can call
>out. [like a calling card but auth'd by CID instead of PIN].
>
>Here is my dialplan:
>
>1234, 1, agi(ldusers.agi)
>1234, 2, Hangup
>
>Here is my code:
>
>#!/usr/bin/perl
>#
>
>use Asterisk::AGI;
>use DBI;
>
>$db = "dbname";
>$host = "hostname";
>$port = "3306";
>$userid = "dbuser";
>$password = "dpasswd";
>$connectionInfo = "DBI:mysql:database=$db;$host:$port";
>$dbh = DBI->connect($connectionInfo,$userid,$password);
>
>
>$AGI = new Asterisk::AGI;
>
>my %input = $AGI->ReadParse();
>
>$AGI->answer();
>
>if (my $callerid = $input{'callerid'}) {
>
> $AGI->say_digits($callerid);
> $query = "SELECT active FROM cids WHERE cid=$callerid";
> #
>active should be 1 if the caller ID is found and set active
> $sth = $dbh->prepare($query);
> $sth->execute();
> $sth->bind_columns(undef, \$active);
> $sth->fetch();
>
> if($active)
> $AGI->exec('DISA','no-password|disa');
>
>}
>
>$AGI->hangup();
>
>exit;
>
>_______________________________________________
>Asterisk-Users mailing list
>Asterisk-Users at lists.digium.com
>http://lists.digium.com/mailman/listinfo/asterisk-users
>To UNSUBSCRIBE or update options visit:
> http://lists.digium.com/mailman/listinfo/asterisk-users
More information about the asterisk-users
mailing list