[Asterisk-code-review] dialplan functions: wrong srtp use status report of a dialpl... (asterisk[15])

Joshua Colp asteriskteam at digium.com
Mon Aug 6 08:34:32 CDT 2018


Joshua Colp has submitted this change and it was merged. ( https://gerrit.asterisk.org/9812 )

Change subject: dialplan_functions: wrong srtp use status report of a dialplan function
......................................................................

dialplan_functions: wrong srtp use status report of a dialplan function

If asterisk offer an endpoint with SRTP and that endpoint respond
with non srtp, in that case channel(rtp,secure,audio) reply wrong
status.

Why delete flag AST_SRTP_CRYPTO_OFFER_OK while check identical remote_key:
Currently this flag has being set redundantly. In either case identical
or different remote_key this flag has being set. So if we
don't set it while we receive identical remote_key or non SRTP SDP
response then we can take decision of srtp use by using that flag.

ASTERISK-27999

Change-Id: I29dc2843cf4e5ae2604301cb4ff258f1822dc2d7
---
M channels/pjsip/dialplan_functions.c
M res/res_srtp.c
2 files changed, 7 insertions(+), 2 deletions(-)

Approvals:
  Richard Mudgett: Looks good to me, but someone else must approve
  Joshua Colp: Looks good to me, approved; Approved for Submit



diff --git a/channels/pjsip/dialplan_functions.c b/channels/pjsip/dialplan_functions.c
index ce347dc..d21a80c 100644
--- a/channels/pjsip/dialplan_functions.c
+++ b/channels/pjsip/dialplan_functions.c
@@ -529,7 +529,13 @@
 	} else if (!strcmp(type, "direct")) {
 		ast_copy_string(buf, ast_sockaddr_stringify(&media->direct_media_addr), buflen);
 	} else if (!strcmp(type, "secure")) {
-		snprintf(buf, buflen, "%d", media->srtp ? 1 : 0);
+		if (media->srtp) {
+			struct ast_sdp_srtp *srtp = media->srtp;
+			int flag = ast_test_flag(srtp, AST_SRTP_CRYPTO_OFFER_OK);
+			snprintf(buf, buflen, "%d", flag ? 1 : 0);
+		} else {
+			snprintf(buf, buflen, "%d", 0);
+		}
 	} else if (!strcmp(type, "hold")) {
 		snprintf(buf, buflen, "%d", media->remotely_held ? 1 : 0);
 	} else {
diff --git a/res/res_srtp.c b/res/res_srtp.c
index 7552a7a..97856d0 100644
--- a/res/res_srtp.c
+++ b/res/res_srtp.c
@@ -1015,7 +1015,6 @@
 		}
 	} else if (!memcmp(crypto->remote_key, remote_key, key_len_from_sdp)) {
 		ast_debug(1, "SRTP remote key unchanged; maintaining current policy\n");
-		ast_set_flag(srtp, AST_SRTP_CRYPTO_OFFER_OK);
 		return 0;
 	}
 

-- 
To view, visit https://gerrit.asterisk.org/9812
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 15
Gerrit-MessageType: merged
Gerrit-Change-Id: I29dc2843cf4e5ae2604301cb4ff258f1822dc2d7
Gerrit-Change-Number: 9812
Gerrit-PatchSet: 1
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: Salah Ahmed <txrubel at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20180806/8e3af13c/attachment.html>


More information about the asterisk-code-review mailing list