Hello List,
i use kamailio-5.0.4 and i am now at the point that one kamailio is not enough :).
So i decide to set another kamailio internal as sip-router based on drouting. My config is straight forward the example config with additional drouting stuff.
Whats the best practice to route based on $rd with kamailio?
I dont want to end with an bunch of if then else. Should be come from database.
Pseudo Code:
if ($rd == old.sbc.domain) { route[oldstuff]; } else { route[newstuff]; }
Is there an module that i can use?
Hello List,
i solved this with an "simple" if statement. For me surprising i tried this without success:
#!define NEWDOMAIN "some.domain.example" $avp(newdomain) = NEWDOMAIN;
if ($avp(newdomain) == $rd) ...
and this dont match. Also i tried "" around all vars. And copied into $avp and {s.tolower} all of them. Nothing works. avp_print() shows both avps as the same.
Anyway ---
My now working example is that one with avp_check. Was hard to find the meaning of g/G and i/I in the module. In the wiki i found an example description of tha avp_check flags.
if (allow_source_address(FLT_IVR)) { # OLD vs NEW - domain routing... $avp(newdomain) = NEWDOMAIN; $avp(pathinfo) = "outbound"; # avp_check flags / avpops # g/G - use all values of the checked AVP (first parameter) # i/I - if strings are checked, do it case insensitive if ( avp_check("$rd", "eq/$avp(newdomain)/gi") ) { xlog("L_INFO", "go to new-gw\n"); $avp(routing_target) = FLT_FSNODE; } else { xlog("L_INFO", "go to old-gw\n"); $avp(routing_target) = FLT_OLDSBC; } xlog("L_INFO", "[$avp(pathinfo)] comes from IVR <$si> to <$ruri> \n"); route(DISPATCH); exit; }
Kind Regards ...
2017-11-08 13:28 GMT+01:00 Karsten Horsmann khorsmann@gmail.com:
Hello List,
i use kamailio-5.0.4 and i am now at the point that one kamailio is not enough :).
So i decide to set another kamailio internal as sip-router based on drouting. My config is straight forward the example config with additional drouting stuff.
Whats the best practice to route based on $rd with kamailio?
I dont want to end with an bunch of if then else. Should be come from database.
Pseudo Code:
if ($rd == old.sbc.domain) { route[oldstuff]; } else { route[newstuff]; }
Is there an module that i can use?
-- Kind Regards *Karsten Horsmann*