allows comparison with persisted value in usrloc.
if($ulc(exp=>received) == $received_uri) { .... } You can view, comment on, or merge this pull request online at:
https://github.com/kamailio/kamailio/pull/90
-- Commit Summary --
* nathelper - add received_ui pvar
-- File Changes --
M modules/nathelper/nathelper.c (30)
-- Patch Links --
https://github.com/kamailio/kamailio/pull/90.patch https://github.com/kamailio/kamailio/pull/90.diff
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/pull/90
This looks like $su from pv module.
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/pull/90#issuecomment-74698959
yes it does, but there is a difference. receive_uri returns the value as is persisted in usrloc,the proto is uppercase. $su, $received_uri - sip:192.168.27.2:8305;transport=tcp - sip:192.168.27.2:8305;transport=TCP
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/pull/90#issuecomment-74700928
String comparison should be lower case.
Besides that, there are string transformation 'tolower' and 'toupper'.
It is no need for another variable. Eventually the two functions should be made to use a common function stored in core.
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/pull/90#issuecomment-74702270
i agree, but not when is part of a select statement. "select * from usrloc where received = $su" would not work.
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/pull/90#issuecomment-74703650
I am sure sql has functions for tolower or toupper or case insensitive match.
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/pull/90#issuecomment-74707284
that depends on the engine, right ? the point is, the value is stored in mixed case. i'm trying to get a match of the value that is stored. nat_traversal also has a source_uri pv that matches what it internally calculates, nathelper should do the same.
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/pull/90#issuecomment-74708052
...or we can patch nathelper to lower case what it puts in received_avp ? and also make sure $su returns lowercase ?
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/pull/90#issuecomment-74708457
I dont know about nat_traversal, perhaps is some quite old code.
I already said that the two functions should be made a wrapper to a common function stored in core. That will ensure consistency. I think transport in lowrr case is the common out there.
I can take care later today or tomorrow.
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/pull/90#issuecomment-74709785
fair enough. thank you.
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/pull/90#issuecomment-74710144
Closed #90.
--- Reply to this email directly or view it on GitHub: https://github.com/kamailio/kamailio/pull/90#event-237087800