[asterisk-commits] mmichelson: branch group/issue8824 r185910 - in /team/group/issue8824: ./ cha...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Apr 1 14:41:52 CDT 2009
Author: mmichelson
Date: Wed Apr 1 14:41:49 2009
New Revision: 185910
URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=185910
Log:
Conflict: resolved.
Automerge: reset.
Modified:
team/group/issue8824/ (props changed)
team/group/issue8824/channels/chan_sip.c
Propchange: team/group/issue8824/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.
Propchange: team/group/issue8824/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Wed Apr 1 14:41:49 2009
@@ -1,1 +1,1 @@
-/trunk:1-185806
+/trunk:1-185889
Modified: team/group/issue8824/channels/chan_sip.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/issue8824/channels/chan_sip.c?view=diff&rev=185910&r1=185909&r2=185910
==============================================================================
--- team/group/issue8824/channels/chan_sip.c (original)
+++ team/group/issue8824/channels/chan_sip.c Wed Apr 1 14:41:49 2009
@@ -1723,17 +1723,19 @@
struct ast_channel *owner; /*!< Who owns us (if we have an owner) */
struct sip_route *route; /*!< Head of linked list of routing steps (fm Record-Route) */
int route_persistant; /*!< Is this the "real" route? */
- struct ast_variable *notify_headers; /*!< Custom notify type */
+ struct ast_variable *notify_headers; /*!< Custom notify type */
struct sip_auth *peerauth; /*!< Realm authentication */
int noncecount; /*!< Nonce-count */
char lastmsg[256]; /*!< Last Message sent/received */
int amaflags; /*!< AMA Flags */
int pendinginvite; /*!< Any pending INVITE or state NOTIFY (in subscribe pvt's) ? (seqno of this) */
+ int glareinvite; /*!< A invite received while a pending invite is already present is stored here. Its seqno is the
+ value. Since this glare invite's seqno is not the same as the pending invite's, it must be
+ held in order to properly process acknowledgements for our 491 response. */
struct sip_request initreq; /*!< Latest request that opened a new transaction
within this dialog.
- NOT the request that opened the dialog
- */
-
+ NOT the request that opened the dialog */
+
int initid; /*!< Auto-congest ID if appropriate (scheduler) */
int waitid; /*!< Wait ID for scheduler after 491 or other delays */
int autokillid; /*!< Auto-kill ID (scheduler) */
@@ -1744,9 +1746,9 @@
int stateid; /*!< SUBSCRIBE: ID for devicestate subscriptions */
int laststate; /*!< SUBSCRIBE: Last known extension state */
int dialogver; /*!< SUBSCRIBE: Version for subscription dialog-info */
-
+
struct ast_dsp *vad; /*!< Inband DTMF Detection dsp */
-
+
struct sip_peer *relatedpeer; /*!< If this dialog is related to a peer, which one
Used in peerpoke, mwi subscriptions */
struct sip_registry *registry; /*!< If this is a REGISTER dialog, to which registry */
@@ -16977,12 +16979,15 @@
to avoid race conditions between asterisk servers.
Called from the scheduler.
*/
-static int sip_reinvite_retry(const void *data)
+static int sip_reinvite_retry(const void *data)
{
struct sip_pvt *p = (struct sip_pvt *) data;
- ast_set_flag(&p->flags[0], SIP_NEEDREINVITE);
+ sip_pvt_lock(p); /* called from schedule thread which requires a lock */
+ ast_set_flag(&p->flags[0], SIP_NEEDREINVITE);
p->waitid = -1;
+ check_pendings(p);
+ sip_pvt_unlock(p);
dialog_unref(p, "unref the dialog ptr from sip_reinvite_retry, because it held a dialog ptr");
return 0;
}
@@ -17317,8 +17322,15 @@
/* This is a re-invite that failed. */
/* Reset the flag after a while
*/
- int wait = 3 + ast_random() % 5;
- p->waitid = ast_sched_add(sched, wait, sip_reinvite_retry, dialog_ref(p, "passing dialog ptr into sched structure based on waitid for sip_reinvite_retry."));
+ int wait;
+ /* RFC 3261, if owner of call, wait between 2.1 to 4 seconds,
+ * if not owner of call, wait 0 to 2 seconds */
+ if (p->outgoing_call) {
+ wait = 2100 + ast_random() % 2000;
+ } else {
+ wait = ast_random() % 2000;
+ }
+ p->waitid = ast_sched_add(sched, wait, sip_reinvite_retry, dialog_ref(p, "passing dialog ptr into sched structure based on waitid for sip_reinvite_retry."));
ast_log(LOG_WARNING, "just did sched_add waitid(%d) for sip_reinvite_retry for dialog %s in handle_response_invite\n", p->waitid, p->callid);
ast_debug(2, "Reinvite race. Waiting %d secs before retry\n", wait);
}
@@ -19198,9 +19210,10 @@
return transmit_invite(p, SIP_INVITE, 1, 3);
}
}
-
+
if (!req->ignore && p->pendinginvite) {
/* We already have a pending invite. Sorry. You are on hold. */
+ p->glareinvite = seqno; /* must hold on to this seqno to process ack and retransmit correctly */
transmit_response_reliable(p, "491 Request Pending", req);
ast_debug(1, "Got INVITE on call where we already have pending INVITE, deferring that - %s\n", p->callid);
/* Don't destroy dialog here */
@@ -21131,8 +21144,12 @@
if (find_sdp(req)) {
if (process_sdp(p, req, SDP_T38_NONE))
return -1;
- }
+ }
check_pendings(p);
+ } else if (p->glareinvite == seqno) {
+ /* handle ack for the 491 pending sent for glareinvite */
+ p->glareinvite = 0;
+ __sip_ack(p, seqno, 1, 0);
}
/* Got an ACK that we did not match. Ignore silently */
if (!p->lastinvite && ast_strlen_zero(p->randdata)) {
More information about the asterisk-commits
mailing list