<div dir="ltr"><div class="gmail_extra"><p>I think there is no problem with asterisk. </p><p>exten=_XXXXXX,n,GotoIf($["${ODBC_FETCH}" = "FAILURE"]?cleanup,1) </p><p>exten=_XXXXXX,n,GotoIf($["${ROW_RESULT}" = "${CONF_PIN}"]?good_exten,1)</p>
<p>It should be,</p><p>exten=_XXXXXX,n,GotoIf($["${ODBC_FETCH}" = "FAILURE"]?getpin,cleanup,1)<br>exten=_XXXXXX,n,GotoIf($["${ROW_RESULT}" = "${CONF_PIN}"]?getpin,good_exten,1)<br></p>
<p>Hope it helps,</p><p>Regards,</p><p> </p><p>Bharat Lalcheta<br></p><div class="gmail_quote">On Thu, Apr 18, 2013 at 4:45 PM, Pat Collins <span dir="ltr"><<a href="mailto:drdialtone@optonline.net" target="_blank">drdialtone@optonline.net</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;padding-left:1ex;border-left-color:rgb(204,204,204);border-left-width:1px;border-left-style:solid"><div lang="EN-US" vlink="purple" link="blue"><div><p>All,<u></u><u></u></p>
<p>Thank you in advance for any help.<u></u><u></u></p><p>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.<u></u><u></u></p><p>So, I put the list of users, PINs bridges into a MYSQL DB and used an ODBC connector to parse the table.<u></u><u></u></p>
<p>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.<u></u><u></u></p><p>Please have a look and tell me where I went so wrong.<u></u><u></u></p>
<p>Func_odbc.conf looks like this:<u></u><u></u></p><p>[PIN]<u></u><u></u></p><p>dsn=BRIDGE<u></u><u></u></p><p>mode=multirow<u></u><u></u></p><p>readsql=SELECT pin from users WHERE confid='${SQL_ESC(${CONF_ID})}'<u></u><u></u></p>
<p><u></u> <u></u></p><p>extensions.conf section:<u></u><u></u></p><p>[infromhost] ;Host dials 8888 over SIP trunk exten=8888,1,Answer<u></u><u></u></p><p>exten=8888,n,Background(conf-getconfno)<u></u><u></u></p><p>exten=8888,n,WaitExten(10)<u></u><u></u></p>
<p>exten=8888,n,Hangup<u></u><u></u></p><p>exten=_XXXXXX,1,Set(GLOBAL(CONF_ID)=${EXTEN})<u></u><u></u></p><p>exten=_XXXXXX,n,GoTo(rooms,${EXTEN},1)<u></u><u></u></p><p>;<u></u><u></u></p><p>[rooms]<u></u><u></u></p><p>exten=_XXXXXX,1,Set(CONF_ID=${EXTEN})<u></u><u></u></p>
<p>exten=_XXXXXX,n,Background(conf-getpin)<u></u><u></u></p><p>exten=_XXXXXX,n,WaitExten(5)<u></u><u></u></p><p>exten=_XXXXXX,n,Hangup<u></u><u></u></p><p>exten=_1XXXXX,1,Goto(getpin,${EXTEN},1)<u></u><u></u></p><p>exten=_2XXXXX,1,Goto(getpin,${EXTEN},1)<u></u><u></u></p>
<p>exten=_3XXXXX,1,Goto(getpin,${EXTEN},1)<u></u><u></u></p><p>exten=_4XXXXX,1,Goto(getpin,${EXTEN},1)<u></u><u></u></p><p>exten=_5XXXXX,1,Goto(getpin,${EXTEN},1)<u></u><u></u></p><p>exten=_6XXXXX,1,Goto(getpin,${EXTEN},1)<u></u><u></u></p>
<p>exten=_7XXXXX,1,Goto(getpin,${EXTEN},1)<u></u><u></u></p><p>exten=_8XXXXX,1,Goto(getpin,${EXTEN},1)<u></u><u></u></p><p>exten=_9XXXXX,1,Goto(getpin,${EXTEN},1)<u></u><u></u></p><p>exten=i,1,Goto(getpin,${CONF_PIN},1)<u></u><u></u></p>
<p>;<u></u><u></u></p><p>[getpin]<u></u><u></u></p><p>exten=_XXXXXX,1,Set(GLOBAL(CONF_PIN)=${EXTEN})<u></u><u></u></p><p>exten=_XXXXXX,n,Set(ODBC_ID=${ODBC_PIN(1)})<u></u><u></u></p><p>exten=_XXXXXX,n(loop_start),NoOp()<u></u><u></u></p>
<p>exten=_XXXXXX,n,Set(ROW_RESULT=${ODBC_FETCH(${ODBC_ID})})<u></u><u></u></p><p>exten=_XXXXXX,n,GotoIf($["${ODBC_FETCH}" = "FAILURE"]?cleanup,1) <u></u><u></u></p><p>exten=_XXXXXX,n,GotoIf($["${ROW_RESULT}" = "${CONF_PIN}"]?good_exten,1)<u></u><u></u></p>
<p>exten=_XXXXXX,n,Goto(loop_start)<u></u><u></u></p><p>;<u></u><u></u></p><p>exten=cleanup,1,Verbose(1,Finish up)<u></u><u></u></p><p>same=n,Verbose(1,PIN not found)<u></u><u></u></p><p>same=n,ODBCFinish(${ODBC_ID})<u></u><u></u></p>
<p>same=n,playback(conf-invalidpin)<u></u><u></u></p><p>same=n,Goto(rooms,${CONF_ID}1)<u></u><u></u></p><p>same=n,Hangup()<u></u><u></u></p><p>;<u></u><u></u></p><p>exten=good_exten,1,Verbose(1,The PIN is available)<u></u><u></u></p>
<p>same=n,ODBCFinish(${ODBC_ID})<u></u><u></u></p><p>same=n,Verbose(1,Drop Caller into the bridge)<u></u><u></u></p><p>same=n,Set(CONFBRIDGE(user,template)=default_user)<u></u><u></u></p><p>same=n,ConfBridge(${CONF_ID},default_bridge,,sample_user_menu)<u></u><u></u></p>
<p>same=n,Hangup()<u></u><u></u></p><p>;<u></u><u></u></p><p><u></u> <u></u></p><p>The log shows the 3 existing DB table rows are found but continues to cycle indefinitely if the PIN is NOT found.<u></u><u></u></p><p>First few rows of the console log:<u></u><u></u></p>
<p>=========================================================================<u></u><u></u></p><p>Connected to Asterisk 11.3.0 currently running on atpconf001 (pid = 1695) atpconf001*CLI><u></u><u></u></p><p> == Using SIP RTP CoS mark 5<u></u><u></u></p>
<p><u></u> <u></u></p><p>atpconf001*CLI> <u></u><u></u></p><p> -- Executing [067740@default:1] Set("SIP/testbridge2-00000021", "GLOBAL(CONF_ID)=067740") in new stack<u></u><u></u></p><p> == Setting global variable 'CONF_ID' to '067740'<u></u><u></u></p>
<p> -- Executing [067740@default:2] Goto("SIP/testbridge2-00000021", "rooms,067740,1") in new stack<u></u><u></u></p><p><u></u> <u></u></p><p>atpconf001*CLI> <u></u><u></u></p><p> -- Goto (rooms,067740,1)<u></u><u></u></p>
<p> -- Executing [067740@rooms:1] Set("SIP/testbridge2-00000021", "CONF_ID=067740") in new stack<u></u><u></u></p><p> -- Executing [067740@rooms:2] BackGround("SIP/testbridge2-00000021", "conf-getpin") in new stack<u></u><u></u></p>
<p><u></u> <u></u></p><p>atpconf001*CLI> <u></u><u></u></p><p> -- <SIP/testbridge2-00000021> Playing 'conf-getpin.slin' (language 'en')<u></u><u></u></p><p><u></u> <u></u></p><p>atpconf001*CLI> <u></u><u></u></p>
<p> -- Executing [067740@rooms:3] WaitExten("SIP/testbridge2-00000021", "5") in new stack<u></u><u></u></p><p><u></u> <u></u></p><p>atpconf001*CLI><u></u><u></u></p><p> == CDR updated on SIP/testbridge2-00000021<u></u><u></u></p>
<p> -- Executing [444999@rooms:1] Goto("SIP/testbridge2-00000021", "getpin,444999,1") in new stack<u></u><u></u></p><p> -- Goto (getpin,444999,1)<u></u><u></u></p><p> -- Executing [444999@getpin:1] Set("SIP/testbridge2-00000021", "GLOBAL(CONF_PIN)=444999") in new stack<u></u><u></u></p>
<p> == Setting global variable 'CONF_PIN' to '444999'<u></u><u></u></p><p><u></u> <u></u></p><p>atpconf001*CLI> <u></u><u></u></p><p> -- Executing [444999@getpin:2] Set("SIP/testbridge2-00000021", "ODBC_ID=32") in new stack<u></u><u></u></p>
<p> -- Executing [444999@getpin:3] NoOp("SIP/testbridge2-00000021", "") in new stack<u></u><u></u></p><p> -- Executing [444999@getpin:4] Set("SIP/testbridge2-00000021", "ROW_RESULT=112233") in new stack<u></u><u></u></p>
<p><u></u> <u></u></p><p>atpconf001*CLI> <u></u><u></u></p><p> -- Executing [444999@getpin:5] GotoIf("SIP/testbridge2-00000021", "0?cleanup,1") in new stack<u></u><u></u></p><p> -- Executing [444999@getpin:6] GotoIf("SIP/testbridge2-00000021", "0?good_exten,1") in new stack<u></u><u></u></p>
<p> -- Executing [444999@getpin:7] Goto("SIP/testbridge2-00000021", "loop_start") in new stack<u></u><u></u></p><p> -- Goto (getpin,444999,3)<u></u><u></u></p><p> -- Executing [444999@getpin:3] NoOp("SIP/testbridge2-00000021", "") in new stack<u></u><u></u></p>
<p> -- Executing [444999@getpin:4] Set("SIP/testbridge2-00000021", "ROW_RESULT=333333") in new stack<u></u><u></u></p><p> -- Executing [444999@getpin:5] GotoIf("SIP/testbridge2-00000021", "0?cleanup,1") in new stack<u></u><u></u></p>
<p> -- Executing [444999@getpin:6] GotoIf("SIP/testbridge2-00000021", "0?good_exten,1") in new stack<u></u><u></u></p><p> -- Executing [444999@getpin:7] Goto("SIP/testbridge2-00000021", "loop_start") in new stack<u></u><u></u></p>
<p> -- Goto (getpin,444999,3)<u></u><u></u></p><p> -- Executing [444999@getpin:3] NoOp("SIP/testbridge2-00000021", "") in new stack<u></u><u></u></p><p> -- Executing [444999@getpin:4] Set("SIP/testbridge2-00000021", "ROW_RESULT=135792") in new stack //LAST GOOD RESULT!!!<u></u><u></u></p>
<p><u></u> <u></u></p><p>atpconf001*CLI> <u></u><u></u></p><p> -- Executing [444999@getpin:5] GotoIf("SIP/testbridge2-00000021", "0?cleanup,1") in new stack<u></u><u></u></p><p> -- Executing [444999@getpin:6] GotoIf("SIP/testbridge2-00000021", "0?good_exten,1") in new stack<u></u><u></u></p>
<p> -- Executing [444999@getpin:7] Goto("SIP/testbridge2-00000021", "loop_start") in new stack<u></u><u></u></p><p><u></u> <u></u></p><p>atpconf001*CLI> <u></u><u></u></p><p> -- Goto (getpin,444999,3)<u></u><u></u></p>
<p> -- Executing [444999@getpin:3] NoOp("SIP/testbridge2-00000021", "") in new stack<u></u><u></u></p><p><u></u> <u></u></p><p>atpconf001*CLI> <u></u><u></u></p><p> -- Executing [444999@getpin:4] Set("SIP/testbridge2-00000021", "ROW_RESULT=") in new stack //BAD RESULTS FOREVER!!!<u></u><u></u></p>
<p><u></u> <u></u></p><p>atpconf001*CLI> <u></u><u></u></p><p> -- Executing [444999@getpin:5] GotoIf("SIP/testbridge2-00000021", "0?cleanup,1") in new stack<u></u><u></u></p><p><u></u> <u></u></p>
<p>atpconf001*CLI> <u></u><u></u></p><p> -- Executing [444999@getpin:6] GotoIf("SIP/testbridge2-00000021", "0?good_exten,1") in new stack<u></u><u></u></p><p><u></u> <u></u></p><p>atpconf001*CLI> <u></u><u></u></p>
<p> -- Executing [444999@getpin:7] Goto("SIP/testbridge2-00000021", "loop_start") in new stack<u></u><u></u></p><p> -- Goto (getpin,444999,3)<u></u><u></u></p><p> -- Executing [444999@getpin:3] NoOp("SIP/testbridge2-00000021", "") in new stack //AND SO ON........<u></u><u></u></p>
<p><u></u> <u></u></p><p>Thank you!!<span><font color="#888888"><u></u><u></u></font></span></p><span><font color="#888888"><p>Pat Collins...<u></u><u></u></p><p><u></u> <u></u></p><p><u></u> <u></u></p><p><u></u> <u></u></p>
</font></span></div></div><br>--<br>
_____________________________________________________________________<br>
-- Bandwidth and Colocation Provided by <a href="http://www.api-digital.com" target="_blank">http://www.api-digital.com</a> --<br>
New to Asterisk? Join us for a live introductory webinar every Thurs:<br>
<a href="http://www.asterisk.org/hello" target="_blank">http://www.asterisk.org/hello</a><br>
<br>
asterisk-users mailing list<br>
To UNSUBSCRIBE or update options visit:<br>
<a href="http://lists.digium.com/mailman/listinfo/asterisk-users" target="_blank">http://lists.digium.com/mailman/listinfo/asterisk-users</a><br></blockquote></div><br><br clear="all"><br>-- <br>Bharat Lalcheta
</div></div>