summaryrefslogtreecommitdiff
path: root/res/res_pjsip_diversion.c
diff options
context:
space:
mode:
authorMark Michelson <mmichelson@digium.com>2014-09-02 20:29:58 +0000
committerMark Michelson <mmichelson@digium.com>2014-09-02 20:29:58 +0000
commit1b64f353f1cfb98671e95726160987bd69a2f3ae (patch)
tree5d1660e40482d1f0ed8d0695e2824db57f8e74f9 /res/res_pjsip_diversion.c
parent897cbf6a4f4123a3c7462da2b373e96d784b02be (diff)
Resolve race condition where channels enter dialplan application before media has been negotiated.
Testsuite tests will occasionally fail because on reception of a 200 OK SIP response, an AST_CONTROL_ANSWER frame is queued prior to when media has finished being negotiated. This is because session supplements are called into before PJSIP's inv_session code has told us that media has been updated. Sometimes the queued answer frame is handled by the PBX thread before the ensuing media negotiations occur, causing a test failure. As it turns out, there is another place that session supplements could be called into, which is after media has finished getting negotiated. What this commit introduces is a means for session supplements to indicate when they wish to be called into when handling an incoming SIP response. By default, all session supplements will be run at the same point that they were prior to this commit. However, session supplements may indicate that they wish to be handled earlier than normal on redirects, or they may indicate they wish to be handled after media has been negotiated. In this changeset, two session supplements have been updated to indicate a preference for when they should be run: res_pjsip_diversion executes before handling redirection in order to get information from the Diversion header, and chan_pjsip now handles responses to INVITEs after media negotiation to fix the race condition mentioned previously. ASTERISK-24212 #close Reported by Matt Jordan Review: https://reviewboard.asterisk.org/r/3930 ........ Merged revisions 422536 from http://svn.asterisk.org/svn/asterisk/branches/12 ........ Merged revisions 422542 from http://svn.asterisk.org/svn/asterisk/branches/13 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@422543 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/res_pjsip_diversion.c')
-rw-r--r--res/res_pjsip_diversion.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/res/res_pjsip_diversion.c b/res/res_pjsip_diversion.c
index a27b07571..f8aca35f6 100644
--- a/res/res_pjsip_diversion.c
+++ b/res/res_pjsip_diversion.c
@@ -325,6 +325,7 @@ static struct ast_sip_session_supplement diversion_supplement = {
.incoming_response = diversion_incoming_response,
.outgoing_request = diversion_outgoing_request,
.outgoing_response = diversion_outgoing_response,
+ .response_priority = AST_SIP_SESSION_BEFORE_REDIRECTING,
};
static int load_module(void)