diff options
author | oej <oej@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-11-15 11:26:22 +0000 |
---|---|---|
committer | oej <oej@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-11-15 11:26:22 +0000 |
commit | 56306307dc27741aa179e959044fa23c4f377907 (patch) | |
tree | 6852d46bc8f6d2a3d7db930a32c4f98fd0357fa8 /channels | |
parent | adcebae8ff098e6fa5aa868beb889a134b347ce1 (diff) |
Don't send re-invites during pending INVITE transactions.
Patch by one47 - thanks!
Closes issue #9305
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@89281 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rw-r--r-- | channels/chan_sip.c | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 39ec4bc9b..9023d0939 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -11854,16 +11854,29 @@ static void check_pendings(struct sip_pvt *p) transmit_request(p, SIP_CANCEL, p->ocseq, XMIT_RELIABLE, FALSE); /* Actually don't destroy us yet, wait for the 487 on our original INVITE, but do set an autodestruct just in case we never get it. */ - else + else { + /* We have a pending outbound invite, don't send someting + new in-transaction */ + if (p->pendinginvite) + return; + + /* Perhaps there is an SD change INVITE outstanding */ transmit_request_with_auth(p, SIP_BYE, 0, XMIT_RELIABLE, TRUE); + } ast_clear_flag(&p->flags[0], SIP_PENDINGBYE); sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT); } else if (ast_test_flag(&p->flags[0], SIP_NEEDREINVITE)) { - if (option_debug) - ast_log(LOG_DEBUG, "Sending pending reinvite on '%s'\n", p->callid); - /* Didn't get to reinvite yet, so do it now */ - transmit_reinvite_with_sdp(p); - ast_clear_flag(&p->flags[0], SIP_NEEDREINVITE); + /* if we can't REINVITE, hold it for later */ + if (p->pendinginvite || p->invitestate == INV_CALLING || p->invitestate == INV_PROCEEDING || p->invitestate == INV_EARLY_MEDIA) { + if (option_debug) + ast_log(LOG_DEBUG, "NOT Sending pending reinvite (yet) on '%s'\n", p->callid); + } else { + if (option_debug) + ast_log(LOG_DEBUG, "Sending pending reinvite on '%s'\n", p->callid); + /* Didn't get to reinvite yet, so do it now */ + transmit_reinvite_with_sdp(p); + ast_clear_flag(&p->flags[0], SIP_NEEDREINVITE); + } } } |