[asterisk-commits] twilson: trunk r333689 - in /trunk: ./ CHANGES main/channel.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Aug 29 12:31:46 CDT 2011


Author: twilson
Date: Mon Aug 29 12:31:40 2011
New Revision: 333689

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

........
  r333681 | twilson | 2011-08-29 12:28:59 -0500 (Mon, 29 Aug 2011) | 7 lines
  
  Use realtime text when it is negotiated
  
  This patch make use of wirte_text() realtime text instead of
  send_text() if T.140 is in native formats. ASTERISK-17937
  
  Review: https://reviewboard.asterisk.org/r/1356/
........

Modified:
    trunk/   (props changed)
    trunk/CHANGES
    trunk/main/channel.c

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

Modified: trunk/CHANGES
URL: http://svnview.digium.com/svn/asterisk/trunk/CHANGES?view=diff&rev=333689&r1=333688&r2=333689
==============================================================================
--- trunk/CHANGES (original)
+++ trunk/CHANGES Mon Aug 29 12:31:40 2011
@@ -40,6 +40,10 @@
    The MESSAGE() dialplan function and MessageSend() application have been
    added to go along with this functionality.  More detailed usage information
    can be found on the Asterisk wiki (http://wiki.asterisk.org/).
+ * If real-time text support (T.140) is negotiated, it will be preferred for
+   sending text via the SendText application. For example, via SIP, messages
+   that were once sent via the SIP MESSAGE request would be sent via RTP if
+   T.140 text is negotiated for a call.
 
 Parking
 -------

Modified: trunk/main/channel.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/channel.c?view=diff&rev=333689&r1=333688&r2=333689
==============================================================================
--- trunk/main/channel.c (original)
+++ trunk/main/channel.c Mon Aug 29 12:31:40 2011
@@ -4586,9 +4586,29 @@
 		ast_channel_unlock(chan);
 		return -1;
 	}
+
+	if (ast_strlen_zero(text)) {
+		ast_channel_unlock(chan);
+		return 0;
+	}
+
 	CHECK_BLOCKING(chan);
-	if (chan->tech->send_text)
+	if (chan->tech->write_text && (ast_format_cap_has_type(chan->nativeformats, AST_FORMAT_TYPE_TEXT))) {
+		struct ast_frame f;
+
+		f.frametype = AST_FRAME_TEXT;
+		f.src = "DIALPLAN";
+		f.mallocd = AST_MALLOCD_DATA;
+		f.datalen = strlen(text);
+		f.data.ptr = ast_strdup(text);
+		f.offset = 0;
+		f.seqno = 0;
+
+		ast_format_set(&f.subclass.format, AST_FORMAT_T140, 0);
+		res = chan->tech->write_text(chan, &f);
+	} else 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;




More information about the asterisk-commits mailing list