[asterisk-commits] rmudgett: trunk r305939 - in /trunk: ./ apps/ channels/ main/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Feb 2 18:29:51 CST 2011


Author: rmudgett
Date: Wed Feb  2 18:29:46 2011
New Revision: 305939

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=305939
Log:
Merged revisions 305923 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.8

................
  r305923 | rmudgett | 2011-02-02 18:24:40 -0600 (Wed, 02 Feb 2011) | 24 lines
  
  Merged revisions 305889 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.6.2
  
  ................
    r305889 | rmudgett | 2011-02-02 18:15:07 -0600 (Wed, 02 Feb 2011) | 17 lines
    
    Merged revisions 305888 via svnmerge from
    https://origsvn.digium.com/svn/asterisk/branches/1.4
    
    ........
      r305888 | rmudgett | 2011-02-02 18:02:43 -0600 (Wed, 02 Feb 2011) | 8 lines
    
      Minor AST_FRAME_TEXT related issues.
    
      * Include the null terminator in the buffer length.  When the frame is
      queued it is copied.  If the null terminator is not part of the frame
      buffer length, the receiver could see garbage appended onto it.
    
      * Add channel lock protection with ast_sendtext().
    
      * Fixed AMI SendText action ast_sendtext() return value check.
    ........
  ................
................

Modified:
    trunk/   (props changed)
    trunk/apps/app_sendtext.c
    trunk/channels/chan_sip.c
    trunk/main/channel.c
    trunk/main/manager.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.8-merged' - no diff available.

Modified: trunk/apps/app_sendtext.c
URL: http://svnview.digium.com/svn/asterisk/trunk/apps/app_sendtext.c?view=diff&rev=305939&r1=305938&r2=305939
==============================================================================
--- trunk/apps/app_sendtext.c (original)
+++ trunk/apps/app_sendtext.c Wed Feb  2 18:29:46 2011
@@ -98,10 +98,10 @@
 		return 0;
 	}
 	status = "FAILURE";
-	ast_channel_unlock(chan);
 	if (!ast_sendtext(chan, ast_str_buffer(str))) {
 		status = "SUCCESS";
 	}
+	ast_channel_unlock(chan);
 	pbx_builtin_setvar_helper(chan, "SENDTEXTSTATUS", status);
 	return 0;
 }

Modified: trunk/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_sip.c?view=diff&rev=305939&r1=305938&r2=305939
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Wed Feb  2 18:29:46 2011
@@ -15475,7 +15475,7 @@
 		f.subclass.integer = 0;
 		f.offset = 0;
 		f.data.ptr = buf;
-		f.datalen = strlen(buf);
+		f.datalen = strlen(buf) + 1;
 		ast_queue_frame(p->owner, &f);
 		transmit_response(p, "202 Accepted", req); /* We respond 202 accepted, since we relay the message */
 		return;

Modified: trunk/main/channel.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/channel.c?view=diff&rev=305939&r1=305938&r2=305939
==============================================================================
--- trunk/main/channel.c (original)
+++ trunk/main/channel.c Wed Feb  2 18:29:46 2011
@@ -4466,13 +4466,18 @@
 int ast_sendtext(struct ast_channel *chan, const char *text)
 {
 	int res = 0;
+
+	ast_channel_lock(chan);
 	/* Stop if we're a zombie or need a soft hangup */
-	if (ast_test_flag(chan, AST_FLAG_ZOMBIE) || ast_check_hangup(chan))
+	if (ast_test_flag(chan, AST_FLAG_ZOMBIE) || ast_check_hangup(chan)) {
+		ast_channel_unlock(chan);
 		return -1;
+	}
 	CHECK_BLOCKING(chan);
 	if (chan->tech->send_text)
 		res = chan->tech->send_text(chan, text);
 	ast_clear_flag(chan, AST_FLAG_BLOCKING);
+	ast_channel_unlock(chan);
 	return res;
 }
 

Modified: trunk/main/manager.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/manager.c?view=diff&rev=305939&r1=305938&r2=305939
==============================================================================
--- trunk/main/manager.c (original)
+++ trunk/main/manager.c Wed Feb  2 18:29:46 2011
@@ -3245,12 +3245,10 @@
 		return 0;
 	}
 
-	ast_channel_lock(c);
 	res = ast_sendtext(c, textmsg);
-	ast_channel_unlock(c);
 	c = ast_channel_unref(c);
 
-	if (res > 0) {
+	if (res >= 0) {
 		astman_send_ack(s, m, "Success");
 	} else {
 		astman_send_error(s, m, "Failure");




More information about the asterisk-commits mailing list