<p>Joshua Colp <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/6089">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  Richard Mudgett: Looks good to me, but someone else must approve
  Matthew Fredrickson: Looks good to me, approved
  Joshua Colp: Approved for Submit

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">res_rtp_asterisk: Fix mapping of pjsip's ICE roles to ours<br><br>Change-Id: Ia578ede1a55b21014581793992a429441903278b<br>---<br>M res/res_rtp_asterisk.c<br>1 file changed, 35 insertions(+), 3 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/res/res_rtp_asterisk.c b/res/res_rtp_asterisk.c<br>index e521756..a93bb77 100644<br>--- a/res/res_rtp_asterisk.c<br>+++ b/res/res_rtp_asterisk.c<br>@@ -678,6 +678,37 @@<br>  }<br> }<br> <br>+static void ast2pj_rtp_ice_role(enum ast_rtp_ice_role ast_role, enum pj_ice_sess_role *pj_role)<br>+{<br>+       switch (ast_role) {<br>+  case AST_RTP_ICE_ROLE_CONTROLLED:<br>+            *pj_role = PJ_ICE_SESS_ROLE_CONTROLLED;<br>+              break;<br>+       case AST_RTP_ICE_ROLE_CONTROLLING:<br>+           *pj_role = PJ_ICE_SESS_ROLE_CONTROLLING;<br>+             break;<br>+       }<br>+}<br>+<br>+static void pj2ast_rtp_ice_role(enum pj_ice_sess_role pj_role, enum ast_rtp_ice_role *ast_role)<br>+{<br>+       switch (pj_role) {<br>+   case PJ_ICE_SESS_ROLE_CONTROLLED:<br>+            *ast_role = AST_RTP_ICE_ROLE_CONTROLLED;<br>+             return;<br>+      case PJ_ICE_SESS_ROLE_CONTROLLING:<br>+           *ast_role = AST_RTP_ICE_ROLE_CONTROLLING;<br>+            return;<br>+      case PJ_ICE_SESS_ROLE_UNKNOWN:<br>+               /* Don't change anything */<br>+              return;<br>+      default:<br>+             /* If we aren't explicitly handling something, it's a bug */<br>+         ast_assert(0);<br>+               return;<br>+      }<br>+}<br>+<br> /*! \pre instance is locked */<br> static int ice_reset_session(struct ast_rtp_instance *instance)<br> {<br>@@ -694,8 +725,9 @@<br>  res = ice_create(instance, &rtp->ice_original_rtp_addr, rtp->ice_port, 1);<br>  if (!res) {<br>           /* Use the current expected role for the ICE session */<br>-              pj_ice_sess_change_role(rtp->ice->real_ice, rtp->role == AST_RTP_ICE_ROLE_CONTROLLED ?<br>-                      PJ_ICE_SESS_ROLE_CONTROLLED : PJ_ICE_SESS_ROLE_CONTROLLING);<br>+         enum pj_ice_sess_role role = PJ_ICE_SESS_ROLE_UNKNOWN;<br>+               ast2pj_rtp_ice_role(rtp->role, &role);<br>+                pj_ice_sess_change_role(rtp->ice->real_ice, role);<br>      }<br> <br>  /* If we only have one component now, and we previously set up TURN for RTCP,<br>@@ -767,7 +799,7 @@<br>            ao2_cleanup(rtp->ice_proposed_remote_candidates);<br>          rtp->ice_proposed_remote_candidates = NULL;<br>                /* If this ICE session is being preserved then go back to the role it currently is */<br>-                rtp->role = rtp->ice->real_ice->role;<br>+            pj2ast_rtp_ice_role(rtp->ice->real_ice->role, &rtp->role);<br>            return;<br>       }<br> <br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/6089">change 6089</a>. To unsubscribe, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/6089"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 13 </div>
<div style="display:none"> Gerrit-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: Ia578ede1a55b21014581793992a429441903278b </div>
<div style="display:none"> Gerrit-Change-Number: 6089 </div>
<div style="display:none"> Gerrit-PatchSet: 7 </div>
<div style="display:none"> Gerrit-Owner: Sean Bright <sean.bright@gmail.com> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins2 </div>
<div style="display:none"> Gerrit-Reviewer: Joshua Colp <jcolp@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Matthew Fredrickson <creslin@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Richard Mudgett <rmudgett@digium.com> </div>