[Asterisk-code-review] res pjsip sdp rtp: Control endpoints media address use per c... (asterisk[13])

Salah Ahmed asteriskteam at digium.com
Thu Oct 4 10:39:26 CDT 2018


Salah Ahmed has uploaded this change for review. ( https://gerrit.asterisk.org/10431


Change subject: res_pjsip_sdp_rtp: Control endpoints media_address use per call basis
......................................................................

res_pjsip_sdp_rtp: Control endpoints media_address use per call basis

If we set media_address on an endpoint then all call on this endpoint
use that media address. Now by this changes, we can control
media_address use per call basis with a channel variable called
USE_MEDIA_ADDRESS. This channel variable has those following
effects.

USE_MEDIA_ADDRESS = "yes"
then pre-defined media address on endpoint will be used for
this call.

USE_MEDIA_ADDRESS = "no"
the behavior will be exactly the same as if we don't define
media_address.

USE_MEDIA_ADDRESS = NULL (Not Defined)
Then it has no effect, it works exactly the same as the original
configuration.

ASTERISK-28091

Change-Id: I852adbee9f8b034ec332fbe4e1b6692cb2939518
---
M res/res_pjsip_sdp_rtp.c
1 file changed, 9 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/31/10431/1

diff --git a/res/res_pjsip_sdp_rtp.c b/res/res_pjsip_sdp_rtp.c
index 7c7040e..b7360c7 100644
--- a/res/res_pjsip_sdp_rtp.c
+++ b/res/res_pjsip_sdp_rtp.c
@@ -1245,7 +1245,15 @@
 	} else if (ast_strlen_zero(session->endpoint->media.address)) {
 		hostip = ast_sip_get_host_ip_string(session->endpoint->media.rtp.ipv6 ? pj_AF_INET6() : pj_AF_INET());
 	} else {
-		hostip = session->endpoint->media.address;
+		if(!ast_strlen_zero(pbx_builtin_getvar_helper(session->channel, "USE_MEDIA_ADDRESS"))) {
+			if(strcmp("yes", pbx_builtin_getvar_helper( session->channel, "USE_MEDIA_ADDRESS")) == 0) {
+				hostip = session->endpoint->media.address;
+			} else {
+				hostip = ast_sip_get_host_ip_string(session->endpoint->media.rtp.ipv6 ? pj_AF_INET6() : pj_AF_INET());
+			}
+		} else {
+			hostip = session->endpoint->media.address;
+		}
 	}
 
 	if (ast_strlen_zero(hostip)) {

-- 
To view, visit https://gerrit.asterisk.org/10431
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: I852adbee9f8b034ec332fbe4e1b6692cb2939518
Gerrit-Change-Number: 10431
Gerrit-PatchSet: 1
Gerrit-Owner: Salah Ahmed <txrubel at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20181004/09a47069/attachment.html>


More information about the asterisk-code-review mailing list