aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2009-04-09 20:09:13 +0000
committermmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b>2009-04-09 20:09:13 +0000
commit7a35329a750745b59ba5d44a3e47e91d2b35392a (patch)
tree420f6922dee95086a3018b7ade347bf5268c3ca7
parentf95bcd872620e8357422e6199da4ad98777d11e9 (diff)
Merged revisions 141810,141868 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk ................ r141810 | mmichelson | 2008-09-08 16:18:49 -0500 (Mon, 08 Sep 2008) | 22 lines Merged revisions 141809 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r141809 | mmichelson | 2008-09-08 16:10:10 -0500 (Mon, 08 Sep 2008) | 14 lines Fix pedantic mode of chan_sip to only check the remote tag of an endpoint once a dialog has been confirmed. Up until that point, it is possible and legal for the far-end to send provisional responses with a different To: tag each time. With this patch applied, these provisional messages will not cause a matching problem. (closes issue #11536) Reported by: ibc Patches: 11536v2.patch uploaded by putnopvut (license 60) ........ ................ r141868 | mmichelson | 2008-09-08 17:14:40 -0500 (Mon, 08 Sep 2008) | 4 lines Um, apparently I didn't actually finish merging before committing. Bad bad bad ................ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.0@187554 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r--channels/chan_sip.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 6d1949190..59db02f5a 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -993,6 +993,7 @@ struct sip_auth {
#define SIP_PAGE2_RFC2833_COMPENSATE (1 << 25) /*!< DP: Compensate for buggy RFC2833 implementations */
#define SIP_PAGE2_BUGGY_MWI (1 << 26) /*!< DP: Buggy CISCO MWI fix */
+#define SIP_PAGE2_DIALOG_ESTABLISHED (1 << 27) /*!< 29: Has a dialog been established? */
#define SIP_PAGE2_REGISTERTRYING (1 << 29) /*!< DP: Send 100 Trying on REGISTER attempts */
#define SIP_PAGE2_UDPTL_DESTINATION (1 << 30) /*!< DP: Use source IP of RTP as destination if NAT is enabled */
@@ -5081,6 +5082,7 @@ static int sip_answer(struct ast_channel *ast)
change_t38_state(p, T38_ENABLED);
}
ast_rtp_new_source(p->rtp);
+ ast_set_flag(&p->flags[1], SIP_PAGE2_DIALOG_ESTABLISHED);
res = transmit_response_with_sdp(p, "200 OK", &p->initreq, XMIT_CRITICAL, FALSE);
}
sip_pvt_unlock(p);
@@ -6138,7 +6140,7 @@ restartsearch:
found = (!strcmp(p->callid, callid));
else
found = (!strcmp(p->callid, callid) &&
- (!pedanticsipchecking || ast_strlen_zero(tag) || ast_strlen_zero(p->theirtag) || !strcmp(p->theirtag, tag))) ;
+ (!pedanticsipchecking || ast_strlen_zero(tag) || ast_strlen_zero(p->theirtag) || !ast_test_flag(&p->flags[1], SIP_PAGE2_DIALOG_ESTABLISHED) || !strcmp(p->theirtag, tag))) ;
ast_debug(5, "= %s Their Call ID: %s Their Tag %s Our tag: %s\n", found ? "Found" : "No match", p->callid, p->theirtag, p->tag);
@@ -15222,6 +15224,7 @@ static void handle_response_invite(struct sip_pvt *p, int resp, char *rest, stru
/* If I understand this right, the branch is different for a non-200 ACK only */
p->invitestate = INV_TERMINATED;
+ ast_set_flag(&p->flags[1], SIP_PAGE2_DIALOG_ESTABLISHED);
xmitres = transmit_request(p, SIP_ACK, seqno, XMIT_UNRELIABLE, TRUE);
check_pendings(p);
break;
@@ -15724,8 +15727,12 @@ static void handle_response(struct sip_pvt *p, int resp, char *rest, struct sip_
}
} else if (sipmethod == SIP_REGISTER)
res = handle_response_register(p, resp, rest, req, seqno);
- else if (sipmethod == SIP_BYE) /* Ok, we're ready to go */
+ else if (sipmethod == SIP_BYE) { /* Ok, we're ready to go */
p->needdestroy = 1;
+ ast_clear_flag(&p->flags[1], SIP_PAGE2_DIALOG_ESTABLISHED);
+ } else if (sipmethod == SIP_SUBSCRIBE) {
+ ast_set_flag(&p->flags[1], SIP_PAGE2_DIALOG_ESTABLISHED);
+ }
break;
case 202: /* Transfer accepted */
if (sipmethod == SIP_REFER)
@@ -17528,9 +17535,11 @@ static int handle_request_invite(struct sip_pvt *p, struct sip_request *req, int
if (p->t38.state == T38_PEER_REINVITE) {
p->t38id = ast_sched_add(sched, 5000, sip_t38_abort, p);
} else if (p->t38.state == T38_ENABLED) {
+ ast_set_flag(&p->flags[1], SIP_PAGE2_DIALOG_ESTABLISHED);
transmit_response_with_t38_sdp(p, "200 OK", req, (reinvite ? XMIT_RELIABLE : (req->ignore ? XMIT_UNRELIABLE : XMIT_CRITICAL)));
} else if (p->t38.state == T38_DISABLED) {
/* If this is not a re-invite or something to ignore - it's critical */
+ ast_set_flag(&p->flags[1], SIP_PAGE2_DIALOG_ESTABLISHED);
transmit_response_with_sdp(p, "200 OK", req, (reinvite ? XMIT_RELIABLE : (req->ignore ? XMIT_UNRELIABLE : XMIT_CRITICAL)), p->session_modify == TRUE ? FALSE:TRUE);
}
@@ -18210,6 +18219,7 @@ static int handle_request_bye(struct sip_pvt *p, struct sip_request *req)
sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT);
ast_debug(3, "Received bye, no owner, selfdestruct soon.\n");
}
+ ast_clear_flag(&p->flags[1], SIP_PAGE2_DIALOG_ESTABLISHED);
transmit_response(p, "200 OK", req);
return 1;
@@ -18483,6 +18493,7 @@ static int handle_request_subscribe(struct sip_pvt *p, struct sip_request *req,
sip_scheddestroy(p, (p->expiry + 10) * 1000); /* Set timer for destruction of call at expiration */
if (p->subscribed == MWI_NOTIFICATION) {
+ ast_set_flag(&p->flags[1], SIP_PAGE2_DIALOG_ESTABLISHED);
transmit_response(p, "200 OK", req);
if (p->relatedpeer) { /* Send first notification */
ASTOBJ_WRLOCK(p->relatedpeer);
@@ -18499,7 +18510,7 @@ static int handle_request_subscribe(struct sip_pvt *p, struct sip_request *req,
p->needdestroy = 1;
return 0;
}
-
+ ast_set_flag(&p->flags[1], SIP_PAGE2_DIALOG_ESTABLISHED);
transmit_response(p, "200 OK", req);
transmit_state_notify(p, firststate, 1, FALSE); /* Send first notification */
append_history(p, "Subscribestatus", "%s", ast_extension_state2str(firststate));