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

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


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


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/90/6090/1

diff --git a/res/res_rtp_asterisk.c b/res/res_rtp_asterisk.c
index ea47423..0bf7acc 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/6090
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 14
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia578ede1a55b21014581793992a429441903278b
Gerrit-Change-Number: 6090
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/b89a5e46/attachment.html>


More information about the asterisk-code-review mailing list