[asterisk-users] ODBC dialplan looping problem

Pat Collins drdialtone at optonline.net
Thu Apr 18 06:15:57 CDT 2013


All,

Thank you in advance for any help.

I have a customer in need of a conferencing system.  A requirement is for
users to each have their own PIN for the same bridge.

So, I put the list of users, PINs bridges into a MYSQL DB and used an ODBC
connector to parse the table.

Asterisk is connected and reads the rows as expected.  The problem is that
if a user enters a PIN that is NOT in the table, asterisk goes crazy and
continues to loop forever.

Please have a look and tell me where I went so wrong.

Func_odbc.conf looks like this:

[PIN]

dsn=BRIDGE

mode=multirow

readsql=SELECT pin from users WHERE confid='${SQL_ESC(${CONF_ID})}'

 

extensions.conf section:

[infromhost] ;Host dials 8888 over SIP trunk exten=8888,1,Answer

exten=8888,n,Background(conf-getconfno)

exten=8888,n,WaitExten(10)

exten=8888,n,Hangup

exten=_XXXXXX,1,Set(GLOBAL(CONF_ID)=${EXTEN})

exten=_XXXXXX,n,GoTo(rooms,${EXTEN},1)

;

[rooms]

exten=_XXXXXX,1,Set(CONF_ID=${EXTEN})

exten=_XXXXXX,n,Background(conf-getpin)

exten=_XXXXXX,n,WaitExten(5)

exten=_XXXXXX,n,Hangup

exten=_1XXXXX,1,Goto(getpin,${EXTEN},1)

exten=_2XXXXX,1,Goto(getpin,${EXTEN},1)

exten=_3XXXXX,1,Goto(getpin,${EXTEN},1)

exten=_4XXXXX,1,Goto(getpin,${EXTEN},1)

exten=_5XXXXX,1,Goto(getpin,${EXTEN},1)

exten=_6XXXXX,1,Goto(getpin,${EXTEN},1)

exten=_7XXXXX,1,Goto(getpin,${EXTEN},1)

exten=_8XXXXX,1,Goto(getpin,${EXTEN},1)

exten=_9XXXXX,1,Goto(getpin,${EXTEN},1)

exten=i,1,Goto(getpin,${CONF_PIN},1)

;

[getpin]

exten=_XXXXXX,1,Set(GLOBAL(CONF_PIN)=${EXTEN})

exten=_XXXXXX,n,Set(ODBC_ID=${ODBC_PIN(1)})

exten=_XXXXXX,n(loop_start),NoOp()

exten=_XXXXXX,n,Set(ROW_RESULT=${ODBC_FETCH(${ODBC_ID})})

exten=_XXXXXX,n,GotoIf($["${ODBC_FETCH}" = "FAILURE"]?cleanup,1) 

exten=_XXXXXX,n,GotoIf($["${ROW_RESULT}" = "${CONF_PIN}"]?good_exten,1)

exten=_XXXXXX,n,Goto(loop_start)

;

exten=cleanup,1,Verbose(1,Finish up)

same=n,Verbose(1,PIN not found)

same=n,ODBCFinish(${ODBC_ID})

same=n,playback(conf-invalidpin)

same=n,Goto(rooms,${CONF_ID}1)

same=n,Hangup()

;

exten=good_exten,1,Verbose(1,The PIN is available)

same=n,ODBCFinish(${ODBC_ID})

same=n,Verbose(1,Drop Caller into the bridge)

same=n,Set(CONFBRIDGE(user,template)=default_user)

same=n,ConfBridge(${CONF_ID},default_bridge,,sample_user_menu)

same=n,Hangup()

;

 

The log shows the 3 existing DB table rows are found but continues to cycle
indefinitely if the PIN is NOT found.

First few rows of the console log:

=========================================================================

Connected to Asterisk 11.3.0 currently running on atpconf001 (pid = 1695)
atpconf001*CLI>

  == Using SIP RTP CoS mark 5

 

atpconf001*CLI> 

    -- Executing [067740 at default:1] Set("SIP/testbridge2-00000021",
"GLOBAL(CONF_ID)=067740") in new stack

  == Setting global variable 'CONF_ID' to '067740'

    -- Executing [067740 at default:2] Goto("SIP/testbridge2-00000021",
"rooms,067740,1") in new stack

 

atpconf001*CLI> 

    -- Goto (rooms,067740,1)

    -- Executing [067740 at rooms:1] Set("SIP/testbridge2-00000021",
"CONF_ID=067740") in new stack

    -- Executing [067740 at rooms:2] BackGround("SIP/testbridge2-00000021",
"conf-getpin") in new stack

 

atpconf001*CLI> 

    -- <SIP/testbridge2-00000021> Playing 'conf-getpin.slin' (language 'en')

 

atpconf001*CLI> 

    -- Executing [067740 at rooms:3] WaitExten("SIP/testbridge2-00000021", "5")
in new stack

 

atpconf001*CLI>

  == CDR updated on SIP/testbridge2-00000021

    -- Executing [444999 at rooms:1] Goto("SIP/testbridge2-00000021",
"getpin,444999,1") in new stack

    -- Goto (getpin,444999,1)

    -- Executing [444999 at getpin:1] Set("SIP/testbridge2-00000021",
"GLOBAL(CONF_PIN)=444999") in new stack

  == Setting global variable 'CONF_PIN' to '444999'

 

atpconf001*CLI> 

    -- Executing [444999 at getpin:2] Set("SIP/testbridge2-00000021",
"ODBC_ID=32") in new stack

    -- Executing [444999 at getpin:3] NoOp("SIP/testbridge2-00000021", "") in
new stack

    -- Executing [444999 at getpin:4] Set("SIP/testbridge2-00000021",
"ROW_RESULT=112233") in new stack

 

atpconf001*CLI> 

    -- Executing [444999 at getpin:5] GotoIf("SIP/testbridge2-00000021",
"0?cleanup,1") in new stack

    -- Executing [444999 at getpin:6] GotoIf("SIP/testbridge2-00000021",
"0?good_exten,1") in new stack

    -- Executing [444999 at getpin:7] Goto("SIP/testbridge2-00000021",
"loop_start") in new stack

    -- Goto (getpin,444999,3)

    -- Executing [444999 at getpin:3] NoOp("SIP/testbridge2-00000021", "") in
new stack

    -- Executing [444999 at getpin:4] Set("SIP/testbridge2-00000021",
"ROW_RESULT=333333") in new stack

    -- Executing [444999 at getpin:5] GotoIf("SIP/testbridge2-00000021",
"0?cleanup,1") in new stack

    -- Executing [444999 at getpin:6] GotoIf("SIP/testbridge2-00000021",
"0?good_exten,1") in new stack

    -- Executing [444999 at getpin:7] Goto("SIP/testbridge2-00000021",
"loop_start") in new stack

    -- Goto (getpin,444999,3)

    -- Executing [444999 at getpin:3] NoOp("SIP/testbridge2-00000021", "") in
new stack

    -- Executing [444999 at getpin:4] Set("SIP/testbridge2-00000021",
"ROW_RESULT=135792") in new stack  //LAST GOOD RESULT!!!

 

atpconf001*CLI> 

    -- Executing [444999 at getpin:5] GotoIf("SIP/testbridge2-00000021",
"0?cleanup,1") in new stack

    -- Executing [444999 at getpin:6] GotoIf("SIP/testbridge2-00000021",
"0?good_exten,1") in new stack

    -- Executing [444999 at getpin:7] Goto("SIP/testbridge2-00000021",
"loop_start") in new stack

 

atpconf001*CLI> 

    -- Goto (getpin,444999,3)

    -- Executing [444999 at getpin:3] NoOp("SIP/testbridge2-00000021", "") in
new stack

 

atpconf001*CLI> 

    -- Executing [444999 at getpin:4] Set("SIP/testbridge2-00000021",
"ROW_RESULT=") in new stack   //BAD RESULTS FOREVER!!!

 

atpconf001*CLI> 

    -- Executing [444999 at getpin:5] GotoIf("SIP/testbridge2-00000021",
"0?cleanup,1") in new stack

 

atpconf001*CLI> 

    -- Executing [444999 at getpin:6] GotoIf("SIP/testbridge2-00000021",
"0?good_exten,1") in new stack

 

atpconf001*CLI> 

    -- Executing [444999 at getpin:7] Goto("SIP/testbridge2-00000021",
"loop_start") in new stack

    -- Goto (getpin,444999,3)

    -- Executing [444999 at getpin:3] NoOp("SIP/testbridge2-00000021", "") in
new stack      //AND SO ON........

 

Thank you!!

Pat Collins...

 

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20130418/c310e030/attachment.htm>


More information about the asterisk-users mailing list