Before calling do_action function from the sip router core, one has to
first create and initialize a context variable of type run_act_ctx.
Pointer to this variable is then passed as the first parameter to
do_action.
Also, it is safer to zero the whole 'action' structure using a memset
than setting all its attributes explicitly, you never know when
somebody adds a new attribute to the structure and then it might be
used unitialized.
Finally, attribute 'elem' in 'action' structure was renamed to
'val in ser.
---
modules/carrierroute/cr_func.c | 11 ++++++-----
1 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/modules/carrierroute/cr_func.c b/modules/carrierroute/cr_func.c
index 451e2cc..325c20b 100644
--- a/modules/carrierroute/cr_func.c
+++ b/modules/carrierroute/cr_func.c
@@ -496,6 +496,7 @@ int cr_do_route(struct sip_msg * _msg, gparam_t *_carrier,
struct carrier_data_t * carrier_data;
struct domain_data_t * domain_data;
struct action act;
+ struct run_act_ctx ra_ctx;
if (fixup_get_svalue(_msg, _rewrite_user, &rewrite_user)<0) {
LM_ERR("cannot print the rewrite_user\n");
@@ -565,12 +566,12 @@ int cr_do_route(struct sip_msg * _msg, gparam_t *_carrier,
LM_INFO("uri %.*s was rewritten to %.*s, carrier %d, domain %d\n",
rewrite_user.len, rewrite_user.s, dest.len, dest.s, carrier_id, domain_id);
+ memset(&act, 0, sizeof(act));
act.type = SET_URI_T;
- act.elem[0].type= STRING_ST;
- act.elem[0].u.string = dest.s;
- act.next = NULL;
-
- ret = do_action(&act, _msg);
+ act.val[0].type = STRING_ST;
+ act.val[0].u.string = dest.s;
+ init_run_actions_ctx(&ra_ctx);
+ ret = do_action(&ra_ctx, &act, _msg);
if (ret < 0) {
LM_ERR("Error in do_action()\n");
}
--
1.5.6.5