[asterisk-commits] dvossel: branch dvossel/sip_request_transaction_matching r276551 - /team/dvos...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Jul 14 17:21:03 CDT 2010
Author: dvossel
Date: Wed Jul 14 17:20:59 2010
New Revision: 276551
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=276551
Log:
match request uri of initial request in find_call
Modified:
team/dvossel/sip_request_transaction_matching/channels/chan_sip.c
Modified: team/dvossel/sip_request_transaction_matching/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/sip_request_transaction_matching/channels/chan_sip.c?view=diff&rev=276551&r1=276550&r2=276551
==============================================================================
--- team/dvossel/sip_request_transaction_matching/channels/chan_sip.c (original)
+++ team/dvossel/sip_request_transaction_matching/channels/chan_sip.c Wed Jul 14 17:20:59 2010
@@ -1460,6 +1460,7 @@
static void update_redirecting(struct sip_pvt *p, const void *data, size_t datalen);
static int get_domain(const char *str, char *domain, int len);
static void get_realm(struct sip_pvt *p, const struct sip_request *req);
+static int sip_uri_cmp(const char *input1, const char *input2);
/*-- TCP connection handling ---*/
static void *_sip_tcp_helper_thread(struct sip_pvt *pvt, struct ast_tcptls_session_instance *tcptls_session);
@@ -7207,22 +7208,31 @@
goto not_a_match;
}
- /* If totag is not present to match, and the CSeq is the same as our initial request,
- * go down the path of comparing branch parameters with initial Request to verify whether
- * this is a retransmit or a Forked Request */
+ /* If the totag is not present in the Request, then we must go forward with
+ * attempting to match this Request to this dialog's initial transaction. */
if (ast_strlen_zero(totag) &&
(sip_pvt_ptr->init_icseq == seqno) &&
!ast_strlen_zero(sip_pvt_ptr->initviabranch)) {
char *sent_by, *branch;
-
- /* If the methods are different, then this does not match this dialog. */
- if (sip_pvt_ptr->method != req->method) {
- /* If the methods are not the same, then this is just a mismatch. */
+ const char *initial_rlPart2 = REQ_OFFSET_TO_STR(&sip_pvt_ptr->initreq, rlPart2);
+ const char *this_rlPart2 = REQ_OFFSET_TO_STR(req, rlPart2);
+
+ /* If the methods are different, then this does not match this dialog.
+ * The only time this is not true is when the incoming request is a CANCEL. */
+ if ((sip_pvt_ptr->method != req->method) && (req->method != SIP_CANCEL)) {
+ /* not a match, methods are not the same */
goto not_a_match;
}
- /* Compare this Requests VIA header with our initial Request's top Via header.
- * If they are the same, this is a retransmit and this dialog matches.*/
+ /* If the Request-uris are different, then this is neither a match nor a forked request */
+ if (sip_uri_cmp(initial_rlPart2, this_rlPart2)) {
+ /* not a match, request uris are different */
+ goto not_a_match;
+ }
+
+ /* At this point check to see if this is a Forked Request by comparing VIA headers.
+ * If they are the same, this is a retransmit and this dialog matches, otherwise we have
+ * a forked request. */
get_viabranch(ast_strdupa(get_header(req, "Via")), &sent_by, &branch);
if (ast_strlen_zero(branch) ||
strcmp(branch, sip_pvt_ptr->initviabranch) ||
@@ -7234,6 +7244,7 @@
/* FORK DETECTION CRITERIA
*
* ---Current Matches to Initial Request---
+ * request uri
* Call-id
* their-tag
* no totag present
More information about the asterisk-commits
mailing list