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
set_contact_alias() issue with clients adding it to their Contact #2308
Comments
set_contact_alias() should not be used for registrations, but for requests that are typically forwarded. If you do it on an edge proxy between device and registrar server, then you should use path module and leave the contact unchanged. If you use it in the registrar server config, then you should replace it with fix_nated_register(), like in the default kamailio.cfg. Otherwise, if you really want to use it, then in case you have to deal with such UA, then yes, you will have to remove (or replace) the alias parameter in Contact. Probably you can play with the replace/subst functions from textops and if you can't get it, then new C code has to be added. A pull request is of course appreciated. |
Thank you for your reply. Does the manual somewhere state that set_contact_alias() should not be used for REGISTER? The reason for using set_contact_alias() instead of fix_nated_contact() is that one client seemed to have an issue with the contact being changed. I'm actually using in on an edge proxy and already using Path, but I guess I missed setting this on the edge: modparam("path", "use_received", 1) Fixed it already temp with a subst on the reply for REGISTERs, as you wrote. |
Would you please share how you fixed it with subst? |
All done on edge proxy. I'm not a regex-pro. https://gist.github.com/mtryfoss/9a0811dbc4462b91afe87d7dd5a210e8 |
@mtryfoss - the set_contact_alias() is indeed for use instead of fix_nated_contact(). But fix_nated_contact() is not for REGISTER, for it the fix_nated_register() should be used. However, fix_nated_register() has to be used only if the registrar server is next to the nat router. If registrar is behind an edge proxy (SBC), then it should work without touching the contact and using the Path module (with Now, as you noticed, set_contact_alias() may work also for REGISTER, but some UAs don't like it (or use it inappropriately). You are more than welcome to make a pull request to the docs of this function to explain better its purpose based on your experiences. |
@mtryfoss: regarding the subst, probably it does the job with ipv4 and the alias value set by Kamailio, which is what you need. However in regexp
|
Going to close this one, solutions being found. If someone wants to make a pull request adding a function to cope with this specific case, it is more than welcome! |
curious on this topic- we use |
handle_ruri_alias() only handle alias in Request-URI, not the Contact returned by the registrar for REGISTER. For most phone clients this is not a problem but Bria used that info in subsequent requests. When proxy then calls handle_ruri_alias() the first parameter is handled and removed, and you'll send the one which the proxy actually added back to the client. The ip/port used in the reply might be wrong if the alias Bria added is outdated. |
ohhh i understand now. |
I've only been testing 5.3.3. Of course, the alias should probably be replaced if it exists rather than append one more without the need for a specific setting/parameter. I'm not that into Kamailio source and did not have time to get going there when I found the issue, so I fixed it quickly by a regexp replace. |
Master branch (upcoming 5.4.0) has now a function to remove parameters from Contact header URI (see siputils module). |
https://github.com/kamailio/kamailio/compare/nathelper-set_contact_alias-trim?expand=1 |
Thanks! I've lost my staging environment temporarily because of some physical re-location of our servers. |
I'm using set_contact_alias() to fix nat registrations, in this case with a Bria client.
Somehow Bria learns that I'm using this - probably through the Contact in the 200 OK reply of save(). Bria then adds this to the Contact when replying to incoming INVITE.
After some time, something happens in the network at client side and the connection gets a new port through the router. Bria does not notice and still sends the old alias-parameter with the port not used anymore. When I'm calling handle_ruri_alias(), Kamailio reads this instead of the actual port and the ACK to 200 OK is sent to a port not used anymore.
This can probably be solved by either, in preferred order:
Br,
Morten
The text was updated successfully, but these errors were encountered: