[asterisk-bugs] [JIRA] (ASTERISK-15023) [patch] Fix/improve transaction/dialog-matching in pedantic mode

Matt Jordan (JIRA) noreply at issues.asterisk.org
Wed Feb 25 19:31:34 CST 2015


    [ https://issues.asterisk.org/jira/browse/ASTERISK-15023?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=225121#comment-225121 ] 

Matt Jordan commented on ASTERISK-15023:
----------------------------------------

I think this issue is essentially completed, even if the existing code doesn't look much like the patches here any more.
# We track dialogs in an {{ao2}} container
# We should detect forked dialogs in {{match_req_to_dialog}}:
{code}
				/* Forked Request Detection
				 *
				 * If this is a 200ok response and the totags do not match, this
				 * might be a forked response to an outgoing Request. Detection of
				 * a forked response must meet the criteria below.
				 *
				 * 1. must be a 2xx Response
				 * 2. call-d equal to call-id of Request. this is done earlier
				 * 3. from-tag equal to from-tag of Request. this is done earlier
				 * 4. branch parameter equal to branch of inital Request
				 * 5. to-tag _NOT_ equal to previous 2xx response that already established the dialog.
				 */
				if ((arg->respid == 200) &&
					!ast_strlen_zero(invite_branch) &&
					!ast_strlen_zero(arg->viabranch) &&
					!strcmp(invite_branch, arg->viabranch)) {
					return SIP_REQ_FORKED;
				}
{code}
# We should detect spirals in the same function:
{code}
			/* Loop/Merge Detected
			 *
			 * ---Current Matches to Initial Request---
			 * request uri
			 * Call-id
			 * their-tag
			 * no totag present
			 * method
			 * cseq
			 *
			 * --- Does not Match Initial Request ---
			 * Top Via
			 *
			 * Without the same Via, this can not match our initial transaction for this dialog,
			 * but given that this Request matches everything else associated with that initial
			 * Request this is most certainly a Forked request in which we have already received
			 * part of the fork.
			 */
			return SIP_REQ_LOOP_DETECTED;
{code}
# We do clear {{SIP_PAGE2_DIALOG_ESTABLISHED}} on a {{200 OK}} to a {{BYE}} request:
{code}
			} else if (sipmethod == SIP_BYE) {		/* Ok, we're ready to go */
				pvt_set_needdestroy(p, "received 200 response");
				ast_clear_flag(&p->flags[1], SIP_PAGE2_DIALOG_ESTABLISHED);
			}
{code}

Closing this issue out as "Fixed" (at some point in time). If there is some aspect of this that is not fixed, please comment here and I'll be happy to reopen it.

> [patch] Fix/improve transaction/dialog-matching in pedantic mode
> ----------------------------------------------------------------
>
>                 Key: ASTERISK-15023
>                 URL: https://issues.asterisk.org/jira/browse/ASTERISK-15023
>             Project: Asterisk
>          Issue Type: New Feature
>          Components: Channels/chan_sip/Interoperability
>            Reporter: Alex Hermann
>         Attachments: fix-dialog-matching, improved-dialog-matching
>
>
> Attached patch fixes the following issues in chan_sip:
> 1) Use astobj2 as a true hash table instead of doing a 'fancy' linear searchg over the entire list trying to find the correct entry.
> 2) Fix tag matching. Currently in pedantic mode it is impossible to handle a call that is being forwarded by a proxy, eg receiving a 183 (client, no answer) and a 200 (voicemail) from 2 different UA's.
> 3) Fix spiralling calls. Each new branch creates a new pvt.
> 4) Part of 2) is to not clear the SIP_PAGE2_DIALOG_ESTABLISHED flag on a BYE, to be able to absorb retransmissions.
> I'm sorry this is all in one patch, but I'm a little time contraint to split them now.



--
This message was sent by Atlassian JIRA
(v6.2#6252)



More information about the asterisk-bugs mailing list