res_pjsip_session: Add additional checks for delaying session refreshes.

There are certain situations which no checks existed for which need to prevent
session refreshes. This includes sending a session refresh with SDP before SDP
negotiation has completed and sending a session refresh before the dialog itself
has been established. Checks for these have been added.

Additionally COLP related UPDATEs were including SDP when it is not needed.

Review: https://reviewboard.asterisk.org/r/4008/
........

Merged revisions 424056 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@424057 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Joshua Colp
2014-09-27 12:43:36 +00:00
parent 5a77eb3476
commit 19ffbb1e64
2 changed files with 35 additions and 8 deletions

View File

@@ -1081,12 +1081,16 @@ static int update_connected_line_information(void *data)
}
} else {
enum ast_sip_session_refresh_method method = session->endpoint->id.refresh_method;
int generate_new_sdp;
struct ast_party_id connected_id;
if (session->inv_session->invite_tsx && (session->inv_session->options & PJSIP_INV_SUPPORT_UPDATE)) {
method = AST_SIP_SESSION_REFRESH_METHOD_UPDATE;
}
/* Only the INVITE method actually needs SDP, UPDATE can do without */
generate_new_sdp = (method == AST_SIP_SESSION_REFRESH_METHOD_INVITE);
/*
* We can get away with a shallow copy here because we are
* not looking at strings.
@@ -1099,7 +1103,7 @@ static int update_connected_line_information(void *data)
(session->endpoint->id.trust_outbound ||
((connected_id.name.presentation & AST_PRES_RESTRICTION) == AST_PRES_ALLOWED &&
(connected_id.number.presentation & AST_PRES_RESTRICTION) == AST_PRES_ALLOWED))) {
ast_sip_session_refresh(session, NULL, NULL, NULL, method, 1);
ast_sip_session_refresh(session, NULL, NULL, NULL, method, generate_new_sdp);
}
}