[Home]

Summary:ASTERISK-27999: Wrong SRTP use status report
Reporter:Salah Ahmed (rubel)Labels:patch pjsip
Date Opened:2018-07-30 14:32:04Date Closed:2018-08-06 08:35:38
Priority:MinorRegression?
Status:Closed/CompleteComponents:Channels/chan_pjsip
Versions:13.19.2 Frequency of
Occurrence
Constant
Related
Issues:
Environment:Attachments:( 0) srtp_status.patch
Description:Hello,

In a case while a pjsip channel make a SRTP request to an endpoint and it respond with non srtp sdp, call was continued with non srtp mode but following dialplan function report srtp is on.

channel(rtp,secure,audio)

We have made a quick review on dialplan codes and found,

File:  channels/pjsip/dialplan_functions.c
Method: channel_read_rtp
Line 533: snprintf(buf, buflen, "%d", media->srtp ? 1 : 0);

srtp status is reported only by checking an object initialization. I think if an endpoint unable to respond with srtp that object might not destroyed. Now can we use any flag to determine this status?

Thanks,
Salah Ahmed
Comments:By: Asterisk Team (asteriskteam) 2018-07-30 14:32:06.132-0500

Thanks for creating a report! The issue has entered the triage process. That means the issue will wait in this status until a Bug Marshal has an opportunity to review the issue. Once the issue has been reviewed you will receive comments regarding the next steps towards resolution.

A good first step is for you to review the [Asterisk Issue Guidelines|https://wiki.asterisk.org/wiki/display/AST/Asterisk+Issue+Guidelines] if you haven't already. The guidelines detail what is expected from an Asterisk issue report.

Then, if you are submitting a patch, please review the [Patch Contribution Process|https://wiki.asterisk.org/wiki/display/AST/Patch+Contribution+Process].

By: Richard Mudgett (rmudgett) 2018-07-31 17:14:48.021-0500

It looks like the AST_SRTP_CRYPTO_OFFER_OK flag in the media->srtp is what you want.  Will you be creating a patch?

By: Salah Ahmed (rubel) 2018-08-01 12:35:13.858-0500

Hi,

Here I have attached a patch. This is work in my environment. Please let me know is this process is correct.

Thanks,
Salah Ahmed


By: Richard Mudgett (rmudgett) 2018-08-01 12:38:43.400-0500

I think you will have to reattach the patch after you have signed the license agreement.  Otherwise it won't show up.  There is also a link in the first comment above about the patch contribution process.

By: Salah Ahmed (rubel) 2018-08-02 10:23:17.635-0500

Now the patch showed up. could you please have a look on it.

By: Richard Mudgett (rmudgett) 2018-08-02 10:39:11.385-0500

It is easier to review patches when they are up on Gerrit.  That is its purpose.  *All* patches have to go there to get merged into Asterisk.  If you don't put it there then you are leaving it to someone else with an interest in the patch to do it.

Since the patch is so small I can comment here.  Although, you really should put it up on Gerrit.
* The first change block can easily be expressed: {{snprintf(buf, buflen, "%d", (media->srtp && ast_test_flag(media->srtp, AST_SRTP_CRYPTO_OFFER_OK)) ? 1 : 0);}}
* I don't understand why the second block is deleting the line setting the AST_SRTP_CRYPTO_OFFER_OK line.

By: Salah Ahmed (rubel) 2018-08-02 15:01:21.610-0500

I have submitted the patch to Gerrit,
In 2nd block, if remote_key is same on sdp return then that flag AST_SRTP_CRYPTO_OFFER_OK has being set and return from that method without further processing. So if endpoint reply with non srtp then also this flag has being set. Thats why I assume as we set that flag at receiving successful srtp response and if we don't set it while we receive same remote_key or non SRTP SDP response then we can take decision on that flag.

By: Friendly Automation (friendly-automation) 2018-08-06 08:35:39.989-0500

Change 9807 merged by Joshua Colp:
dialplan_functions: wrong srtp use status report of a dialplan function

[https://gerrit.asterisk.org/9807|https://gerrit.asterisk.org/9807]

By: Friendly Automation (friendly-automation) 2018-08-06 08:35:46.068-0500

Change 9814 merged by Joshua Colp:
dialplan_functions: wrong srtp use status report of a dialplan function

[https://gerrit.asterisk.org/9814|https://gerrit.asterisk.org/9814]

By: Friendly Automation (friendly-automation) 2018-08-06 08:35:51.709-0500

Change 9813 merged by Joshua Colp:
dialplan_functions: wrong srtp use status report of a dialplan function

[https://gerrit.asterisk.org/9813|https://gerrit.asterisk.org/9813]

By: Friendly Automation (friendly-automation) 2018-08-06 08:35:58.262-0500

Change 9812 merged by Joshua Colp:
dialplan_functions: wrong srtp use status report of a dialplan function

[https://gerrit.asterisk.org/9812|https://gerrit.asterisk.org/9812]