Summary: | ASTERISK-05824: Problem with ManagerAPI events following a Parked Call related events | ||
Reporter: | Gerhard Venter (gventer) | Labels: | |
Date Opened: | 2005-12-12 14:49:17.000-0600 | Date Closed: | 2008-01-15 16:12:42.000-0600 |
Priority: | Minor | Regression? | No |
Status: | Closed/Complete | Components: | Core/ManagerInterface |
Versions: | Frequency of Occurrence | ||
Related Issues: | |||
Environment: | Attachments: | ||
Description: | Any event following a ParkedCall or any event raised in res_features.c will be pre-pended with a "\r\n". That is because when ever the manager_event method is called in res_features.c the text is send with two "/r/n" at the end and then in the manager.c the actual last "/r/n" is appended. Thus ending up with three "/r/n". So when the next event is to be send it has a leading "/r/n" since the client sockets reads until /r/n/r/n thus leaving the additional /r/n in the pipeline picked up in the next read. Here is snippets of the code: Here is the code from res_features.c: manager_event(EVENT_FLAG_CALL, "ParkedCall", "Exten: %d\r\n" "Channel: %s\r\n" "From: %s\r\n" "Timeout: %ld\r\n" "CallerID: %s\r\n" "CallerIDName: %s\r\n\r\n" <== 2 /r/n Here is the code from manager.c where it is calling the same method: manager_event(EVENT_FLAG_CALL, "OriginateSuccess", "%s" "Channel: %s/%s\r\n" "Context: %s\r\n" "Exten: %s\r\n" "Reason: %d\r\n" "Uniqueid: %s\r\n", <== only one /r/n And here is the code of the method showing it is appending the /r/n: /*! \brief manager_event: Send AMI event to client */ int manager_event(int category, char *event, char *fmt, ...) { struct mansession *s; char auth[80]; char tmp[4096] = ""; char *tmp_next = tmp; size_t tmp_left = sizeof(tmp) - 2; va_list ap; ast_mutex_lock(&sessionlock); for (s = sessions; s; s = s->next) { if ((s->readperm & category) != category) continue; if ((s->send_events & category) != category) continue; if (ast_strlen_zero(tmp)) { ast_build_string(&tmp_next, &tmp_left, "Event: %s\r\nPrivilege: %s\r\n", event, authority_to_str(category, auth, sizeof(auth))); va_start(ap, fmt); ast_build_string_va(&tmp_next, &tmp_left, fmt, ap); va_end(ap); *tmp_next++ = '\r'; *tmp_next++ = '\n'; <====appending the last /r/n *tmp_next = '\0'; } | ||
Comments: | By: Gerhard Venter (gventer) 2005-12-12 16:55:05.000-0600 I don't know how to change the Category once the issue has been reported. This has to be ManagerAPI. If someone can do that or explain to me how. :) Thanks Gerhard Venter By: Olle Johansson (oej) 2006-01-04 14:53:12.000-0600 Fixed in 1.2 (rev 7795) and trunk (rev 7796). Thanks for reporting this error and contributing to Asterisk! /Olle By: Digium Subversion (svnbot) 2008-01-15 16:11:32.000-0600 Repository: asterisk Revision: 7795 U branches/1.2/res/res_features.c ------------------------------------------------------------------------ r7795 | oej | 2008-01-15 16:11:32 -0600 (Tue, 15 Jan 2008) | 2 lines Issue ASTERISK-5824: Removing extra CR+LF in manager events - needs port to trunk ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk?view=rev&revision=7795 By: Digium Subversion (svnbot) 2008-01-15 16:11:33.000-0600 Repository: asterisk Revision: 7796 _U trunk/ U trunk/res/res_features.c ------------------------------------------------------------------------ r7796 | oej | 2008-01-15 16:11:33 -0600 (Tue, 15 Jan 2008) | 10 lines Merged revisions 7795 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.2 ........ r7795 | oej | 2006-01-04 22:46:40 +0100 (Wed, 04 Jan 2006) | 2 lines Issue ASTERISK-5824: Removing extra CR+LF in manager events - needs port to trunk ........ ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk?view=rev&revision=7796 By: Digium Subversion (svnbot) 2008-01-15 16:12:42.000-0600 Repository: asterisk Revision: 7880 _U team/oej/moduletest/ U team/oej/moduletest/apps/app_chanspy.c U team/oej/moduletest/apps/app_mixmonitor.c U team/oej/moduletest/apps/app_privacy.c U team/oej/moduletest/apps/app_stack.c U team/oej/moduletest/apps/app_voicemail.c D team/oej/moduletest/ast_expr.y U team/oej/moduletest/ast_expr2.fl U team/oej/moduletest/ast_expr2f.c U team/oej/moduletest/channel.c U team/oej/moduletest/channels/chan_agent.c U team/oej/moduletest/channels/chan_iax2.c U team/oej/moduletest/channels/chan_sip.c U team/oej/moduletest/formats/format_pcm.c U team/oej/moduletest/formats/format_pcm_alaw.c U team/oej/moduletest/funcs/func_moh.c U team/oej/moduletest/include/asterisk/chanspy.h U team/oej/moduletest/include/asterisk/strings.h U team/oej/moduletest/manager.c U team/oej/moduletest/pbx/pbx_config.c U team/oej/moduletest/pbx/pbx_spool.c U team/oej/moduletest/res/res_features.c ------------------------------------------------------------------------ r7880 | oej | 2008-01-15 16:12:41 -0600 (Tue, 15 Jan 2008) | 150 lines Merged revisions 7677,7706,7709,7736,7738,7740,7743,7746,7771,7773,7792,7795,7799-7800,7803,7805,7807,7809,7812,7819,7823,7825,7827,7829,7831,7848,7870-7871 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.2 ........ r7677 | tilghman | 2005-12-30 15:54:19 +0100 (Fri, 30 Dec 2005) | 2 lines Bug 6091 - Fix race condition around uniqueid ........ r7706 | bweschke | 2006-01-02 03:04:14 +0100 (Mon, 02 Jan 2006) | 3 lines Fix compiler warnings. ........ r7709 | tilghman | 2006-01-02 08:31:54 +0100 (Mon, 02 Jan 2006) | 2 lines Bug 6084 - MixMonitor after a 'cli stop monitor' deadlocks ........ r7736 | kpfleming | 2006-01-03 17:34:12 +0100 (Tue, 03 Jan 2006) | 2 lines don't leak memory for (most) expression evaluations ........ r7738 | kpfleming | 2006-01-03 18:00:01 +0100 (Tue, 03 Jan 2006) | 2 lines backport rport scanning fix from trunk (bug ASTERISK-5913) ........ r7740 | kpfleming | 2006-01-03 18:24:56 +0100 (Tue, 03 Jan 2006) | 4 lines revert incorrect fix for bug ASTERISK-5890 from revision 7709 put in correct (simpler) fix add doxygen docs for channel spy 'state' values ........ r7743 | tilghman | 2006-01-03 19:15:12 +0100 (Tue, 03 Jan 2006) | 2 lines Bug 6121 - typo in application description ........ r7746 | kpfleming | 2006-01-03 21:22:18 +0100 (Tue, 03 Jan 2006) | 2 lines remove unused 'old' expression parser ........ r7771 | bweschke | 2006-01-04 06:27:38 +0100 (Wed, 04 Jan 2006) | 3 lines Fix the 'if' clause to be true under the right conditions. Bug ASTERISK-5969 ........ r7773 | russell | 2006-01-04 08:06:50 +0100 (Wed, 04 Jan 2006) | 2 lines use a more correct way of determining the size of the destination buffer ........ r7792 | oej | 2006-01-04 22:43:14 +0100 (Wed, 04 Jan 2006) | 2 lines Fixing typo in XML for video updates. ........ r7795 | oej | 2006-01-04 22:46:40 +0100 (Wed, 04 Jan 2006) | 2 lines Issue ASTERISK-5824: Removing extra CR+LF in manager events - needs port to trunk ........ r7799 | kpfleming | 2006-01-05 00:02:38 +0100 (Thu, 05 Jan 2006) | 2 lines make monitoring more tolerant of peers that deliver frames in bursts ........ r7800 | kpfleming | 2006-01-05 00:27:57 +0100 (Thu, 05 Jan 2006) | 2 lines ensure that ulaw/alaw sound files are filled with silence when extended (not zeroes) ........ r7803 | kpfleming | 2006-01-05 00:45:34 +0100 (Thu, 05 Jan 2006) | 2 lines return properly after extending file ........ r7805 | kpfleming | 2006-01-05 00:51:03 +0100 (Thu, 05 Jan 2006) | 2 lines use proper fwrite() parameters and return value ........ r7807 | kpfleming | 2006-01-05 01:18:46 +0100 (Thu, 05 Jan 2006) | 2 lines doh... fseek() has no useful return value ........ r7809 | kpfleming | 2006-01-05 01:58:29 +0100 (Thu, 05 Jan 2006) | 2 lines send device state updates for auto-logoff of agents as well ........ r7812 | oej | 2006-01-05 10:13:21 +0100 (Thu, 05 Jan 2006) | 2 lines Fix copyright of changed file ........ r7819 | kpfleming | 2006-01-05 21:52:38 +0100 (Thu, 05 Jan 2006) | 2 lines ensure that variable is initialized ........ r7823 | tilghman | 2006-01-06 00:07:08 +0100 (Fri, 06 Jan 2006) | 2 lines Bug 6081 - fix for memory leak, formatting fixes ........ r7825 | kpfleming | 2006-01-06 00:49:50 +0100 (Fri, 06 Jan 2006) | 3 lines eliminate rounding errors that caused call time limits to be inaccurate (issue ASTERISK-5758) round 'time left' reported during call limit warnings up to sound more accurate ........ r7827 | tilghman | 2006-01-06 00:53:07 +0100 (Fri, 06 Jan 2006) | 2 lines Bug 6076 - Fix documentation of ast_trim_blank return value ........ r7829 | kpfleming | 2006-01-06 01:21:00 +0100 (Fri, 06 Jan 2006) | 2 lines update agent persistence when an agent gets logged off by autologoff ........ r7831 | tilghman | 2006-01-06 01:34:40 +0100 (Fri, 06 Jan 2006) | 2 lines Dumb error messages - "Context 'context' already included in 'in' context" ........ r7848 | tilghman | 2006-01-07 08:27:18 +0100 (Sat, 07 Jan 2006) | 2 lines Bug 6156 - catch all threading errors, not just simple failure ........ r7870 | russell | 2006-01-09 05:52:16 +0100 (Mon, 09 Jan 2006) | 2 lines backport fix for unnecessary unlock (issue ASTERISK-6014) ........ r7871 | russell | 2006-01-09 06:11:44 +0100 (Mon, 09 Jan 2006) | 2 lines fix seg fault when using greek syntax in VoicemMailMain (issue ASTERISK-5878) ........ ------------------------------------------------------------------------ http://svn.digium.com/view/asterisk?view=rev&revision=7880 |