[Asterisk-code-review] chan_unistim: Fix RTP port byte order for big-endian arch (...asterisk[13])
Igor Goncharovsky
asteriskteam at digium.com
Fri Aug 16 06:03:24 CDT 2019
Igor Goncharovsky has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/12747
Change subject: chan_unistim: Fix RTP port byte order for big-endian arch
......................................................................
chan_unistim: Fix RTP port byte order for big-endian arch
This patch fixes one-way oudio that users expirienced on
big-endian architechtires. RTP port number bytes was stored
in improper order and phone sent RTP to wrong RTP port.
Reported-by: Andrey Ionov
Change-Id: I9a9ca7f26e31a67bbbceff12923baa10dfb8a3be
---
M channels/chan_unistim.c
1 file changed, 10 insertions(+), 10 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/47/12747/1
diff --git a/channels/chan_unistim.c b/channels/chan_unistim.c
index b846585..a109cb7 100644
--- a/channels/chan_unistim.c
+++ b/channels/chan_unistim.c
@@ -2766,16 +2766,16 @@
buffsend[21] = (htons(sin.sin_port) & 0x00ff);
buffsend[23] = (rtcpsin_port & 0x00ff);
buffsend[22] = (rtcpsin_port & 0xff00) >> 8;
- buffsend[25] = (us.sin_port & 0xff00) >> 8;
- buffsend[24] = (us.sin_port & 0x00ff);
+ buffsend[24] = (htons(us.sin_port) & 0xff00) >> 8;
+ buffsend[25] = (htons(us.sin_port) & 0x00ff);
buffsend[27] = (rtcpsin_port & 0x00ff);
buffsend[26] = (rtcpsin_port & 0xff00) >> 8;
} else {
memcpy(buffsend + 23, &public.sin_addr, sizeof(public.sin_addr));
buffsend[15] = (htons(sin.sin_port) & 0xff00) >> 8;
buffsend[16] = (htons(sin.sin_port) & 0x00ff);
- buffsend[20] = (us.sin_port & 0xff00) >> 8;
- buffsend[19] = (us.sin_port & 0x00ff);
+ buffsend[19] = (htons(us.sin_port) & 0xff00) >> 8;
+ buffsend[20] = (htons(us.sin_port) & 0x00ff);
}
buffsend[11] = codec; /* rx */
buffsend[12] = codec; /* tx */
@@ -2797,16 +2797,16 @@
buffsend[21] = (htons(sin.sin_port) & 0x00ff);
buffsend[23] = (rtcpsin_port & 0x00ff);
buffsend[22] = (rtcpsin_port & 0xff00) >> 8;
- buffsend[25] = (us.sin_port & 0xff00) >> 8;
- buffsend[24] = (us.sin_port & 0x00ff);
+ buffsend[24] = (htons(us.sin_port) & 0xff00) >> 8;
+ buffsend[25] = (htons(us.sin_port) & 0x00ff);
buffsend[27] = (rtcpsin_port & 0x00ff);
buffsend[26] = (rtcpsin_port & 0xff00) >> 8;
} else {
memcpy(buffsend + 23, &public.sin_addr, sizeof(public.sin_addr));
buffsend[15] = (htons(sin.sin_port) & 0xff00) >> 8;
buffsend[16] = (htons(sin.sin_port) & 0x00ff);
- buffsend[20] = (us.sin_port & 0xff00) >> 8;
- buffsend[19] = (us.sin_port & 0x00ff);
+ buffsend[19] = (htons(us.sin_port) & 0xff00) >> 8;
+ buffsend[20] = (htons(us.sin_port) & 0x00ff);
}
buffsend[11] = codec; /* rx */
buffsend[12] = codec; /* tx */
@@ -2821,8 +2821,8 @@
memcpy(buffsend + SIZE_HEADER, packet_send_call, sizeof(packet_send_call));
memcpy(buffsend + 53, &public.sin_addr, sizeof(public.sin_addr));
/* Destination port when sending RTP */
- buffsend[49] = (us.sin_port & 0x00ff);
- buffsend[50] = (us.sin_port & 0xff00) >> 8;
+ buffsend[49] = (htons(us.sin_port) & 0xff00) >> 8;
+ buffsend[50] = (htons(us.sin_port) & 0x00ff);
/* Destination port when sending RTCP */
buffsend[52] = (rtcpsin_port & 0x00ff);
buffsend[51] = (rtcpsin_port & 0xff00) >> 8;
--
To view, visit https://gerrit.asterisk.org/c/asterisk/+/12747
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Change-Id: I9a9ca7f26e31a67bbbceff12923baa10dfb8a3be
Gerrit-Change-Number: 12747
Gerrit-PatchSet: 1
Gerrit-Owner: Igor Goncharovsky <igor.goncharovsky at gmail.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20190816/f31c041c/attachment.html>
More information about the asterisk-code-review
mailing list