[Asterisk-Users] Can asterisk get code for cmd AuthenticatefromDatabase

Bartosz Wegrzyn - asterisk junk at lexon.ws
Thu Apr 7 13:54:47 MST 2005


Right, I found something.

I did follow the instructions on
http://www.voip-info.org/wiki-Asterisk+AGI+php with using mysql,php and
asterisk.

My problem is that the $agicallerid and $agiextension are not passed to
the script. My test extension look like this:
exten => 3000,1,DigitTimeout(10);
exten => 3000,2,ResponseTimeout(10);
exten => 3000,3,agi,agi.agi;
exten => 3000,4,Authenticate(1234|a);
exten => 3000,5,saydigits(${CALLERIDNUM})
exten => 3000,6,setcdruserfield(home)
exten => 3000,7,setvar(counter=1)
exten => 3000,8,Playback,pls-entr-num-uwish2-call
exten => 3000,9,background(10)
exten => 3000,10,GotoIf($[${counter} = 3]?13)
exten => 3000,11,setvar(counter=$[1 + ${counter}]);
exten => 3000,12,goto(planusers,${CALLERIDNUM},8)
exten => 3000,13,Playback(goodbye)
exten => 3000,14,Hangup

asterisk output

    -- Executing DigitTimeout("SIP/guest-687a", "10") in new stack
    -- Set Digit Timeout to 10
    -- Executing ResponseTimeout("SIP/guest-687a", "10") in new stack
    -- Set Response Timeout to 10
    -- Executing AGI("SIP/guest-687a", "agi.agi") in new stack
    -- Launched AGI Script /var/lib/asterisk/agi-bin/agi.agi
  agi.agi: Call from  - Calling phone
    -- AGI Script Executing Application: (SETACCOUNT) Options: (1234)
    -- AGI Script Executing Application: (GoTO) Options: (|5)
    -- Goto (planusers,,5)
    -- AGI Script agi.agi completed, returning 0

Part of php script:
If ($row_count !=0 ) {  // caller is authenticated based on ANI
$pin = $row1[password];
write ("SET CONTEXT planusers");
write ("EXEC SETACCOUNT $pin");
write ("EXEC GoTO $cli|5"); // ask for the number to call, no authentication
}

It looks like that the variables are not passed from the asterisk.
WHY???


Bart,



> You could use the Read App
> (Read(variable[|filename][|maxdigits][|option])) in a dialplan to request
> the user enter their code.
> Then use AGI to launch an executeable script which is passed the variable
> from the Read command, using this scripts native code to connect into the
> DB
> and check if the password is correct, if not you can use AGI to have a
> message played back to the user then hangup on them.
>
> my 2 cents worth.....
>
> Steve
>
>
> -----Original Message-----
> From: asterisk-users-bounces at lists.digium.com
> [mailto:asterisk-users-bounces at lists.digium.com]On Behalf Of Bartosz
> Wegrzyn - asterisk
> Sent: Thursday, April 07, 2005 11:41 AM
> To: asterisk-users at lists.digium.com
> Subject: [Asterisk-Users] Can asterisk get code for cmd Authenticate
> fromDatabase
>
>
> Hello,
>
> I would like to store the account code for the user in mysql database.
> Is the any way to retrieve that value and set for Authenticate cmd.
> Is there any interface for asterisk to access database data?
>
> Thanks
>
> Bart,
>
> _______________________________________________
> 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
>
> _______________________________________________
> 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