OpenSIPS / opensips

OpenSIPS is a GPL implementation of a multi-functionality SIP Server that targets to deliver a high-level technical solution (performance, security and quality) to be used in professional SIP server platforms.
https://opensips.org
Other
1.25k stars 573 forks source link

[BUG] fix_nated_contact() after topology_hiding() results in invalid Contact header #2172

Open razvancrainea opened 4 years ago

razvancrainea commented 4 years ago

OpenSIPS version you are running

Describe the bug When fix_nated_contact() is called after topology_hiding(), the generated Contact is a concatenation of the two values, which is invalid.

To Reproduce

Run topology hiding and call fix_nated_contact() on an initial INVITE after topology_hiding() is engaged.

Expected behavior

A valid Contact header should result, most likely the one generated by fix_nated_contact().

liviuchircu commented 4 years ago

Update: this issue is actually not happening 100% of the time, only when the Contact header is not enclosed by <>. Here is how the problem actually manifests:

--- Contact is <> enclosed Contact is not <> enclosed
fix_nated_contact() + topology_hiding() OK OK
topology_hiding() + fix_nated_contact() OK NOT OK
volga629-1 commented 4 years ago

Just a side question is such problem can affect ACK with topology hiding ? I am having issue with topology hiding where ACK from client never reach pbx behind opensips. I am fixing contact after topology hiding on INVITE 200 OK

ACK

This is the flow.

ACK2

liviuchircu commented 4 years ago

@volga629-1 I see no connection with your ACK issue. This problem is only about a broken Contact in the forwarded INVITE on some corner-case (see the table).

For your problem, make sure to call fix_nated_contact() on the 200 OK. Maybe it is not being called, due to some bad logic (missing flag, condition, bad nat_uac_test() flags, etc.).

volga629-1 commented 4 years ago

fix_nated_contact() is doing it job. I see in trace on external leg that UA receive 200 OK with Contact header external IP of opensips with correct port then UA generate ACK which not contain any routing and R-URI is point to external ip of opensips which is correct, but it not forwarding after.

liviuchircu commented 4 years ago

You are doing topology_hiding_match() instead of loose_route(), correct?

volga629-1 commented 4 years ago

No I am use loose_route

stale[bot] commented 4 years ago

Any updates here? No progress has been made in the last 15 days, marking as stale. Will close this issue if no further updates are made in the next 30 days.

stale[bot] commented 3 years ago

Marking as closed due to lack of progress for more than 30 days. If this issue is still relevant, please re-open it with additional details.