<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">On 05/21/2014 09:08 AM, Roberto Fichera
      wrote:<br>
      <br>
      Hi There,<br>
      <br>
    </div>
    <blockquote cite="mid:537C50E6.5080403@tekno-soft.it" type="cite">
      <meta content="text/html; charset=ISO-8859-1"
        http-equiv="Content-Type">
      <div class="moz-cite-prefix">On 05/20/2014 09:15 PM, Peter
        Villeneuve wrote:<br>
      </div>
      <blockquote
cite="mid:CAEiJqQOtRVuvz6ex7q3vNgsCG05ELcgD_=Ggweo-QMX03PMPew@mail.gmail.com"
        type="cite">
        <div dir="ltr">Hi Roberto,</div>
      </blockquote>
      <br>
      Hi Peter,<br>
      <br>
      <blockquote
cite="mid:CAEiJqQOtRVuvz6ex7q3vNgsCG05ELcgD_=Ggweo-QMX03PMPew@mail.gmail.com"
        type="cite">
        <div dir="ltr">
          <div>Did you ever figure out how to do it?</div>
          <div>I'd be interested too.</div>
        </div>
      </blockquote>
      <br>
      Not yet! I tried other ways, barely workarounds, but I guess I'll
      have to go into this <br>
      quite soon because it is the straight way to go. The main problem
      is the lack of <br>
      my knowledge of kamailio API so I'll have to study a bit some code
      in order to understand <br>
      how to use it. <br>
      <br>
      BTW the idea is to trigger an event route were I'd like to set all
      the info regarding<br>
      the dispatched message including the result of the delivering. I
      don't know if is possible<br>
      but the best would be to set all the pseudo-variables so that such
      event route will be <br>
      in the right context of the given MSILO message.<br>
      <br>
      So, any advice regarding the API would definitively help and put
      me in the right direction.<br>
    </blockquote>
    <br>
    Actually I've started to play with the above idea, so below you will
    find my current implementation<br>
    which seems executed because I see the LM_DBG() log but the code
    within the event route but<br>
    the corresponding script code does not. <br>
    <br>
    Any help?<br>
    <br>
    Cheers,<br>
    Roberto Fichera.<br>
    <br>
    <br>
    event_route [msilo:on-delivered] {<br>
      xlog("L_INFO", "MSILO event on-delivered <$fu> to
    <$ru>\n");<br>
    }<br>
    <br>
    <br>
    diff --git a/modules/msilo/msilo.c b/modules/msilo/msilo.c<br>
    index 903b3cf..742c48d 100644<br>
    --- a/modules/msilo/msilo.c<br>
    +++ b/modules/msilo/msilo.c<br>
    @@ -281,6 +281,9 @@ static int bind_msilo(msilo_api_t* api)<br>
            return 0;<br>
     }<br>
     <br>
    +/* where to go for the local request route ("msilo:on-delivered")
    */<br>
    +int msilo_event_on_delivered=-1; /* default disabled */<br>
    +<br>
     /**<br>
      * init module function<br>
      */<br>
    @@ -480,6 +483,11 @@ static int mod_init(void)<br>
            if(ms_outbound_proxy.s!=NULL)<br>
                    ms_outbound_proxy.len = strlen(ms_outbound_proxy.s);<br>
     <br>
    +        /* check if the on-delivered route event exists or not */<br>
    +       msilo_event_on_delivered=route_lookup(&event_rt,
    "msilo:on-delivered");<br>
    +       if (msilo_event_on_delivered>=0 &&
    event_rt.rlist[msilo_event_on_delivered]==0)<br>
    +               msilo_event_on_delivered=-1; /* disable */<br>
    +<br>
            return 0;<br>
     }<br>
     <br>
    @@ -1330,6 +1338,26 @@ void m_tm_callback( struct cell *t, int type,
    struct tmcb_params *ps)<br>
            LM_DBG("message <%d> was sent successfully\n",
    *((int*)ps->param));<br>
            msg_list_set_flag(ml, *((int*)ps->param), MS_MSG_DONE);<br>
     <br>
    +        /* execute the msilo:on-delivered event route */<br>
    +        if(unlikely(msilo_event_on_delivered>=0))<br>
    +        {<br>
    +                int sflag_bk;<br>
    +                int backup_route_type;<br>
    +                struct run_act_ctx ctx;<br>
    +<br>
    +                LM_DBG("executing event_route[msilo:on-delivered]
    (%d)\n", msilo_event_on_delivered);<br>
    +<br>
    +                sflag_bk = getsflags();<br>
    +                backup_route_type = get_route_type();<br>
    +<br>
    +                set_route_type(EVENT_ROUTE);<br>
    +                init_run_actions_ctx(&ctx);<br>
    +               
    run_top_route(event_rt.rlist[msilo_event_on_delivered], ps->req,
    &ctx);<br>
    +<br>
    +                set_route_type(backup_route_type);<br>
    +                setsflagsval(sflag_bk);<br>
    +        }<br>
    +<br>
     done:<br>
            return;<br>
     }<br>
    <br>
    <br>
    <blockquote cite="mid:537C50E6.5080403@tekno-soft.it" type="cite"> <br>
      Cheers,<br>
      Roberto Fichera.<br>
      <br>
      <blockquote
cite="mid:CAEiJqQOtRVuvz6ex7q3vNgsCG05ELcgD_=Ggweo-QMX03PMPew@mail.gmail.com"
        type="cite">
        <div dir="ltr">
          <div><br>
          </div>
          <div>Cheers,</div>
          <div>Peter</div>
        </div>
        <div class="gmail_extra"><br>
          <br>
          <div class="gmail_quote"> On Thu, Apr 17, 2014 at 4:04 PM,
            Roberto Fichera <span dir="ltr"><<a
                moz-do-not-send="true"
                href="mailto:kernel@tekno-soft.it" target="_blank">kernel@tekno-soft.it</a>></span>
            wrote:<br>
            <blockquote class="gmail_quote" style="margin:0 0 0
              .8ex;border-left:1px #ccc solid;padding-left:1ex">
              <div class="">On 04/17/2014 10:36 AM, Roberto Fichera
                wrote:<br>
                <br>
                Hi All,<br>
                <br>
                > On 04/16/2014 07:15 PM, Roberto Fichera wrote:<br>
                ><br>
                > Hi All,<br>
                ><br>
                >> On 04/16/2014 06:53 PM, Daniel-Constantin
                Mierla wrote:<br>
                >>> Hello,<br>
                >> Ciao Daniel,<br>
                >><br>
                >>> most likely the messages are looped back,
                be sure you allow requests from 'myself' without
                authentication.<br>
                >>><br>
                >>> You can watch loopback interface with ngrep
                to see if the messages are sent out.<br>
                >> Yep! Allowing requests from myself solved the
                problem! Thanks!<br>
                >><br>
                >> Another thing regarding MSILO, I would like to
                preserve some custom header fields<br>
                >> for both instant message and notification. How
                can I do it?<br>
                > I was able to solve this issue too, pretty straight
                I mean, there is the extra_hdrs_avp param<br>
                > which did the trick. BTW, is there a way to send
                back the notification to the sender that<br>
                > the message has been sent correctly via m_dump(),
                so to get a 200 about the given<br>
                > m_dump()ed message?<br>
                ><br>
                <br>
              </div>
              I think that this can be solved in a different way, the
              idea is to add an event_route for the msilo<br>
              module so that we get notified for each m_dump()ed message
              about the given IM status and<br>
              then handle it in the cfg file. So, looking at the code
              within m_tm_callback() it seems that it's<br>
              right place where to add such feature. Since I'm not a
              kamailio developer but I've quite long<br>
              time experience in C coding, does anyone can show/point me
              to some example about<br>
              how to do that?<br>
              <div class="im HOEnZb"><br>
                Thanks in advance,<br>
                Roberto Fichera.<br>
                <br>
              </div>
              <div class="HOEnZb">
                <div class="h5">_______________________________________________<br>
                  SIP Express Router (SER) and Kamailio (OpenSER) -
                  sr-users mailing list<br>
                  <a moz-do-not-send="true"
                    href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a><br>
                  <a moz-do-not-send="true"
                    href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users"
                    target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a><br>
                </div>
              </div>
            </blockquote>
          </div>
          <br>
        </div>
        <br>
        <fieldset class="mimeAttachmentHeader"></fieldset>
        <br>
        <pre wrap="">_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
<a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a>
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
      </blockquote>
      <br>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a>
<a class="moz-txt-link-freetext" href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>