Summary: | ASTERISK-13426: pbx.c's show_dialplan_helper prints an "\r\n" at the end of every call | ||
Reporter: | Martin B. Smith (martins) | Labels: | |
Date Opened: | 2009-01-21 20:21:39.000-0600 | Date Closed: | 2009-02-20 17:05:13.000-0600 |
Priority: | Minor | Regression? | No |
Status: | Closed/Complete | Components: | Core/PBX |
Versions: | Frequency of Occurrence | ||
Related Issues: | |||
Environment: | Attachments: | ( 0) bug-14305.diff.txt ( 1) conv.txt | |
Description: | Asterisk-Java has expected to consistently see any Manager responses of the "response: Follows" style to contain whatever response in a single "\r\n"-ending line somewhere in the response, which could contain multiple "\n", but ends in "--END COMMAND--\r\n". We've had much success with this consistent behavior. In fact, it's one of the only ways we can recognize the data lines that come with a command (because they aren't delimited with "\r\n", but only an "\n"). Doing an "action: Command" with "dialplan show" as the command fails this expectation. See additional information for more. ****** ADDITIONAL INFORMATION ****** Hello! asterisk-java.org's Asterisk-Java component that helps with Manager communication has encountered something that we think might be a bug in the way "dialplan show" is handled for a manager command like "action: Command". Usually, when the response to a Manager command is "response: Follows", we eventually see a line, possibly containing "\n", but only containing a single "\r\n" after a final end of "--END COMMAND--" (so the final bit of the line, possible with many "\n", is "--END COMMAND--\r\n"). Most of our command parsing follows this convention successfully. Unfortunately, pbx's show_dialplan_helper prints an "\r\n" instead of just an "\n" at the end of the function. When this gets called on includes in the dialplan, we fail to parse the Manager output because of the multiple "\r\n". I'm attaching an example dump of our conversation with the current SVN head of the 1.4 branch. The extra, multiple "\r\n" are biting us because they are midway through the data stream of the dialplan output that we're parsing. Other "response: Follows" don't do that! | ||
Comments: | By: Martin B. Smith (martins) 2009-01-21 20:23:09.000-0600 See line 657 of conv.txt for the hex "0d 0a", which is what usually doesn't appear mid-data stream of manager responses of the "response: Follows" form. By: Martin B. Smith (martins) 2009-01-21 20:23:46.000-0600 Here's also our initial triage of a user with the problem, including our expectations of Asterisk from Stefan: http://www.nabble.com/Problems-with-CommandAction-td15231683.html By: Martin B. Smith (martins) 2009-01-21 20:24:05.000-0600 Here's our JIRA regarding the issue: http://jira.reucon.org/browse/AJ-184 By: James Golovich (jamesgolovich) 2009-01-22 11:08:16.000-0600 I'd agree this is not consistent behavior. A quick scan of the code shows the only usage of "\r\n" is pretty much just in manager and http code. in pbx.c show_dialplan_helper and show_debug_helper cli writes use "\r\n". Based on the comments in the code I suspect these functions were both written/modified by the same person Trivial patch attached By: Mark Michelson (mmichelson) 2009-01-23 15:10:51.000-0600 I'm changing the status to "ready for testing" since there is a patch attached. By: Digium Subversion (svnbot) 2009-02-20 16:59:53.000-0600 Repository: asterisk Revision: 177786 U branches/1.4/main/pbx.c ------------------------------------------------------------------------ r177786 | tilghman | 2009-02-20 16:59:52 -0600 (Fri, 20 Feb 2009) | 9 lines Don't print the CR-NL combination when we aren't outputting to the manager. An embedded CR-NL in a CLI command screws up several AMI parsers that don't expect to see that combination in the middle of output. (Closes issue ASTERISK-13426) Reported by: martins Patch by: tilghman ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk?view=rev&revision=177786 By: Digium Subversion (svnbot) 2009-02-20 17:02:36.000-0600 Repository: asterisk Revision: 177787 _U trunk/ U trunk/main/pbx.c ------------------------------------------------------------------------ r177787 | tilghman | 2009-02-20 17:02:36 -0600 (Fri, 20 Feb 2009) | 16 lines Merged revisions 177786 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r177786 | tilghman | 2009-02-20 16:59:52 -0600 (Fri, 20 Feb 2009) | 9 lines Don't print the CR-NL combination when we aren't outputting to the manager. An embedded CR-NL in a CLI command screws up several AMI parsers that don't expect to see that combination in the middle of output. (Closes issue ASTERISK-13426) Reported by: martins Patch by: tilghman ........ ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk?view=rev&revision=177787 By: Digium Subversion (svnbot) 2009-02-20 17:04:34.000-0600 Repository: asterisk Revision: 177788 _U branches/1.6.0/ U branches/1.6.0/main/pbx.c ------------------------------------------------------------------------ r177788 | tilghman | 2009-02-20 17:04:34 -0600 (Fri, 20 Feb 2009) | 23 lines Merged revisions 177787 via svnmerge from https://origsvn.digium.com/svn/asterisk/trunk ................ r177787 | tilghman | 2009-02-20 17:02:35 -0600 (Fri, 20 Feb 2009) | 16 lines Merged revisions 177786 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r177786 | tilghman | 2009-02-20 16:59:52 -0600 (Fri, 20 Feb 2009) | 9 lines Don't print the CR-NL combination when we aren't outputting to the manager. An embedded CR-NL in a CLI command screws up several AMI parsers that don't expect to see that combination in the middle of output. (Closes issue ASTERISK-13426) Reported by: martins Patch by: tilghman ........ ................ ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk?view=rev&revision=177788 By: Digium Subversion (svnbot) 2009-02-20 17:05:12.000-0600 Repository: asterisk Revision: 177789 _U branches/1.6.1/ U branches/1.6.1/main/pbx.c ------------------------------------------------------------------------ r177789 | tilghman | 2009-02-20 17:05:12 -0600 (Fri, 20 Feb 2009) | 23 lines Merged revisions 177787 via svnmerge from https://origsvn.digium.com/svn/asterisk/trunk ................ r177787 | tilghman | 2009-02-20 17:02:35 -0600 (Fri, 20 Feb 2009) | 16 lines Merged revisions 177786 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r177786 | tilghman | 2009-02-20 16:59:52 -0600 (Fri, 20 Feb 2009) | 9 lines Don't print the CR-NL combination when we aren't outputting to the manager. An embedded CR-NL in a CLI command screws up several AMI parsers that don't expect to see that combination in the middle of output. (Closes issue ASTERISK-13426) Reported by: martins Patch by: tilghman ........ ................ ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk?view=rev&revision=177789 |