[Asterisk-code-review] chan_rtp: Make usage of ast_rtp_instance_get_local_address clearer (asterisk[master])
George Joseph
asteriskteam at digium.com
Wed Nov 2 07:56:16 CDT 2022
George Joseph has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/19526 )
Change subject: chan_rtp: Make usage of ast_rtp_instance_get_local_address clearer
......................................................................
chan_rtp: Make usage of ast_rtp_instance_get_local_address clearer
unicast_rtp_request() was setting the channel variables like this:
pbx_builtin_setvar_helper(chan, "UNICASTRTP_LOCAL_ADDRESS",
ast_sockaddr_stringify_addr(&local_address));
ast_rtp_instance_get_local_address(instance, &local_address);
pbx_builtin_setvar_helper(chan, "UNICASTRTP_LOCAL_PORT",
ast_sockaddr_stringify_port(&local_address));
...which make it appear that UNICASTRTP_LOCAL_ADDRESS was being
set before local_address was set. In fact, the address part of
local_address was set earlier in the function, just not the port.
This was confusing however so ast_rtp_instance_get_local_address()
is now being called before setting UNICASTRTP_LOCAL_ADDRESS.
While in that module anyway, MULTICASTRTP_LOCAL_ADDRESS and
MULTICASTRTP_LOCAL_PORT are now being set as well.
ASTERISK-30281
Change-Id: I872ac49477100f4eb33891d46efc6ca21ec81aa4
---
M channels/chan_rtp.c
A doc/CHANGES-staging/chan_rtp.txt
2 files changed, 39 insertions(+), 1 deletion(-)
git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/26/19526/1
diff --git a/channels/chan_rtp.c b/channels/chan_rtp.c
index 087ddae..12f07c1 100644
--- a/channels/chan_rtp.c
+++ b/channels/chan_rtp.c
@@ -230,6 +230,12 @@
ast_channel_tech_pvt_set(chan, instance);
+ ast_rtp_instance_get_local_address(instance, &control_address);
+ pbx_builtin_setvar_helper(chan, "MULTICASTRTP_LOCAL_ADDRESS",
+ ast_sockaddr_stringify_addr(&control_address));
+ pbx_builtin_setvar_helper(chan, "MULTICASTRTP_LOCAL_PORT",
+ ast_sockaddr_stringify_port(&control_address));
+
ast_channel_unlock(chan);
ao2_ref(fmt, -1);
@@ -381,9 +387,9 @@
ast_channel_tech_pvt_set(chan, instance);
+ ast_rtp_instance_get_local_address(instance, &local_address);
pbx_builtin_setvar_helper(chan, "UNICASTRTP_LOCAL_ADDRESS",
ast_sockaddr_stringify_addr(&local_address));
- ast_rtp_instance_get_local_address(instance, &local_address);
pbx_builtin_setvar_helper(chan, "UNICASTRTP_LOCAL_PORT",
ast_sockaddr_stringify_port(&local_address));
diff --git a/doc/CHANGES-staging/chan_rtp.txt b/doc/CHANGES-staging/chan_rtp.txt
new file mode 100644
index 0000000..fe49494
--- /dev/null
+++ b/doc/CHANGES-staging/chan_rtp.txt
@@ -0,0 +1,4 @@
+Subject: chan_rtp
+
+MULTICASTRTP_LOCAL_ADDRESS and MULTICASTRTP_LOCAL_PORT channel
+variables are now available for MulticastRTP channels.
--
To view, visit https://gerrit.asterisk.org/c/asterisk/+/19526
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: I872ac49477100f4eb33891d46efc6ca21ec81aa4
Gerrit-Change-Number: 19526
Gerrit-PatchSet: 1
Gerrit-Owner: George Joseph <gjoseph at digium.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20221102/b545a6a6/attachment-0001.html>
More information about the asterisk-code-review
mailing list