diff options
author | mmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-08-27 20:13:40 +0000 |
---|---|---|
committer | mmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-08-27 20:13:40 +0000 |
commit | 52fad2423dca2f171407efc7936820dc12dcea0d (patch) | |
tree | 16a7e7d74843d07bbc21d6a565c247750290ab14 /channels | |
parent | 82cc2157b766bc0e549d937964e75f14459483df (diff) |
Merged revisions 140301 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
................
r140301 | mmichelson | 2008-08-27 15:11:22 -0500 (Wed, 27 Aug 2008) | 19 lines
Merged revisions 140299 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r140299 | mmichelson | 2008-08-27 14:49:20 -0500 (Wed, 27 Aug 2008) | 11 lines
Fix tag checking in get_sip_pvt_byid_locked when
in pedantic mode. The problem was that the wrong
tags would be compared depending on the direction
of the call.
(closes issue #13353)
Reported by: flefoll
Patches:
chan_sip.c.br14.139015.patch-refer-pedantic uploaded by flefoll (license 244)
........
................
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.0@140302 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rw-r--r-- | channels/chan_sip.c | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c index d10bc5a00..d474ec297 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -10794,17 +10794,13 @@ static int get_destination(struct sip_pvt *p, struct sip_request *oreq) return -1; } -/*! \brief Lock dialog lock and find matching pvt lock - - Their tag is fromtag, our tag is to-tag - - This means that in some transactions, totag needs to be their tag :-) - depending upon the direction +/*! \brief Lock dialog lock and find matching pvt lock Returns a reference, remember to release it when done XXX */ static struct sip_pvt *get_sip_pvt_byid_locked(const char *callid, const char *totag, const char *fromtag) { struct sip_pvt *sip_pvt_ptr; - if (totag) ast_debug(4, "Looking for callid %s (fromtag %s totag %s)\n", callid, fromtag ? fromtag : "<no fromtag>", totag ? totag : "<no totag>"); @@ -10813,7 +10809,6 @@ static struct sip_pvt *get_sip_pvt_byid_locked(const char *callid, const char *t for (sip_pvt_ptr = dialoglist; sip_pvt_ptr; sip_pvt_ptr = sip_pvt_ptr->next) { if (!strcmp(sip_pvt_ptr->callid, callid)) { int match = 1; - char *ourtag = sip_pvt_ptr->tag; /* Go ahead and lock it (and its owner) before returning */ sip_pvt_lock(sip_pvt_ptr); @@ -10822,8 +10817,21 @@ static struct sip_pvt *get_sip_pvt_byid_locked(const char *callid, const char *t (With a forking SIP proxy, several call legs share the call id, but have different tags) */ - if (pedanticsipchecking && (strcmp(fromtag, sip_pvt_ptr->theirtag) || (!ast_strlen_zero(totag) && strcmp(totag, ourtag)))) - match = 0; + if (pedanticsipchecking) { + const char *pvt_fromtag, *pvt_totag; + + if (sip_pvt_ptr->outgoing_call == TRUE) { + /* Outgoing call tags : from is "our", to is "their" */ + pvt_fromtag = sip_pvt_ptr->tag ; + pvt_totag = sip_pvt_ptr->theirtag ; + } else { + /* Incoming call tags : from is "their", to is "our" */ + pvt_fromtag = sip_pvt_ptr->theirtag ; + pvt_totag = sip_pvt_ptr->tag ; + } + if (ast_strlen_zero(fromtag) || strcmp(fromtag, pvt_fromtag) || (!ast_strlen_zero(totag) && strcmp(totag, pvt_totag))) + match = 0; + } if (!match) { sip_pvt_unlock(sip_pvt_ptr); @@ -10832,7 +10840,7 @@ static struct sip_pvt *get_sip_pvt_byid_locked(const char *callid, const char *t if (totag) ast_debug(4, "Matched %s call - their tag is %s Our tag is %s\n", - ast_test_flag(&sip_pvt_ptr->flags[0], SIP_OUTGOING) ? "OUTGOING": "INCOMING", + sip_pvt_ptr->outgoing_call == TRUE ? "OUTGOING": "INCOMING", sip_pvt_ptr->theirtag, sip_pvt_ptr->tag); /* deadlock avoidance... */ |