[Asterisk-code-review] ASTERISK-24146 (asterisk[11.18])

Eugene Voityuk asteriskteam at digium.com
Mon Jun 22 07:37:54 CDT 2015


Eugene Voityuk has uploaded a new change for review.

  https://gerrit.asterisk.org/678

Change subject: ASTERISK-24146
......................................................................

ASTERISK-24146

Change-Id: Ia4a62a9a0b63cf7282f86b25e16b04151823b14f
---
M channels/chan_sip.c
M res/res_rtp_asterisk.c
2 files changed, 16 insertions(+), 10 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/78/678/1

diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index c40a4c3..00be0ec 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -10510,8 +10510,10 @@
 	/* Setup audio address and port */
 	if (p->rtp) {
 		if (sa && portno > 0) {
-			start_ice(p->rtp, (req->method != SIP_RESPONSE) ? 0 : 1);
-			ast_sockaddr_set_port(sa, portno);
+                        if(req->method == SIP_RESPONSE){
+                                start_ice(p->rtp,(req->method != SIP_RESPONSE) ? 0 : 1);
+                        }
+                        ast_sockaddr_set_port(sa, portno);
 			ast_rtp_instance_set_remote_address(p->rtp, sa);
 			if (debug) {
 				ast_verbose("Peer audio RTP is at port %s\n",
@@ -13256,6 +13258,7 @@
 		if (!doing_directmedia) {
 			if (ast_test_flag(&p->flags[2], SIP_PAGE3_ICE_SUPPORT)) {
 				add_ice_to_sdp(p->rtp, &a_audio);
+				start_ice(p->rtp, 0);
 			}
 
 			add_dtls_to_sdp(p->rtp, &a_audio);
diff --git a/res/res_rtp_asterisk.c b/res/res_rtp_asterisk.c
index 673f940..74ecbf9 100644
--- a/res/res_rtp_asterisk.c
+++ b/res/res_rtp_asterisk.c
@@ -1590,7 +1590,7 @@
 #endif
 
 #ifdef USE_PJPROJECT
-static void ast_rtp_on_ice_complete(pj_ice_sess *ice, pj_status_t status)
+static void ast_rtp_on_ice_complete(pj_ice_sess *ice, pj_ice_strans_op op, pj_status_t status)
 {
 	struct ast_rtp_instance *instance = ice->user_data;
 	struct ast_rtp *rtp = ast_rtp_instance_get_data(instance);
@@ -1607,15 +1607,18 @@
 		if (rtp->rtcp) {
 			update_address_with_ice_candidate(rtp, AST_RTP_ICE_COMPONENT_RTCP, &rtp->rtcp->them);
 		}
-	}
-
 #ifdef HAVE_OPENSSL_SRTP
-	dtls_perform_handshake(instance, &rtp->dtls, 0);
-
-	if (rtp->rtcp) {
-		dtls_perform_handshake(instance, &rtp->rtcp->dtls, 1);
-	}
+                dtls_perform_handshake(instance, &rtp->dtls, 0);
+                if (rtp->rtcp) {
+                        dtls_perform_handshake(instance, &rtp->rtcp->dtls, 1);
+                }
 #endif
+        } else {
+                char errmsg[PJ_ERR_MSG_SIZE];
+                pj_strerror(status, errmsg, sizeof(errmsg));
+                ast_log(LOG_WARNING,"ICE %s failed: %s\n", opname, errmsg);
+        }
+
 
 	if (!strictrtp) {
 		return;

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia4a62a9a0b63cf7282f86b25e16b04151823b14f
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 11.18
Gerrit-Owner: Eugene Voityuk <eugene at thirdlane.com>



More information about the asterisk-code-review mailing list