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

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


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


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/91/6091/1

diff --git a/res/res_rtp_asterisk.c b/res/res_rtp_asterisk.c
index a2e63ec..9edcdf9 100644
--- a/res/res_rtp_asterisk.c
+++ b/res/res_rtp_asterisk.c
@@ -768,6 +768,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)
 {
@@ -789,7 +805,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/6091
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 15
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia578ede1a55b21014581793992a429441903278b
Gerrit-Change-Number: 6091
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/adc149cf/attachment.html>


More information about the asterisk-code-review mailing list