Hi List
Some time ago, during my learning curve with kamailio, I learned that a branch route is where you make modifications to callerId's.
So I extensively re-engineered the config to move as much as possible of callerid modification into branch routes.
But now I discovered, when a call is dispatched via dispatch group with multiple destinations and one destination fails, therefore the failure route is triggered, the branch route is not being called on the second attempt, thus callerid being in the wrong format.
Example:
dispatcher.lst
As an example, consider having dispatcher group 2001 for national traffic over two dedicated links and Dispatcher group 2002 for international traffic.
2001 sip:192.168.1.1:5060 0 0 name="Carrier1" 2001 sip:192.168.2.1:5060 0 0 name="Carrier1"
2002 sip:192.168.1.3:5060 0 0 name="Carrier2"
request_route { # We determine where we want to send the call # and choose dispatch group 2001, the 'national' one. # But there are are other dispatch groups and branch triggers # set this way and routed to DISPATCHCALL $avp(dispgroup) = 2001; t_on_branch("BR_TO_NATIONAL"); route(DISPATCHCALL); }
route[DISPATCHCALL] { t_set_fr(120000,1500); # Fast Failover t_set_max_lifetime(300000,0); t_set_retr(200,800); if (ds_select_dst("$avp(dispgroup)", "6")) { if (ds_is_from_list(-1,0,"$du")) { t_on_failure("DISPATCH_FAILURE"); route(RELAY); } } }
branch_route[BR_TO_NATIONAL] { # Here I make sure, all CallerId and Header are correct for the # national Carrier }
failure_route[DISPATCH_FAILURE] { if (t_check_status("(5[0-9][0-9])") or (t_branch_timeout() and !t_branch_replied())) { # Try next DS. if (ds_next_dst()) { xlog("L_INFO", " --> retargeting request\n"); t_on_failure("DISPATCH_FAILURE"); route(RELAY); #### RIGHT HERE! exit; } } # We fail xlog("L_ERROR", "Call Failed\n"); }
My issue is not, that if the call is routed after the first path failed (marked with #### RIGHT HERE!) then the appropriate branch route is not triggered again and the headers are wrong. But I can not set t_on_branch within route[DISPATCHCALL] or route[DISPATCH_FAILURE] because this is called with a different pre-set branch trigger, depending on the target dispatch group.
Is there a way to make a branch trigger more persistent?