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.


Cheers,
Peter


On Thu, Apr 17, 2014 at 4:04 PM, Roberto Fichera <kernel@tekno-soft.it> wrote:
On 04/17/2014 10:36 AM, Roberto Fichera wrote:

Hi All,

> On 04/16/2014 07:15 PM, Roberto Fichera wrote:
>
> Hi All,
>
>> On 04/16/2014 06:53 PM, Daniel-Constantin Mierla wrote:
>>> Hello,
>> Ciao Daniel,
>>
>>> most likely the messages are looped back, be sure you allow requests from 'myself' without authentication.
>>>
>>> You can watch loopback interface with ngrep to see if the messages are sent out.
>> Yep! Allowing requests from myself solved the problem! Thanks!
>>
>> Another thing regarding MSILO, I would like to preserve some custom header fields
>> for both instant message and notification. How can I do it?
> I was able to solve this issue too, pretty straight I mean, there is the extra_hdrs_avp param
> which did the trick. BTW, is there a way to send back the notification to the sender that
> the message has been sent correctly via m_dump(), so to get a 200 about the given
> m_dump()ed message?
>

I think that this can be solved in a different way, the idea is to add an event_route for the msilo
module so that we get notified for each m_dump()ed message about the given IM status and
then handle it in the cfg file. So, looking at the code within m_tm_callback() it seems that it's
right place where to add such feature. Since I'm not a kamailio developer but I've quite long
time experience in C coding, does anyone can show/point me to some example about
how to do that?

Thanks in advance,
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