From b6670e24406ada59147c22a79cc3af545ce8f0f8 Mon Sep 17 00:00:00 2001 From: George Joseph Date: Wed, 2 Nov 2022 06:41:29 -0600 Subject: [PATCH] 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 made 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. ASTERISK-30281 Change-Id: I872ac49477100f4eb33891d46efc6ca21ec81aa4 --- channels/chan_rtp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/channels/chan_rtp.c b/channels/chan_rtp.c index 087ddaed32..0740c2c6a1 100644 --- a/channels/chan_rtp.c +++ b/channels/chan_rtp.c @@ -381,9 +381,9 @@ static struct ast_channel *unicast_rtp_request(const char *type, struct ast_form 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));