Hello, I have a few gateways with lcr_gw.transport = 1|2|3 The point is that transport is always filled it with some not NULL value.
In config script I do from_any_gw($si, 0). Kamailio version is 3.3.
According to http://kamailio.org/docs/modules/3.3.x/modules/lcr.html#id2512701 :
0 = ANY so it should match gateway with this IP address no matter what the transport is.
But in reality that's not what the lcr_mod.c does:
/* Store tag and flags and return result */ if ((res != NULL) && ((res->transport == transport) || ((res->transport == PROTO_NONE) && (transport == PROTO_UDP)))) { LM_DBG("request game from gw\n"); if (tag_avp_param) {
Shouldn't it ignore res->transport if transport == PROTO_NONE?
And what is the last check for: (res->transport == PROTO_NONE) && (transport == PROTO_UDP) ?
Thanks in advance.
Andrew Pogrebennyk writes:
0 = ANY so it should match gateway with this IP address no matter what the transport is.
looks like ANY is not currently supported in the code.
But in reality that's not what the lcr_mod.c does:
if ((res != NULL) &&
((res->transport == transport) || ((res->transport == PROTO_NONE) && (transport == PROTO_UDP)))) {
you could try to change the above to this:
if ((res != NULL) && ((transport == PROTO_NONE) || (res->transport == transport))) {
And what is the last check for: (res->transport == PROTO_NONE) && (transport == PROTO_UDP) ?
looks like it is old code from the time when PROTO_NONE didn't mean ANY, but that transport protocol was not defined, in which case it defaulted to UDP.
i'm not personally using these test functions anymore, since i consider htable based solution a better alternative.
-- juha
Juha, thanks for getting back to me. The code as shown works for me, however another check may be required if transport != PROTO_NONE but value stored in the database is NULL (PROTO_ANY). And at a glance do_to_gw function also has this problem.
On 07/03/2012 02:34 PM, Juha Heinanen wrote:
you could try to change the above to this:
if ((res != NULL) &&
((transport == PROTO_NONE) || (res->transport == transport))) {
And what is the last check for: (res->transport == PROTO_NONE) && (transport == PROTO_UDP) ?
looks like it is old code from the time when PROTO_NONE didn't mean ANY, but that transport protocol was not defined, in which case it defaulted to UDP.
i'm not personally using these test functions anymore, since i consider htable based solution a better alternative.
Andrew Pogrebennyk writes:
The code as shown works for me, however another check may be required if transport != PROTO_NONE but value stored in the database is NULL (PROTO_ANY). And at a glance do_to_gw function also has this problem.
according to readme, value 0 is db means any. the code maps also null db value to 0 (any).
-- juha