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
f29ddd89
Commit
f29ddd89
authored
5 years ago
by
Friendly Automation
Committed by
Gerrit Code Review
5 years ago
Browse files
Options
Downloads
Plain Diff
Merge "chan_sip: Always process updated SDP on media source change"
parents
313189aa
711a3fed
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
channels/chan_sip.c
+45
-17
45 additions, 17 deletions
channels/chan_sip.c
channels/sip/include/sip.h
+1
-0
1 addition, 0 deletions
channels/sip/include/sip.h
with
46 additions
and
17 deletions
channels/chan_sip.c
+
45
−
17
View file @
f29ddd89
...
...
@@ -11249,9 +11249,12 @@ process_sdp_cleanup:
static int process_sdp_o(const char *o, struct sip_pvt *p)
{
const char *o_copy_start;
char *o_copy;
char *token;
int64_t rua_version;
int offset;
int64_t sess_version;
char unique[128];
/* Store the SDP version number of remote UA. This will allow us to
distinguish between session modifications and session refreshes. If
...
...
@@ -11269,35 +11272,49 @@ static int process_sdp_o(const char *o, struct sip_pvt *p)
return FALSE;
}
o_copy = ast_strdupa(o);
token = strsep(&o_copy, " "); /* Skip username */
/* o=<username> <sess-id> <sess-version> <nettype> <addrtype>
<unicast-address> */
o_copy_start = o_copy = ast_strdupa(o);
token = strsep(&o_copy, " "); /* Skip username */
if (!o_copy) {
ast_log(LOG_WARNING, "SDP syntax error in o= line username\n");
return FALSE;
}
token = strsep(&o_copy, " "); /*
Skip
sess
ion
-id */
token = strsep(&o_copy, " "); /* sess-id */
if (!o_copy) {
ast_log(LOG_WARNING, "SDP syntax error in o= line sess
ion
-id\n");
ast_log(LOG_WARNING, "SDP syntax error in o= line sess-id\n");
return FALSE;
}
token = strsep(&o_copy, " "); /*
Version
*/
if (!o_copy) {
ast_log(LOG_WARNING, "SDP syntax error in o= line\n");
token = strsep(&o_copy, " "); /*
sess-version
*/
if (!o_copy
|| !sscanf(token, "%30" SCNd64, &sess_version)
) {
ast_log(LOG_WARNING, "SDP syntax error in o= line
sess-version
\n");
return FALSE;
}
if (!sscanf(token, "%30" SCNd64, &rua_version)) {
ast_log(LOG_WARNING, "SDP syntax error in o= line version\n");
return FALSE;
/* Copy all after sess-version on top of sess-version into unique.
* <sess-id> is a numeric string such that the tuple of <username>,
* <sess-id>, <nettype>, <addrtype>, and <unicast-address> forms a
* globally unique identifier for the session.
* I.e. all except the <sess-version> */
ast_copy_string(unique, o, sizeof(unique)); /* copy all of o= contents */
offset = (o_copy - o_copy_start); /* after sess-version */
if (offset < sizeof(unique)) {
/* copy all after sess-version on top of sess-version */
int sess_version_start = token - o_copy_start;
ast_copy_string(unique + sess_version_start, o + offset, sizeof(unique) - sess_version_start);
}
/*
w
e need to check the SDP version number the other end sent us;
/*
W
e need to check the SDP version number the other end sent us;
* our rules for deciding what to accept are a bit complex.
*
* 1) if 'ignoresdpversion' has been set for this dialog, then
* we will just accept whatever they sent and assume it is
* a modification of the session, even if it is not
* 2) otherwise, if this is the first SDP we've seen from them
* we accept it
* we accept it;
* note that _them_ may change, in which case the
* sessionunique_remote will be different
* 3) otherwise, if the new SDP version number is higher than the
* old one, we accept it
* 4) otherwise, if this SDP is in response to us requesting a switch
...
...
@@ -11307,14 +11324,25 @@ static int process_sdp_o(const char *o, struct sip_pvt *p)
* not request a switch to T.38, then we stop parsing the SDP, as it
* has not changed from the previous version
*/
if (sip_debug_test_pvt(p)) {
if (ast_strlen_zero(p->sessionunique_remote)) {
ast_verbose("Got SDP version %" PRId64 " and unique parts [%s]\n",
sess_version, unique);
} else {
ast_verbose("Comparing SDP version %" PRId64 " -> %" PRId64 " and unique parts [%s] -> [%s]\n",
p->sessionversion_remote, sess_version, p->sessionunique_remote, unique);
}
}
if (ast_test_flag(&p->flags[1], SIP_PAGE2_IGNORESDPVERSION) ||
(p->sessionversion_remote < 0) ||
(p->sessionversion_remote < rua_version)) {
p->sessionversion_remote = rua_version;
sess_version > p->sessionversion_remote ||
strcmp(unique, S_OR(p->sessionunique_remote, ""))) {
p->sessionversion_remote = sess_version;
ast_string_field_set(p, sessionunique_remote, unique);
} else {
if (p->t38.state == T38_LOCAL_REINVITE) {
p->sessionversion_remote = rua_version;
p->sessionversion_remote = sess_version;
ast_string_field_set(p, sessionunique_remote, unique);
ast_log(LOG_WARNING, "Call %s responded to our T.38 reinvite without changing SDP version; 'ignoresdpversion' should be set for this peer.\n", p->callid);
} else {
p->session_modify = FALSE;
This diff is collapsed.
Click to expand it.
channels/sip/include/sip.h
+
1
−
0
View file @
f29ddd89
...
...
@@ -1052,6 +1052,7 @@ struct sip_pvt {
AST_STRING_FIELD
(
last_presence_message
);
/*!< The last presence message for a subscription */
AST_STRING_FIELD
(
msg_body
);
/*!< Text for a MESSAGE body */
AST_STRING_FIELD
(
tel_phone_context
);
/*!< The phone-context portion of a TEL URI */
AST_STRING_FIELD
(
sessionunique_remote
);
/*!< Remote UA's SDP Session unique parts */
);
char
via
[
128
];
/*!< Via: header */
int
maxforwards
;
/*!< SIP Loop prevention */
...
...
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