gbove
11-14-09, 07:06 PM
I'm trying to use the mysql command to look up info inside freepbx's MYSQL DB, and it doesn't work.
Basically when someone dials *97, the script confirms that the extension they are calling from is registered in FreePBX, and if so, connects them directly to the VM box for 399 (no login/password)
It never connects to the DB. It errors out at the first error check to priority error.
1) I confirmed the username/password, DB, and table is correct by manually connecting from the shell.
2) I tried this script on a normal server I have running Asterisk/Freepbx, and it worked flawlessly (only had to change the password to the DB and the vm extension)
I'm using the newest (prebuilt) freepbx image (2.0.8.3)
Heres the script:
exten => *97,1,Answer
exten => *97,n,MYSQL(Connect connid localhost root amp109 asterisk)
exten => *97,n,GotoIf($["${connid**" = ""]?error,1)
exten => *97,n,MYSQL(Query resultid ${connid** SELECT extension from users where extension=${CALLERID(num)**)
exten => *97,n,MYSQL(Fetch fetchid ${resultid** user)
exten => *97,n,MYSQL(Clear ${resultid**)
exten => *97,n,MYSQL(Disconnect ${connid**)
exten => *97,n,GotoIf($["${user**" != "${CALLERID(num)**"]?no)
exten => *97,n,VoiceMailMain(s399)
exten => *97,n(no),Busy
exten => *97,n,Hangup
exten => error,1,NoOp(Connection error - do whatever we have to do to crash nicely!)
exten => error,n,Hangup
FYI - I don't know why, but the forum keeps changing the right squiggly bracket (is there a better name for that?) into ** even inside the code tags.
Basically when someone dials *97, the script confirms that the extension they are calling from is registered in FreePBX, and if so, connects them directly to the VM box for 399 (no login/password)
It never connects to the DB. It errors out at the first error check to priority error.
1) I confirmed the username/password, DB, and table is correct by manually connecting from the shell.
2) I tried this script on a normal server I have running Asterisk/Freepbx, and it worked flawlessly (only had to change the password to the DB and the vm extension)
I'm using the newest (prebuilt) freepbx image (2.0.8.3)
Heres the script:
exten => *97,1,Answer
exten => *97,n,MYSQL(Connect connid localhost root amp109 asterisk)
exten => *97,n,GotoIf($["${connid**" = ""]?error,1)
exten => *97,n,MYSQL(Query resultid ${connid** SELECT extension from users where extension=${CALLERID(num)**)
exten => *97,n,MYSQL(Fetch fetchid ${resultid** user)
exten => *97,n,MYSQL(Clear ${resultid**)
exten => *97,n,MYSQL(Disconnect ${connid**)
exten => *97,n,GotoIf($["${user**" != "${CALLERID(num)**"]?no)
exten => *97,n,VoiceMailMain(s399)
exten => *97,n(no),Busy
exten => *97,n,Hangup
exten => error,1,NoOp(Connection error - do whatever we have to do to crash nicely!)
exten => error,n,Hangup
FYI - I don't know why, but the forum keeps changing the right squiggly bracket (is there a better name for that?) into ** even inside the code tags.