Summary: | ASTERISK-13834: [patch] 'h' extension not being executed, if caller hangs up before call is answered | ||
Reporter: | Alec Davis (alecdavis) | Labels: | |
Date Opened: | 2009-03-25 16:41:06 | Date Closed: | 2009-06-29 18:13:37 |
Priority: | Major | Regression? | No |
Status: | Closed/Complete | Components: | Applications/app_macro |
Versions: | Frequency of Occurrence | ||
Related Issues: | |||
Environment: | Attachments: | ( 0) 20090408__bug14757.diff.txt ( 1) 20090408_mysql.diff ( 2) 20090518__issue14757__trunk.diff.txt | |
Description: | We have a loop that clears the MYSQL connection that was used for the call. This used to work, but now we are seeing leaking conenctions, 1 for each early hangup. ****** ADDITIONAL INFORMATION ****** example not using MYSQL, but clearly illustrates the issue. dialplan code: exten => 8329,1,Macro(h_bug) exten => 8329,n,Hangup() [macro-h_bug] exten => s,1,NoOp('h' extension bug test) exten => s,n,Dial(SIP/GXP3009,5,r) exten => s,n,NoOp(DIALSTATUS=${DIALSTATUS}) exten => s,n,Hangup() exten => h,1,NoOp('h' extension executed) console output when caller hangups before call is answered: What is missing is the ('h' extension executed) !! Unknown IE 50 (cs5, Unknown Information Element) -- Accepting call from '5604866' to '8329' on channel 0/1, span 1 -- Executing [8329@incoming:1] Macro("DAHDI/1-1", "h_bug") in new stack -- Executing [s@macro-h_bug:1] NoOp("DAHDI/1-1", "'h' extension bug test") in new stack -- Executing [s@macro-h_bug:2] Dial("DAHDI/1-1", "SIP/GXP3009,5,r") in new stack == Using SIP RTP CoS mark 5 -- Called GXP3009 -- SIP/GXP3009-08477800 is ringing -- Channel 0/1, span 1 got hangup request, cause 16 == Spawn extension (macro-h_bug, s, 2) exited non-zero on 'DAHDI/1-1' in macro 'h_bug' == Spawn extension (incoming, 8329, 1) exited non-zero on 'DAHDI/1-1' -- Hungup 'DAHDI/1-1' chch1*CLI> console output when call has been answered, correctly shows that 'h' extension was executed: !! Unknown IE 50 (cs5, Unknown Information Element) -- Accepting call from '5604866' to '8329' on channel 0/1, span 1 -- Executing [8329@incoming:1] Macro("DAHDI/1-1", "h_bug") in new stack -- Executing [s@macro-h_bug:1] NoOp("DAHDI/1-1", "'h' extension bug test") in new stack -- Executing [s@macro-h_bug:2] Dial("DAHDI/1-1", "SIP/GXP3009,5,r") in new stack == Using SIP RTP CoS mark 5 -- Called GXP3009 -- SIP/GXP3009-08477800 is ringing -- SIP/GXP3009-08477800 answered DAHDI/1-1 -- Executing [h@macro-h_bug:1] NoOp("DAHDI/1-1", "'h' extension executed") in new stack == Spawn extension (macro-h_bug, s, 2) exited non-zero on 'DAHDI/1-1' in macro 'h_bug' == Spawn extension (incoming, 8329, 1) exited non-zero on 'DAHDI/1-1' -- Hungup 'DAHDI/1-1' chch1*CLI> console output when call was not been answered within timeout period 5 seconds in this case !! Unknown IE 50 (cs5, Unknown Information Element) -- Accepting call from '5604866' to '8329' on channel 0/1, span 1 -- Executing [8329@incoming:1] Macro("DAHDI/1-1", "h_bug") in new stack -- Executing [s@macro-h_bug:1] NoOp("DAHDI/1-1", "'h' extension bug test") in new stack -- Executing [s@macro-h_bug:2] Dial("DAHDI/1-1", "SIP/GXP3009,5,r") in new stack == Using SIP RTP CoS mark 5 -- Called GXP3009 -- SIP/GXP3009-08477800 is ringing -- Nobody picked up in 5000 ms -- Executing [s@macro-h_bug:3] NoOp("DAHDI/1-1", "DIALSTATUS=NOANSWER") in new stack -- Executing [s@macro-h_bug:4] Hangup("DAHDI/1-1", "") in new stack == Spawn extension (macro-h_bug, s, 4) exited non-zero on 'DAHDI/1-1' in macro 'h_bug' == Spawn extension (incoming, 8329, 1) exited non-zero on 'DAHDI/1-1' -- Hungup 'DAHDI/1-1' chch1*CLI> | ||
Comments: | By: Alec Davis (alecdavis) 2009-03-25 22:34:15 However using Gosub instead of Macro works as expected. dialplan code: ;exten => 8329,1,Macro(h_bug) exten => 8329,1,Gosub(testing,s,1) exten => 8329,n,Hangup() [macro-h_bug] exten => s,1,NoOp('h' extension macro test) exten => s,n,Dial(SIP/GXP3009,5,r) exten => s,n,NoOp(DIALSTATUS=${DIALSTATUS}) exten => h,1,NoOp(========== 'h' extension would successfully execute =============) [testing] exten => s,1,NoOp('h' extension gosub test) exten => s,n,Dial(SIP/GXP3009,5,r) exten => s,n,NoOp(DIALSTATUS=${DIALSTATUS}) exten => h,1,NoOp(========== 'h' extension would successfully execute =============) console output, caller hangsup before call is answered: Successful result, dialplan stops at Dial, and hangup extension is executed. !! Unknown IE 50 (cs5, Unknown Information Element) -- Accepting call from '5604866' to '8329' on channel 0/1, span 1 -- Executing [8329@incoming:1] Gosub("DAHDI/1-1", "testing,s,1") in new stack -- Executing [s@testing:1] NoOp("DAHDI/1-1", "'h' extension gosub test") in new stack -- Executing [s@testing:2] Dial("DAHDI/1-1", "SIP/GXP3009,5,r") in new stack == Using SIP RTP CoS mark 5 -- Called GXP3009 -- SIP/GXP3009-0846f750 is ringing -- Channel 0/1, span 1 got hangup request, cause 16 == Spawn extension (testing, s, 2) exited non-zero on 'DAHDI/1-1' -- Executing [h@testing:1] NoOp("DAHDI/1-1", "========== 'h' extension would successfully execute =============") in new stack -- Hungup 'DAHDI/1-1' chch1*CLI> quit console output, caller/callee hangup after call is answered: Successful result, Dialplan stops at Dial, and hangup extension gets executed. !! Unknown IE 50 (cs5, Unknown Information Element) -- Executing [8329@incoming:1] Gosub("DAHDI/1-1", "testing,s,1") in new stack -- Executing [s@testing:1] NoOp("DAHDI/1-1", "'h' extension gosub test") in new stack -- Executing [s@testing:2] Dial("DAHDI/1-1", "SIP/GXP3009,5,r") in new stack == Using SIP RTP CoS mark 5 -- Called GXP3009 -- Accepting call from '5604866' to '8329' on channel 0/1, span 1 -- SIP/GXP3009-0846f750 is ringing -- SIP/GXP3009-0846f750 answered DAHDI/1-1 -- Executing [h@testing:1] NoOp("DAHDI/1-1", "========== 'h' extension would successfully execute =============") in new stack == Spawn extension (testing, s, 2) exited non-zero on 'DAHDI/1-1' -- Hungup 'DAHDI/1-1' console output, call is unanswered after 5 seconds: Successful result, Dialplan continues with NOANSWER, and hangup extension gets executed. !! Unknown IE 50 (cs5, Unknown Information Element) -- Accepting call from '5604866' to '8329' on channel 0/1, span 1 -- Executing [8329@incoming:1] Gosub("DAHDI/1-1", "testing,s,1") in new stack -- Executing [s@testing:1] NoOp("DAHDI/1-1", "'h' extension gosub test") in new stack -- Executing [s@testing:2] Dial("DAHDI/1-1", "SIP/GXP3009,5,r") in new stack == Using SIP RTP CoS mark 5 -- Called GXP3009 -- SIP/GXP3009-0848d048 is ringing -- Nobody picked up in 5000 ms -- Executing [s@testing:3] NoOp("DAHDI/1-1", "DIALSTATUS=NOANSWER") in new stack -- Auto fallthrough, channel 'DAHDI/1-1' status is 'NOANSWER' -- Executing [h@testing:1] NoOp("DAHDI/1-1", "========== 'h' extension would successfully execute =============") in new stack -- Hungup 'DAHDI/1-1' chch1*CLI> By: Tilghman Lesher (tilghman) 2009-04-08 01:05:57 This patch will make the MYSQL app automatically clean up its resources when the channel exits, if you specify that in a config file: mysql.conf: [general] autoclear=yes By: Alec Davis (alecdavis) 2009-04-08 04:10:55 Do you have a patch for the latest trunk version? this patch fails with the following chch1:/usr/src/pbx/asterisk-addons/apps/tmp# patch -p0 app_addon_sql_mysql.c < bug_14757.diff.txt patching file app_addon_sql_mysql.c Hunk #1 succeeded at 90 (offset 6 lines). Hunk #2 succeeded at 111 with fuzz 2 (offset 6 lines). Hunk #3 FAILED at 191. Hunk #4 FAILED at 213. Hunk ASTERISK-1 FAILED at 263. Hunk ASTERISK-2 FAILED at 466. Hunk ASTERISK-3 succeeded at 572 (offset 66 lines). 4 out of 7 hunks FAILED -- saving rejects to file app_addon_sql_mysql.c.rej By: snuffy (snuffy) 2009-04-08 08:06:23 I updated the patch... please try again alec By: Tilghman Lesher (tilghman) 2009-04-08 08:37:32 To be clear, the original patch was designed for use in 1.4 addons. By: Alec Davis (alecdavis) 2009-04-08 17:21:47 I guessing I need asterisk at trunk as well, which was only checked out 12th March 09. svn info revision for asterisk shows 181371. notice the warning 'ast_channel_datastore_alloc' is deprecated tail end of 'make' .... app_addon_sql_mysql.c:124:54: error: macro "AST_LIST_REMOVE_CURRENT" passed 2 arguments, but takes just 1 app_addon_sql_mysql.c: In function âmysql_ds_destroyâ: app_addon_sql_mysql.c:124: error: âAST_LIST_REMOVE_CURRENTâ undeclared (first use in this function) app_addon_sql_mysql.c:124: error: (Each undeclared identifier is reported only once app_addon_sql_mysql.c:124: error: for each function it appears in.) app_addon_sql_mysql.c:150:54: error: macro "AST_LIST_REMOVE_CURRENT" passed 2 arguments, but takes just 1 app_addon_sql_mysql.c: In function âmysql_ds_fixupâ: app_addon_sql_mysql.c:150: error: âAST_LIST_REMOVE_CURRENTâ undeclared (first use in this function) app_addon_sql_mysql.c: In function âMYSQL_execâ: app_addon_sql_mysql.c:531: warning: âast_channel_datastore_allocâ is deprecated (declared at /usr/include/asterisk/channel.h:660) app_addon_sql_mysql.c:577:41: error: macro "ast_config_load" requires 2 arguments, but only 1 given app_addon_sql_mysql.c: In function âload_moduleâ: app_addon_sql_mysql.c:577: error: âast_config_loadâ undeclared (first use in this function) make[1]: *** [app_addon_sql_mysql.o] Error 1 make[1]: Leaving directory `/usr/src/pbx/asterisk-addons/apps' By: Andrew Lindh (andrew) 2009-04-08 18:09:26 I thought this was fixed in bug id ASTERISK-1397122 (to restore calling 'h' in a macro for hangup in a macro). By: Alec Davis (alecdavis) 2009-04-22 22:16:43 tilghman: I've been unable to test this as were not running the latest SVN. Today our production box has locked up twice (It's been running fine for months), with many MYSQL conenctions still open, I was unable to stop asterisk, only a kill -9 would end the process. While * was locked all phones became unsubscribed, but the asterisk console was still alive. Our production box is running SVN-trunk-r178446M built by root @ astrid on a i686 running Linux on 2009-03-02 08:13:47 UTC Are you able to create a patch for 178446 or around that vintage. Thanks Alec By: Tilghman Lesher (tilghman) 2009-05-18 17:22:01 Okay, patch uploaded for trunk. By: Tilghman Lesher (tilghman) 2009-06-29 15:23:33 alecdavis: ping By: Alec Davis (alecdavis) 2009-06-29 16:11:49 tilghman: here By: Leif Madsen (lmadsen) 2009-06-29 16:17:09 alecdavis: I think tilghman was looking for a test report :) By: Alec Davis (alecdavis) 2009-06-29 16:39:51 Applied 20090518 patch to asterisk-addons branches-1.6.1 Rev 952 checked out on the 24/06/09. Testing: Before patch, restarted Asterisk, dialled into it and hangup before answer. MySQL connection left open for each non-answered call. After patch, connections close after each non-answered call. tried with 'autolear=yes' and 'autolear=no', with mysql.conf present and missing, worked as expected. This seems good to go. By: Digium Subversion (svnbot) 2009-06-29 17:21:10 Repository: asterisk-addons Revision: 959 U branches/1.4/apps/app_addon_sql_mysql.c A branches/1.4/configs/mysql.conf.sample ------------------------------------------------------------------------ r959 | tilghman | 2009-06-29 17:21:09 -0500 (Mon, 29 Jun 2009) | 8 lines Autoclear resources in app MYSQL when the channel ends. (closes issue ASTERISK-13834) Reported by: alecdavis Patches: 20090408__bug14757.diff.txt uploaded by tilghman (license 14) 20090518__issue14757__trunk.diff.txt uploaded by tilghman (license 14) Tested by: alecdavis ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk-addons?view=rev&revision=959 By: Digium Subversion (svnbot) 2009-06-29 17:33:30 Repository: asterisk-addons Revision: 960 _U trunk/ U trunk/apps/app_addon_sql_mysql.c U trunk/configs/mysql.conf.sample ------------------------------------------------------------------------ r960 | tilghman | 2009-06-29 17:33:30 -0500 (Mon, 29 Jun 2009) | 15 lines Merged revisions 959 via svnmerge from https://origsvn.digium.com/svn/asterisk-addons/branches/1.4 ........ r959 | tilghman | 2009-06-29 17:21:09 -0500 (Mon, 29 Jun 2009) | 8 lines Autoclear resources in app MYSQL when the channel ends. (closes issue ASTERISK-13834) Reported by: alecdavis Patches: 20090408__bug14757.diff.txt uploaded by tilghman (license 14) 20090518__issue14757__trunk.diff.txt uploaded by tilghman (license 14) Tested by: alecdavis ........ ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk-addons?view=rev&revision=960 By: Digium Subversion (svnbot) 2009-06-29 18:02:58 Repository: asterisk-addons Revision: 961 _U branches/1.6.0/ U branches/1.6.0/apps/app_addon_sql_mysql.c A branches/1.6.0/configs/mysql.conf.sample ------------------------------------------------------------------------ r961 | tilghman | 2009-06-29 18:02:58 -0500 (Mon, 29 Jun 2009) | 22 lines Merged revisions 960 via svnmerge from https://origsvn.digium.com/svn/asterisk-addons/trunk ................ r960 | tilghman | 2009-06-29 17:33:29 -0500 (Mon, 29 Jun 2009) | 15 lines Merged revisions 959 via svnmerge from https://origsvn.digium.com/svn/asterisk-addons/branches/1.4 ........ r959 | tilghman | 2009-06-29 17:21:09 -0500 (Mon, 29 Jun 2009) | 8 lines Autoclear resources in app MYSQL when the channel ends. (closes issue ASTERISK-13834) Reported by: alecdavis Patches: 20090408__bug14757.diff.txt uploaded by tilghman (license 14) 20090518__issue14757__trunk.diff.txt uploaded by tilghman (license 14) Tested by: alecdavis ........ ................ ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk-addons?view=rev&revision=961 By: Digium Subversion (svnbot) 2009-06-29 18:12:21 Repository: asterisk-addons Revision: 962 _U branches/1.6.1/ U branches/1.6.1/apps/app_addon_sql_mysql.c A branches/1.6.1/configs/mysql.conf.sample ------------------------------------------------------------------------ r962 | tilghman | 2009-06-29 18:12:21 -0500 (Mon, 29 Jun 2009) | 22 lines Merged revisions 960 via svnmerge from https://origsvn.digium.com/svn/asterisk-addons/trunk ................ r960 | tilghman | 2009-06-29 17:33:29 -0500 (Mon, 29 Jun 2009) | 15 lines Merged revisions 959 via svnmerge from https://origsvn.digium.com/svn/asterisk-addons/branches/1.4 ........ r959 | tilghman | 2009-06-29 17:21:09 -0500 (Mon, 29 Jun 2009) | 8 lines Autoclear resources in app MYSQL when the channel ends. (closes issue ASTERISK-13834) Reported by: alecdavis Patches: 20090408__bug14757.diff.txt uploaded by tilghman (license 14) 20090518__issue14757__trunk.diff.txt uploaded by tilghman (license 14) Tested by: alecdavis ........ ................ ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk-addons?view=rev&revision=962 By: Digium Subversion (svnbot) 2009-06-29 18:13:36 Repository: asterisk-addons Revision: 963 _U branches/1.6.2/ U branches/1.6.2/apps/app_addon_sql_mysql.c A branches/1.6.2/configs/mysql.conf.sample ------------------------------------------------------------------------ r963 | tilghman | 2009-06-29 18:13:36 -0500 (Mon, 29 Jun 2009) | 22 lines Merged revisions 960 via svnmerge from https://origsvn.digium.com/svn/asterisk-addons/trunk ................ r960 | tilghman | 2009-06-29 17:33:29 -0500 (Mon, 29 Jun 2009) | 15 lines Merged revisions 959 via svnmerge from https://origsvn.digium.com/svn/asterisk-addons/branches/1.4 ........ r959 | tilghman | 2009-06-29 17:21:09 -0500 (Mon, 29 Jun 2009) | 8 lines Autoclear resources in app MYSQL when the channel ends. (closes issue ASTERISK-13834) Reported by: alecdavis Patches: 20090408__bug14757.diff.txt uploaded by tilghman (license 14) 20090518__issue14757__trunk.diff.txt uploaded by tilghman (license 14) Tested by: alecdavis ........ ................ ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk-addons?view=rev&revision=963 |