[Asterisk-Users] AGI and SET VARIABLE

Mark Street mstreet at gracie.santarosa.edu
Wed Jun 11 17:58:07 MST 2003


On Wednesday 11 June 2003 17:10, Steven Critchfield wrote:
> Why bother returning the value when you can just dial directly from AGI.


Because my feeble mind is being streched a bit by AGI.....  Throw me a bone 
man.....  I downloaded and installed the asterisk-perl modules and changed my 
script to use those.  The docs are not clear on how to dial using the AGI 
class to dial out.

I corrected some errors in my syntax in extensions.conf... Nice output from 
the agi script from command line but when * is called CLI shows no data in my 
var...  so close but yet so far....

Goto (talk2doc,s,1)
    -- Executing AGI("Zap/1-1", "pnumber.agi") in new stack
    -- Launched AGI Script /var/lib/asterisk/agi-bin/pnumber.agi
    -- AGI Script pnumber.agi completed, returning 0
    -- Executing Dial("Zap/1-1", "Zap/2/|15") in new stack
    -- Called 2/
    -- Zap/2-1 answered Zap/1-1
    -- Attempting native bridge of Zap/1-1 and Zap/2-1
    -- Hungup 'Zap/2-1'
------------------------------
in my pnumber.agi script I set;

use Asterisk::AGI;
my $AGI = new Asterisk::AGI;

if ( $cntr >= $#file ) {
        #print "SET VARIABLE PHONE_NUM $file[$cntr - 1]";
        $AGI->set_variable('PHONE_NUM', $file[$cntr - 1]);
        $cntr = 1;
}
else {
        $AGI->set_variable('PHONE_NUM', $file[$cntr - 1]);
        #print "SET VARIABLE PHONE_NUM $file[$cntr - 1]";
        $cntr++;
}


> from extensions.conf
> [talk2doc]
> ; Please Hold While I Transfer Your Call
> exten => s,1,AGI(pnumber.agi)
> exten => s,2,Dial(Zap/2/${PHONE_NUM}|15)
> --------------------------------

-- 
Mark Street, D.C.
Red Hat Certified Engineer
Cert# 807302251406074
--
Key fingerprint = 3949 39E4 6317 7C3C 023E  2B1F 6FB3 06E7 D109 56C0
GPG key http://www.streetchiro.com/pubkey.asc




More information about the asterisk-users mailing list