If I run set_contact_alias nothing happens - the contact remains the same on the outbound message There's no error returned and debug logs indicate a proper header
However, if I add "msg_apply_changes()" on the line after set_contact_alias the Contact sent to next hop has the alias content No other changes
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/445
I see the same issue with add_contact_alias()
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/445#issuecomment-164804161
IIRC, add_contact_alias() doesn't add alias if the address is contact is the same as the address to be added as alias.
You description about the behavior of set_contact_alias() is not clear for me. Maybe you can paste here the incoming and outgoing requests when using set contact alias.
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/445#issuecomment-165020172
I send in a contact that is a 10.10.x.x address - clearly not the same as $si that is in 192.168.40.x (also tested on public IP for server) - and both functions return true, indicating no failure. The outbound message keeps the same contact as the inbound message.
If I run msg_apply_changes() the alias is added to the contact for the outbound message as it should be.
Very simple configuration, receiving message, running set_contact_alias() and then issuing t_relay().
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/445#issuecomment-165052699
I couldn't track any change on the code used by set_contact_alias(). Are you using the function in main request_route or a branch_route/etc.?
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/445#issuecomment-165112975
Main request route.
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/445#issuecomment-165115209
If you have a simple config, can you paste it here, at least the request_route and any branch_route used for this case (also onsend_route if in config).
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/445#issuecomment-165116170
´´´ # ------------------------- request routing logic ------------------- request_route { xlog("L_INFO", "--> Incoming request: $rm from $si to $ru \n$mb\n");
# Always try to fix contact alias if needed if(!set_contact_alias()) { sl_send_reply("400", "Contact alias failed"); xlog("L_ERR", "---- Contact alias failed: $ct\n"); } #msg_apply_changes();
if(!t_relay()) { # Transaction failed, send stateless reply xlog("L_INFO", " --> Transaction failed. Sending error response. \n"); sl_reply_error(); } exit; }
onsend_route { xlog("L_INFO", " --->ONSEND from $sndfrom(ip) to $snd(ip) \n$mb\n---\n"); } ´´´
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/445#issuecomment-165119560
I tested with master branch on a config based on the default one and all is ok. Maybe you can add some debug messages in the source code and see how far the code in the alias function is executed.
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/445#issuecomment-166299351
Tested also with your config snippet and all look ok. I was sending a SIP MESSAGE request, being the one I could use for testing in my current environment, but the code is the same.
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/445#issuecomment-166304937
I had a onsend-route in my original setup, maybe that affected the outcome, but I can't see how. I only get the parameters when using msg_apply_changes in both 4.3 and trunk.
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/445#issuecomment-166310902
I used onsend route also in the second test, which is your snipped above, plus loading the required modules.
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/445#issuecomment-166337494
Any update on this one, not being reproducible here. As suggested above, maybe adding some log messages in the source code of the function will help getting more hints.
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/445#issuecomment-168980118
If we get time at fosdem, I'll show you :-)
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/445#issuecomment-172470651
I would like to sort this item in a way or another. It doesn't show in tests.
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/445#issuecomment-183067687
I will reopen when I have time and resources to get back on this.
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/445#issuecomment-183233815
Closed #445.
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/issues/445#event-548256110
Hello, I ran in to the same issue where set_contact_alias were applied in some cases and in some cases not. I nailed it down to be related to having GRUU support enabled in the registrar.
Originally I had the configuration: modparam("registrar", "gruu_enabled", 1)
Disabling GRUU made it work as I expected: modparam("registrar", "gruu_enabled", 0)
This may be expected behaviour but in my case I tried to figure out why it in some cases did apply the alias and in other cases not. Maybe this will save someone else a few hours of confusion and frustration...
I should add that I was trying to set_contact_alias for replies, so it is exactly not the same configuration as in this report.
@jbj73 - this is a closed issue, if you have something to report, open a new issue and eventually refer to this one by its number, in case is some relation between the two.