Hi Daniel, As you suggested, I've implemented an event_route which is run with a new route_type 'BRANCH_FAILURE_ROUTE'. It seems to work fine so far.
Because I copied the run_failure_route_handlers() function to run_branch_failure_route_handlers(), it inherited the code for running callbacks etc and I needed to add callback types for this to compile. My question is; Should I leave all this callback functionality in place for the branch_failure route, or is it unnecessary here and should be removed?
Regards, Hugh
On 22/03/2013 15:00, Daniel-Constantin Mierla wrote:
Hello,
On 3/20/13 3:22 PM, Hugh Waite wrote:
Hi, To run in an event_route, functions need to have the EVENT_ROUTE/REQUEST_ROUTE flag set. So far the ones I want to use already have that, and I can always add that flag if required. I know functions can check the route type with 'get_route_type()', but for an event_route this is the same as REQUEST_ROUTE. For example, I will want to run something like:
branch_failure_route[OUTBOUND_FAIL] { if (t_check_status("430") { disable_contact(); t_next_contact_flow(); t_relay(); } } I think t_check_status() will return the wrong thing here because of the route type. Can I work round that in an event_route and are there any similar implications?
a new internal ID for a route type can be defined if needed, otherwise you can set the type to a different one than REQUEST_ROUTE if it is more suitable. This type is set in code before execution of the routing block, for example in htable:
set_route_type(REQUEST_ROUTE); init_run_actions_ctx(&ctx); run_top_route(event_rt.rlist[rt], fmsg, &ctx);
But I would not want to have more routing block names in the config -- at the start of v3.0 (ser-kamailio integration) we even removed some old ones (local_route being replaced by event_route[tm:local-request]).
Cheers, Daniel