Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
asterisk
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Voice
asterisk
Commits
e6cad17d
Commit
e6cad17d
authored
8 years ago
by
Joshua Colp
Committed by
Gerrit Code Review
8 years ago
Browse files
Options
Downloads
Plain Diff
Merge "chan_sip: Don't refuse calls with "optional crypto"; fall back to RTP."
parents
2ff85327
d80b2856
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
channels/chan_sip.c
+24
-5
24 additions, 5 deletions
channels/chan_sip.c
with
24 additions
and
5 deletions
channels/chan_sip.c
+
24
−
5
View file @
e6cad17d
...
@@ -1479,7 +1479,8 @@ static int handle_response_register(struct sip_pvt *p, int resp, const char *res
...
@@ -1479,7 +1479,8 @@ static int handle_response_register(struct sip_pvt *p, int resp, const char *res
static void handle_response(struct sip_pvt *p, int resp, const char *rest, struct sip_request *req, uint32_t seqno);
static void handle_response(struct sip_pvt *p, int resp, const char *rest, struct sip_request *req, uint32_t seqno);
/*------ SRTP Support -------- */
/*------ SRTP Support -------- */
static int process_crypto(struct sip_pvt *p, struct ast_rtp_instance *rtp, struct ast_sdp_srtp **srtp, const char *a);
static int process_crypto(struct sip_pvt *p, struct ast_rtp_instance *rtp, struct ast_sdp_srtp **srtp,
const char *a, int secure_transport);
/*------ T38 Support --------- */
/*------ T38 Support --------- */
static int transmit_response_with_t38_sdp(struct sip_pvt *p, char *msg, struct sip_request *req, int retrans);
static int transmit_response_with_t38_sdp(struct sip_pvt *p, char *msg, struct sip_request *req, int retrans);
...
@@ -10609,7 +10610,7 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action
...
@@ -10609,7 +10610,7 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action
}
}
} else if (process_sdp_a_sendonly(value, &sendonly)) {
} else if (process_sdp_a_sendonly(value, &sendonly)) {
processed = TRUE;
processed = TRUE;
} else if (!processed_crypto && process_crypto(p, p->rtp, &p->srtp, value)) {
} else if (!processed_crypto && process_crypto(p, p->rtp, &p->srtp, value
, secure_audio
)) {
processed_crypto = TRUE;
processed_crypto = TRUE;
processed = TRUE;
processed = TRUE;
} else if (process_sdp_a_audio(value, p, &newaudiortp, &last_rtpmap_codec)) {
} else if (process_sdp_a_audio(value, p, &newaudiortp, &last_rtpmap_codec)) {
...
@@ -10626,7 +10627,7 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action
...
@@ -10626,7 +10627,7 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action
if (p->vsrtp) {
if (p->vsrtp) {
ast_set_flag(p->vsrtp, AST_SRTP_CRYPTO_OFFER_OK);
ast_set_flag(p->vsrtp, AST_SRTP_CRYPTO_OFFER_OK);
}
}
} else if (!processed_crypto && process_crypto(p, p->vrtp, &p->vsrtp, value)) {
} else if (!processed_crypto && process_crypto(p, p->vrtp, &p->vsrtp, value
, secure_video
)) {
processed_crypto = TRUE;
processed_crypto = TRUE;
processed = TRUE;
processed = TRUE;
} else if (process_sdp_a_video(value, p, &newvideortp, &last_rtpmap_codec)) {
} else if (process_sdp_a_video(value, p, &newvideortp, &last_rtpmap_codec)) {
...
@@ -10639,7 +10640,7 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action
...
@@ -10639,7 +10640,7 @@ static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action
processed = TRUE;
processed = TRUE;
} else if (process_sdp_a_text(value, p, &newtextrtp, red_fmtp, &red_num_gen, red_data_pt, &last_rtpmap_codec)) {
} else if (process_sdp_a_text(value, p, &newtextrtp, red_fmtp, &red_num_gen, red_data_pt, &last_rtpmap_codec)) {
processed = TRUE;
processed = TRUE;
} else if (!processed_crypto && process_crypto(p, p->trtp, &p->tsrtp, value)) {
} else if (!processed_crypto && process_crypto(p, p->trtp, &p->tsrtp, value
, 1
)) {
processed_crypto = TRUE;
processed_crypto = TRUE;
processed = TRUE;
processed = TRUE;
}
}
...
@@ -33750,7 +33751,8 @@ static void sip_send_all_mwi_subscriptions(void)
...
@@ -33750,7 +33751,8 @@ static void sip_send_all_mwi_subscriptions(void)
ao2_iterator_destroy(&iter);
ao2_iterator_destroy(&iter);
}
}
static int process_crypto(struct sip_pvt *p, struct ast_rtp_instance *rtp, struct ast_sdp_srtp **srtp, const char *a)
static int process_crypto(struct sip_pvt *p, struct ast_rtp_instance *rtp, struct ast_sdp_srtp **srtp,
const char *a, int secure_transport)
{
{
struct ast_rtp_engine_dtls *dtls;
struct ast_rtp_engine_dtls *dtls;
...
@@ -33766,6 +33768,23 @@ static int process_crypto(struct sip_pvt *p, struct ast_rtp_instance *rtp, struc
...
@@ -33766,6 +33768,23 @@ static int process_crypto(struct sip_pvt *p, struct ast_rtp_instance *rtp, struc
/* skip "crypto:" */
/* skip "crypto:" */
a += strlen("crypto:");
a += strlen("crypto:");
if (!secure_transport) {
/* > The Secure Real-time Transport Protocol (SRTP)
* > [RFC3711] provides security services for RTP media
* > and is signaled by use of secure RTP transport (e.g.,
* > "RTP/SAVP" or "RTP/SAVPF") in an SDP media (m=) line.
* > ...
* > The "crypto" attribute MUST only appear at the SDP
* > media level (not at the session level).
*
* Ergo, we can trust RTP/(S)AVP to be read from the m=
* line before we get here. If it was RTP/AVP, then this
* is SNOM-specific optional SRTP. Ignore it.
*/
ast_log(LOG_WARNING, "Ignoring crypto attribute in SDP because RTP transport is insecure\n");
return FALSE;
}
if (!*srtp) {
if (!*srtp) {
if (ast_test_flag(&p->flags[0], SIP_OUTGOING)) {
if (ast_test_flag(&p->flags[0], SIP_OUTGOING)) {
ast_log(LOG_WARNING, "Ignoring unexpected crypto attribute in SDP answer\n");
ast_log(LOG_WARNING, "Ignoring unexpected crypto attribute in SDP answer\n");
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment