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/
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@333689 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Terry Wilson
2011-08-29 17:31:40 +00:00
parent a91b1149b9
commit 9d2af5071b
2 changed files with 25 additions and 1 deletions

View File

@@ -4586,9 +4586,29 @@ int ast_sendtext(struct ast_channel *chan, const char *text)
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;