Module: sip-router Branch: hpw/branch_failure_route Commit: 4e0cf550f75835b3f97bda9bb7934389a54b1f18 URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=4e0cf550...
Author: Hugh Waite hugh.waite@crocodile-rcs.com Committer: Hugh Waite hugh.waite@crocodile-rcs.com Date: Tue Mar 19 15:41:55 2013 +0000
modules/tm: Initial revision of branch_failure_route
- New branch_failure_route defined - cfg route is called but xlog() causes segfault
---
modules/tm/h_table.h | 4 ++ modules/tm/t_fwd.c | 1 + modules/tm/t_hooks.h | 6 +++- modules/tm/t_lookup.c | 1 + modules/tm/t_reply.c | 97 +++++++++++++++++++++++++++++++++++++++++++++++++ modules/tm/t_reply.h | 7 ++++ modules/tm/tm.c | 27 ++++++++++++++ modules/tm/tm_load.c | 1 + modules/tm/tm_load.h | 2 + 9 files changed, 145 insertions(+), 1 deletions(-)
Diff: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commitdiff;h=4e0c...
Hello,
wouldn't be possible to reuse the event_route concept for this case? I would try to avoid keep adding new routing block in the core.
Maybe something as: ... t_on_branch_failure("xyz"); .. event_route[tm:branch-failure:xyz] { ... }
In this way the flex/bison part from core does not need to be changed at all.
Cheers, Daniel
On 3/19/13 4:45 PM, Hugh Waite wrote:
Module: sip-router Branch: hpw/branch_failure_route Commit: 4e0cf550f75835b3f97bda9bb7934389a54b1f18 URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=4e0cf550...
Author: Hugh Waite hugh.waite@crocodile-rcs.com Committer: Hugh Waite hugh.waite@crocodile-rcs.com Date: Tue Mar 19 15:41:55 2013 +0000
modules/tm: Initial revision of branch_failure_route
- New branch_failure_route defined
- cfg route is called but xlog() causes segfault
modules/tm/h_table.h | 4 ++ modules/tm/t_fwd.c | 1 + modules/tm/t_hooks.h | 6 +++- modules/tm/t_lookup.c | 1 + modules/tm/t_reply.c | 97 +++++++++++++++++++++++++++++++++++++++++++++++++ modules/tm/t_reply.h | 7 ++++ modules/tm/tm.c | 27 ++++++++++++++ modules/tm/tm_load.c | 1 + modules/tm/tm_load.h | 2 + 9 files changed, 145 insertions(+), 1 deletions(-)
Diff: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commitdiff;h=4e0c...
sr-dev mailing list sr-dev@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
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?
Regards, Hugh
On 19/03/2013 22:14, Daniel-Constantin Mierla wrote:
Hello,
wouldn't be possible to reuse the event_route concept for this case? I would try to avoid keep adding new routing block in the core.
Maybe something as: ... t_on_branch_failure("xyz"); .. event_route[tm:branch-failure:xyz] { ... }
In this way the flex/bison part from core does not need to be changed at all.
Cheers, Daniel
On 3/19/13 4:45 PM, Hugh Waite wrote:
Module: sip-router Branch: hpw/branch_failure_route Commit: 4e0cf550f75835b3f97bda9bb7934389a54b1f18 URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=4e0cf550...
Author: Hugh Waite hugh.waite@crocodile-rcs.com Committer: Hugh Waite hugh.waite@crocodile-rcs.com Date: Tue Mar 19 15:41:55 2013 +0000
modules/tm: Initial revision of branch_failure_route
- New branch_failure_route defined
- cfg route is called but xlog() causes segfault
modules/tm/h_table.h | 4 ++ modules/tm/t_fwd.c | 1 + modules/tm/t_hooks.h | 6 +++- modules/tm/t_lookup.c | 1 + modules/tm/t_reply.c | 97 +++++++++++++++++++++++++++++++++++++++++++++++++ modules/tm/t_reply.h | 7 ++++ modules/tm/tm.c | 27 ++++++++++++++ modules/tm/tm_load.c | 1 + modules/tm/tm_load.h | 2 + 9 files changed, 145 insertions(+), 1 deletions(-)
Diff: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commitdiff;h=4e0c...
sr-dev mailing list sr-dev@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev
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
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