[Asterisk-code-review] avoid merging command and regular T140 text (asterisk[13])
Emmanuel BUU
asteriskteam at digium.com
Wed Jul 18 09:33:31 CDT 2018
Emmanuel BUU has uploaded this change for review. ( https://gerrit.asterisk.org/9510
Change subject: avoid merging command and regular T140 text
......................................................................
avoid merging command and regular T140 text
Change-Id: Ifbe993311410fa855cb8aa4a12084db75f413462
---
M res/res_rtp_asterisk.c
1 file changed, 15 insertions(+), 1 deletion(-)
git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/10/9510/1
diff --git a/res/res_rtp_asterisk.c b/res/res_rtp_asterisk.c
index 1a1307f..82f86d0 100644
--- a/res/res_rtp_asterisk.c
+++ b/res/res_rtp_asterisk.c
@@ -6102,13 +6102,27 @@
{
struct ast_rtp *rtp = ast_rtp_instance_get_data(instance);
+ if ( !rtp->red ) return 0;
if (frame->datalen > -1) {
struct rtp_red *red = rtp->red;
+ const unsigned char * primary = red->buf_data;
+ if (red->t140.datalen > 0 &&
+ (primary[0] == 0x08 || primary[0] == 0x0a || primary[0] == 0x0d)) {
+ /* flush previous t140 packet if it is a command */
+ ast_rtp_write(instance, &rtp->red->t140);
+ }
+ else {
+ primary = frame->data.ptr;
+ if (primary[0] == 0x08 || primary[0] == 0x0a || primary[0] == 0x0d) {
+ /* flush previous t140 packet we send commands */
+ ast_rtp_write(instance, &rtp->red->t140);
+ }
+ }
+
memcpy(&red->buf_data[red->t140.datalen], frame->data.ptr, frame->datalen);
red->t140.datalen += frame->datalen;
red->t140.ts = frame->ts;
}
-
return 0;
}
--
To view, visit https://gerrit.asterisk.org/9510
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ifbe993311410fa855cb8aa4a12084db75f413462
Gerrit-Change-Number: 9510
Gerrit-PatchSet: 1
Gerrit-Owner: Emmanuel BUU <emmanuel.buu at ives.fr>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20180718/9c24a9ee/attachment.html>
More information about the asterisk-code-review
mailing list