Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid unexpected "482 Request Merged" #211

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions libsofia-sip-ua/nta/nta.c
Original file line number Diff line number Diff line change
Expand Up @@ -5120,7 +5120,7 @@ nta_leg_t *leg_find(nta_agent_t const *sa,

if (leg_url && request_uri && url_cmp(leg_url, request_uri))
continue;
if (leg_method && method_name && !su_casematch(method_name, leg_method))
if (leg_method == NULL || method_name && !su_casematch(method_name, leg_method))
continue;

/* Perfect match if both local and To have tag
Expand Down Expand Up @@ -6238,10 +6238,16 @@ static nta_incoming_t *incoming_find(nta_agent_t const *agent,

/* RFC3261 - section 8.2.2.2 Merged Requests */
if (return_merge) {
if (irq->irq_cseq->cs_method == cseq->cs_method &&
strcmp(irq->irq_cseq->cs_method_name,
cseq->cs_method_name) == 0)
*return_merge = irq, return_merge = NULL;
/* RFC3261 - section 17.2.3 Matching Requests to Server Transactions */
if (irq->irq_via->v_branch &&
su_casematch(irq->irq_via->v_branch, v->v_branch) &&
su_casematch(irq->irq_via->v_host, v->v_host) &&
su_strmatch(irq->irq_via->v_port, v->v_port)) {
if (irq->irq_cseq->cs_method == cseq->cs_method &&
strcmp(irq->irq_cseq->cs_method_name,
cseq->cs_method_name) == 0)
*return_merge = irq, return_merge = NULL;
}
}
}

Expand Down