<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 12 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Balloon Text Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";}
span.hoenzb
        {mso-style-name:hoenzb;}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
span.BalloonTextChar
        {mso-style-name:"Balloon Text Char";
        mso-style-priority:99;
        mso-style-link:"Balloon Text";
        font-family:"Tahoma","sans-serif";}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Perfect!!!!<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>THANK YOU!!!!!!!!!!<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> asterisk-users-bounces@lists.digium.com [mailto:asterisk-users-bounces@lists.digium.com] <b>On Behalf Of </b>Bharat Lalcheta<br><b>Sent:</b> Thursday, April 18, 2013 8:27 AM<br><b>To:</b> Asterisk Users Mailing List - Non-Commercial Discussion<br><b>Subject:</b> Re: [asterisk-users] ODBC dialplan looping problem<o:p></o:p></span></p></div><p class=MsoNormal><o:p> </o:p></p><div><div><p class=MsoNormal>Sorry for that.<o:p></o:p></p></div><div><p class=MsoNormal> <o:p></o:p></p></div><div><p class=MsoNormal>I believe that, dialplan misbehave only when you didn't get the result right?...then instead of below<o:p></o:p></p></div><div><p class=MsoNormal> <o:p></o:p></p></div><div><p class=MsoNormal>exten=_XXXXXX,n,GotoIf($["${ODBC_FETCH}" = "FAILURE"]?cleanup,1) <o:p></o:p></p></div><div><p class=MsoNormal> <o:p></o:p></p></div><div><p class=MsoNormal>try this...<o:p></o:p></p></div><div><p class=MsoNormal> <o:p></o:p></p></div><div><p class=MsoNormal>exten=_XXXXXX,n,GotoIf($["${ODBC_FETCH_STATUS}" = "FAILURE"]?cleanup,1) <o:p></o:p></p></div><div><p class=MsoNormal> <o:p></o:p></p></div><div><p class=MsoNormal>Hope it helps you out.<o:p></o:p></p></div><div><p class=MsoNormal> <o:p></o:p></p></div><div><p class=MsoNormal>Regards,<o:p></o:p></p></div><div><p class=MsoNormal> <o:p></o:p></p></div><div><p class=MsoNormal>Bharat Lalcheta<o:p></o:p></p></div></div><div><p class=MsoNormal style='margin-bottom:12.0pt'><o:p> </o:p></p><div><p class=MsoNormal>On Thu, Apr 18, 2013 at 5:36 PM, Pat Collins <<a href="mailto:drdialtone@optonline.net" target="_blank">drdialtone@optonline.net</a>> wrote:<o:p></o:p></p><div><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Thank you Bharat.</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Sadly, that made no difference.</span><o:p></o:p></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'> </span><o:p></o:p></p><div style='border:none;border-top:solid windowtext 1.0pt;padding:3.0pt 0in 0in 0in;border-color:currentColor currentColor'><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> <a href="mailto:asterisk-users-bounces@lists.digium.com" target="_blank">asterisk-users-bounces@lists.digium.com</a> [mailto:<a href="mailto:asterisk-users-bounces@lists.digium.com" target="_blank">asterisk-users-bounces@lists.digium.com</a>] <b>On Behalf Of </b>Bharat Lalcheta<br><b>Sent:</b> Thursday, April 18, 2013 7:33 AM<br><b>To:</b> Asterisk Users Mailing List - Non-Commercial Discussion<br><b>Subject:</b> Re: [asterisk-users] ODBC dialplan looping problem</span><o:p></o:p></p></div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'> <o:p></o:p></p><div><div><p>I think there is no problem with asterisk. <o:p></o:p></p><p>exten=_XXXXXX,n,GotoIf($["${ODBC_FETCH}" = "FAILURE"]?cleanup,1) <o:p></o:p></p><p>exten=_XXXXXX,n,GotoIf($["${ROW_RESULT}" = "${CONF_PIN}"]?good_exten,1)<o:p></o:p></p><p>It should be,<o:p></o:p></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)<o:p></o:p></p><p>Hope it helps,<o:p></o:p></p><p>Regards,<o:p></o:p></p><p> <o:p></o:p></p><p>Bharat Lalcheta<o:p></o:p></p><div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'>On Thu, Apr 18, 2013 at 4:45 PM, Pat Collins <<a href="mailto:drdialtone@optonline.net" target="_blank">drdialtone@optonline.net</a>> wrote:<o:p></o:p></p><div><div><p>All,<o:p></o:p></p><p>Thank you in advance for any help.<o:p></o:p></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.<o:p></o:p></p><p>So, I put the list of users, PINs bridges into a MYSQL DB and used an ODBC connector to parse the table.<o:p></o:p></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.<o:p></o:p></p><p>Please have a look and tell me where I went so wrong.<o:p></o:p></p><p>Func_odbc.conf looks like this:<o:p></o:p></p><p>[PIN]<o:p></o:p></p><p>dsn=BRIDGE<o:p></o:p></p><p>mode=multirow<o:p></o:p></p><p>readsql=SELECT pin from users WHERE confid='${SQL_ESC(${CONF_ID})}'<o:p></o:p></p><p> <o:p></o:p></p><p>extensions.conf section:<o:p></o:p></p><p>[infromhost] ;Host dials 8888 over SIP trunk exten=8888,1,Answer<o:p></o:p></p><p>exten=8888,n,Background(conf-getconfno)<o:p></o:p></p><p>exten=8888,n,WaitExten(10)<o:p></o:p></p><p>exten=8888,n,Hangup<o:p></o:p></p><p>exten=_XXXXXX,1,Set(GLOBAL(CONF_ID)=${EXTEN})<o:p></o:p></p><p>exten=_XXXXXX,n,GoTo(rooms,${EXTEN},1)<o:p></o:p></p><p>;<o:p></o:p></p><p>[rooms]<o:p></o:p></p><p>exten=_XXXXXX,1,Set(CONF_ID=${EXTEN})<o:p></o:p></p><p>exten=_XXXXXX,n,Background(conf-getpin)<o:p></o:p></p><p>exten=_XXXXXX,n,WaitExten(5)<o:p></o:p></p><p>exten=_XXXXXX,n,Hangup<o:p></o:p></p><p>exten=_1XXXXX,1,Goto(getpin,${EXTEN},1)<o:p></o:p></p><p>exten=_2XXXXX,1,Goto(getpin,${EXTEN},1)<o:p></o:p></p><p>exten=_3XXXXX,1,Goto(getpin,${EXTEN},1)<o:p></o:p></p><p>exten=_4XXXXX,1,Goto(getpin,${EXTEN},1)<o:p></o:p></p><p>exten=_5XXXXX,1,Goto(getpin,${EXTEN},1)<o:p></o:p></p><p>exten=_6XXXXX,1,Goto(getpin,${EXTEN},1)<o:p></o:p></p><p>exten=_7XXXXX,1,Goto(getpin,${EXTEN},1)<o:p></o:p></p><p>exten=_8XXXXX,1,Goto(getpin,${EXTEN},1)<o:p></o:p></p><p>exten=_9XXXXX,1,Goto(getpin,${EXTEN},1)<o:p></o:p></p><p>exten=i,1,Goto(getpin,${CONF_PIN},1)<o:p></o:p></p><p>;<o:p></o:p></p><p>[getpin]<o:p></o:p></p><p>exten=_XXXXXX,1,Set(GLOBAL(CONF_PIN)=${EXTEN})<o:p></o:p></p><p>exten=_XXXXXX,n,Set(ODBC_ID=${ODBC_PIN(1)})<o:p></o:p></p><p>exten=_XXXXXX,n(loop_start),NoOp()<o:p></o:p></p><p>exten=_XXXXXX,n,Set(ROW_RESULT=${ODBC_FETCH(${ODBC_ID})})<o:p></o:p></p><p>exten=_XXXXXX,n,GotoIf($["${ODBC_FETCH}" = "FAILURE"]?cleanup,1) <o:p></o:p></p><p>exten=_XXXXXX,n,GotoIf($["${ROW_RESULT}" = "${CONF_PIN}"]?good_exten,1)<o:p></o:p></p><p>exten=_XXXXXX,n,Goto(loop_start)<o:p></o:p></p><p>;<o:p></o:p></p><p>exten=cleanup,1,Verbose(1,Finish up)<o:p></o:p></p><p>same=n,Verbose(1,PIN not found)<o:p></o:p></p><p>same=n,ODBCFinish(${ODBC_ID})<o:p></o:p></p><p>same=n,playback(conf-invalidpin)<o:p></o:p></p><p>same=n,Goto(rooms,${CONF_ID}1)<o:p></o:p></p><p>same=n,Hangup()<o:p></o:p></p><p>;<o:p></o:p></p><p>exten=good_exten,1,Verbose(1,The PIN is available)<o:p></o:p></p><p>same=n,ODBCFinish(${ODBC_ID})<o:p></o:p></p><p>same=n,Verbose(1,Drop Caller into the bridge)<o:p></o:p></p><p>same=n,Set(CONFBRIDGE(user,template)=default_user)<o:p></o:p></p><p>same=n,ConfBridge(${CONF_ID},default_bridge,,sample_user_menu)<o:p></o:p></p><p>same=n,Hangup()<o:p></o:p></p><p>;<o:p></o:p></p><p> <o:p></o:p></p><p>The log shows the 3 existing DB table rows are found but continues to cycle indefinitely if the PIN is NOT found.<o:p></o:p></p><p>First few rows of the console log:<o:p></o:p></p><p>=========================================================================<o:p></o:p></p><p>Connected to Asterisk 11.3.0 currently running on atpconf001 (pid = 1695) atpconf001*CLI><o:p></o:p></p><p> == Using SIP RTP CoS mark 5<o:p></o:p></p><p> <o:p></o:p></p><p>atpconf001*CLI> <o:p></o:p></p><p> -- Executing [067740@default:1] Set("SIP/testbridge2-00000021", "GLOBAL(CONF_ID)=067740") in new stack<o:p></o:p></p><p> == Setting global variable 'CONF_ID' to '067740'<o:p></o:p></p><p> -- Executing [067740@default:2] Goto("SIP/testbridge2-00000021", "rooms,067740,1") in new stack<o:p></o:p></p><p> <o:p></o:p></p><p>atpconf001*CLI> <o:p></o:p></p><p> -- Goto (rooms,067740,1)<o:p></o:p></p><p> -- Executing [067740@rooms:1] Set("SIP/testbridge2-00000021", "CONF_ID=067740") in new stack<o:p></o:p></p><p> -- Executing [067740@rooms:2] BackGround("SIP/testbridge2-00000021", "conf-getpin") in new stack<o:p></o:p></p><p> <o:p></o:p></p><p>atpconf001*CLI> <o:p></o:p></p><p> -- <SIP/testbridge2-00000021> Playing 'conf-getpin.slin' (language 'en')<o:p></o:p></p><p> <o:p></o:p></p><p>atpconf001*CLI> <o:p></o:p></p><p> -- Executing [067740@rooms:3] WaitExten("SIP/testbridge2-00000021", "5") in new stack<o:p></o:p></p><p> <o:p></o:p></p><p>atpconf001*CLI><o:p></o:p></p><p> == CDR updated on SIP/testbridge2-00000021<o:p></o:p></p><p> -- Executing [444999@rooms:1] Goto("SIP/testbridge2-00000021", "getpin,444999,1") in new stack<o:p></o:p></p><p> -- Goto (getpin,444999,1)<o:p></o:p></p><p> -- Executing [444999@getpin:1] Set("SIP/testbridge2-00000021", "GLOBAL(CONF_PIN)=444999") in new stack<o:p></o:p></p><p> == Setting global variable 'CONF_PIN' to '444999'<o:p></o:p></p><p> <o:p></o:p></p><p>atpconf001*CLI> <o:p></o:p></p><p> -- Executing [444999@getpin:2] Set("SIP/testbridge2-00000021", "ODBC_ID=32") in new stack<o:p></o:p></p><p> -- Executing [444999@getpin:3] NoOp("SIP/testbridge2-00000021", "") in new stack<o:p></o:p></p><p> -- Executing [444999@getpin:4] Set("SIP/testbridge2-00000021", "ROW_RESULT=112233") in new stack<o:p></o:p></p><p> <o:p></o:p></p><p>atpconf001*CLI> <o:p></o:p></p><p> -- Executing [444999@getpin:5] GotoIf("SIP/testbridge2-00000021", "0?cleanup,1") in new stack<o:p></o:p></p><p> -- Executing [444999@getpin:6] GotoIf("SIP/testbridge2-00000021", "0?good_exten,1") in new stack<o:p></o:p></p><p> -- Executing [444999@getpin:7] Goto("SIP/testbridge2-00000021", "loop_start") in new stack<o:p></o:p></p><p> -- Goto (getpin,444999,3)<o:p></o:p></p><p> -- Executing [444999@getpin:3] NoOp("SIP/testbridge2-00000021", "") in new stack<o:p></o:p></p><p> -- Executing [444999@getpin:4] Set("SIP/testbridge2-00000021", "ROW_RESULT=333333") in new stack<o:p></o:p></p><p> -- Executing [444999@getpin:5] GotoIf("SIP/testbridge2-00000021", "0?cleanup,1") in new stack<o:p></o:p></p><p> -- Executing [444999@getpin:6] GotoIf("SIP/testbridge2-00000021", "0?good_exten,1") in new stack<o:p></o:p></p><p> -- Executing [444999@getpin:7] Goto("SIP/testbridge2-00000021", "loop_start") in new stack<o:p></o:p></p><p> -- Goto (getpin,444999,3)<o:p></o:p></p><p> -- Executing [444999@getpin:3] NoOp("SIP/testbridge2-00000021", "") in new stack<o:p></o:p></p><p> -- Executing [444999@getpin:4] Set("SIP/testbridge2-00000021", "ROW_RESULT=135792") in new stack //LAST GOOD RESULT!!!<o:p></o:p></p><p> <o:p></o:p></p><p>atpconf001*CLI> <o:p></o:p></p><p> -- Executing [444999@getpin:5] GotoIf("SIP/testbridge2-00000021", "0?cleanup,1") in new stack<o:p></o:p></p><p> -- Executing [444999@getpin:6] GotoIf("SIP/testbridge2-00000021", "0?good_exten,1") in new stack<o:p></o:p></p><p> -- Executing [444999@getpin:7] Goto("SIP/testbridge2-00000021", "loop_start") in new stack<o:p></o:p></p><p> <o:p></o:p></p><p>atpconf001*CLI> <o:p></o:p></p><p> -- Goto (getpin,444999,3)<o:p></o:p></p><p> -- Executing [444999@getpin:3] NoOp("SIP/testbridge2-00000021", "") in new stack<o:p></o:p></p><p> <o:p></o:p></p><p>atpconf001*CLI> <o:p></o:p></p><p> -- Executing [444999@getpin:4] Set("SIP/testbridge2-00000021", "ROW_RESULT=") in new stack //BAD RESULTS FOREVER!!!<o:p></o:p></p><p> <o:p></o:p></p><p>atpconf001*CLI> <o:p></o:p></p><p> -- Executing [444999@getpin:5] GotoIf("SIP/testbridge2-00000021", "0?cleanup,1") in new stack<o:p></o:p></p><p> <o:p></o:p></p><p>atpconf001*CLI> <o:p></o:p></p><p> -- Executing [444999@getpin:6] GotoIf("SIP/testbridge2-00000021", "0?good_exten,1") in new stack<o:p></o:p></p><p> <o:p></o:p></p><p>atpconf001*CLI> <o:p></o:p></p><p> -- Executing [444999@getpin:7] Goto("SIP/testbridge2-00000021", "loop_start") in new stack<o:p></o:p></p><p> -- Goto (getpin,444999,3)<o:p></o:p></p><p> -- Executing [444999@getpin:3] NoOp("SIP/testbridge2-00000021", "") in new stack //AND SO ON........<o:p></o:p></p><p> <o:p></o:p></p><p>Thank you!!<o:p></o:p></p><p><span style='color:#888888'>Pat Collins...</span><o:p></o:p></p><p><span style='color:#888888'> </span><o:p></o:p></p><p><span style='color:#888888'> </span><o:p></o:p></p><p><span style='color:#888888'> </span><o:p></o:p></p></div></div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><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><o:p></o:p></p></div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto'><span style='color:#888888'><br><br clear=all><br>-- <br>Bharat Lalcheta <o:p></o:p></span></p></div></div></div></div><p class=MsoNormal><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><o:p></o:p></p></div><p class=MsoNormal><br><br clear=all><br>-- <br>Bharat Lalcheta <o:p></o:p></p></div></div></body></html>