On 05/21/2014 09:08 AM, Roberto
Fichera wrote:
Hi There,
On 05/20/2014 09:15 PM, Peter
Villeneuve wrote:
Hi Roberto,
Hi Peter,
Did you ever figure out how to do it?
I'd be interested too.
Not yet! I tried other ways, barely workarounds, but I guess
I'll have to go into this
quite soon because it is the straight way to go. The main
problem is the lack of
my knowledge of kamailio API so I'll have to study a bit some
code in order to understand
how to use it.
BTW the idea is to trigger an event route were I'd like to set
all the info regarding
the dispatched message including the result of the delivering. I
don't know if is possible
but the best would be to set all the pseudo-variables so that
such event route will be
in the right context of the given MSILO message.
So, any advice regarding the API would definitively help and put
me in the right direction.
Actually I've started to play with the above idea, so below you
will find my current implementation
which seems executed because I see the LM_DBG() log but the code
within the event route but
the corresponding script code does not.
Any help?
Cheers,
Roberto Fichera.
event_route [msilo:on-delivered] {
xlog("L_INFO", "MSILO event on-delivered <$fu> to
<$ru>\n");
}
diff --git a/modules/msilo/msilo.c b/modules/msilo/msilo.c
index 903b3cf..742c48d 100644
--- a/modules/msilo/msilo.c
+++ b/modules/msilo/msilo.c
@@ -281,6 +281,9 @@ static int bind_msilo(msilo_api_t* api)
return 0;
}
+/* where to go for the local request route ("msilo:on-delivered")
*/
+int msilo_event_on_delivered=-1; /* default disabled */
+
/**
* init module function
*/
@@ -480,6 +483,11 @@ static int mod_init(void)
if(ms_outbound_proxy.s!=NULL)
ms_outbound_proxy.len =
strlen(ms_outbound_proxy.s);
+ /* check if the on-delivered route event exists or not */
+ msilo_event_on_delivered=route_lookup(&event_rt,
"msilo:on-delivered");
+ if (msilo_event_on_delivered>=0 &&
event_rt.rlist[msilo_event_on_delivered]==0)
+ msilo_event_on_delivered=-1; /* disable */
+
return 0;
}
@@ -1330,6 +1338,26 @@ void m_tm_callback( struct cell *t, int
type, struct tmcb_params *ps)
LM_DBG("message <%d> was sent successfully\n",
*((int*)ps->param));
msg_list_set_flag(ml, *((int*)ps->param), MS_MSG_DONE);
+ /* execute the msilo:on-delivered event route */
+ if(unlikely(msilo_event_on_delivered>=0))
+ {
+ int sflag_bk;
+ int backup_route_type;
+ struct run_act_ctx ctx;
+
+ LM_DBG("executing event_route[msilo:on-delivered]
(%d)\n", msilo_event_on_delivered);
+
+ sflag_bk = getsflags();
+ backup_route_type = get_route_type();
+
+ set_route_type(EVENT_ROUTE);
+ init_run_actions_ctx(&ctx);
+
run_top_route(event_rt.rlist[msilo_event_on_delivered],
ps->req, &ctx);
+
+ set_route_type(backup_route_type);
+ setsflagsval(sflag_bk);
+ }
+
done:
return;
}
Cheers,
Roberto Fichera.
_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
sr-users@lists.sip-router.org
http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users