[Asterisk-code-review] res rtp asterisk: Fix mapping of pjsip's ICE roles to ours (asterisk[13])

Sean Bright asteriskteam at digium.com
Tue Jul 25 15:34:31 CDT 2017


Sean Bright has uploaded this change for review. ( https://gerrit.asterisk.org/6089


Change subject: res_rtp_asterisk: Fix mapping of pjsip's ICE roles to ours
......................................................................

res_rtp_asterisk: Fix mapping of pjsip's ICE roles to ours

Change-Id: Ia578ede1a55b21014581793992a429441903278b
---
M res/res_rtp_asterisk.c
1 file changed, 17 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/89/6089/1

diff --git a/res/res_rtp_asterisk.c b/res/res_rtp_asterisk.c
index e521756..a523f86 100644
--- a/res/res_rtp_asterisk.c
+++ b/res/res_rtp_asterisk.c
@@ -746,6 +746,22 @@
 	return 0;
 }
 
+static enum ast_rtp_ice_role pj2ast_rtp_ice_role(enum pj_ice_sess_role role)
+{
+	switch (role) {
+	case PJ_ICE_SESS_ROLE_CONTROLLED:
+		return AST_RTP_ICE_ROLE_CONTROLLED;
+	case PJ_ICE_SESS_ROLE_CONTROLLING:
+		return AST_RTP_ICE_ROLE_CONTROLLING;
+	default:
+		break;
+	}
+
+	/* If we get here, there's a bug elsewhere */
+	assert(0);
+	return 0;
+}
+
 /*! \pre instance is locked */
 static void ast_rtp_ice_start(struct ast_rtp_instance *instance)
 {
@@ -767,7 +783,7 @@
 		ao2_cleanup(rtp->ice_proposed_remote_candidates);
 		rtp->ice_proposed_remote_candidates = NULL;
 		/* If this ICE session is being preserved then go back to the role it currently is */
-		rtp->role = rtp->ice->real_ice->role;
+		rtp->role = pj2ast_rtp_ice_role(rtp->ice->real_ice->role);
 		return;
 	}
 

-- 
To view, visit https://gerrit.asterisk.org/6089
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia578ede1a55b21014581793992a429441903278b
Gerrit-Change-Number: 6089
Gerrit-PatchSet: 1
Gerrit-Owner: Sean Bright <sean.bright at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20170725/e0eed9b7/attachment.html>


More information about the asterisk-code-review mailing list