<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hello,<br>
    <br>
    the $ru should be the same as $tu in this case. $ru will change when
    the message loops back and there is a lookup("location") in the
    config, but in the callback you don't get it.<br>
    <br>
    If you really want to get the content of the sip MESSAGE request
    sent out, you can find it in the t->uac[0].request.buffer (iirc)
    as plain text. you can take it from there and parse it in a
    sip_msg_t  structure inside the callback. But with the SIP reply
    structure you may get what you need (if you just need $ru which is
    available in $tu).<br>
    <br>
    Cheers,<br>
    Daniel<br>
    <br>
    <div class="moz-cite-prefix">On 09/06/14 18:29, Roberto Fichera
      wrote:<br>
    </div>
    <blockquote cite="mid:5395E100.4000109@tekno-soft.it" type="cite">
      <meta content="text/html; charset=ISO-8859-1"
        http-equiv="Content-Type">
      <div class="moz-cite-prefix">On 06/09/2014 06:16 PM,
        Daniel-Constantin Mierla wrote:<br>
      </div>
      <blockquote cite="mid:5395DDDB.1000204@gmail.com" type="cite">
        <meta content="text/html; charset=ISO-8859-1"
          http-equiv="Content-Type">
        [...]<br>
      </blockquote>
      <br>
      <blockquote cite="mid:5395DDDB.1000204@gmail.com" type="cite">
        ps->req is null, because there is no incoming request, but
        you should have ps->rpl available if there is a 200ok.<br>
      </blockquote>
      <br>
      Which is my case! Only triggered once a 200ok has been received!
      Anyway it seems to work because the event route<br>
      get executed but $ru seems not defined:<br>
      <br>
      Jun 09 17:25:01 ip-10-227-0-26.localdomain
      /usr/sbin/kamailio[25288]: DEBUG: msilo [msilo.c:1378]:
      m_tm_callback_on_delivered_event(): >>>>>>>
      msilo_notification_event 0xb30cb748<br>
      Jun 09 17:25:01 ip-10-227-0-26.localdomain
      /usr/sbin/kamailio[25288]: DEBUG: msilo [msilo.c:1380]:
      m_tm_callback_on_delivered_event(): completed with status 200
      [mid: 148]<br>
      Jun 09 17:25:01 ip-10-227-0-26.localdomain
      /usr/sbin/kamailio[25288]: DEBUG: msilo [msilo.c:1393]:
      m_tm_callback_on_delivered_event(): message <148> was sent
      successfully<br>
      Jun 09 17:25:01 ip-10-227-0-26.localdomain
      /usr/sbin/kamailio[25288]: DEBUG: msilo [ms_msg_list.c:236]:
      msg_list_set_flag(): mid:148 fl:4<br>
      Jun 09 17:25:01 ip-10-227-0-26.localdomain
      /usr/sbin/kamailio[25288]: DEBUG: msilo [msilo.c:1403]:
      m_tm_callback_on_delivered_event(): executing
      event_route[msilo:on-delivered] (1)<br>
      Jun 09 17:25:01 ip-10-227-0-26.localdomain
      /usr/sbin/kamailio[25288]: DEBUG: msilo [msilo.c:1410]:
      m_tm_callback_on_delivered_event():
      event_route[msilo:on-delivered] event->req=0xb7275680)<br>
      Jun 09 17:25:01 ip-10-227-0-26.localdomain
      /usr/sbin/kamailio[25288]: DEBUG: <core>
      [parser/parse_addr_spec.c:176]: parse_to_param(): DEBUG:
      add_param: tag=90a2f67ea18c2dbc1dd6d5c5f690acb0-25e2<br>
      Jun 09 17:25:01 ip-10-227-0-26.localdomain
      /usr/sbin/kamailio[25288]: DEBUG: <core>
      [parser/parse_addr_spec.c:893]: parse_addr_spec(): end of header
      reached, state=29<br>
      ---->>>> Jun 09 17:25:01 ip-10-227-0-26.localdomain
      /usr/sbin/kamailio[25288]: INFO: <script>: MSILO event
      on-delivered <a moz-do-not-send="true"
        class="moz-txt-link-rfc2396E" href="mailto:sip:test1@test.com"><sip:test1@test.com></a>
      to <<null>><br>
      Jun 09 17:25:01 ip-10-227-0-26.localdomain
      /usr/sbin/kamailio[25288]: DEBUG: tm [t_reply.c:1663]:
      cleanup_uac_timers(): DEBUG: cleanup_uac_timers: RETR/FR timers
      reset<br>
      <br>
      <br>
      Cheers,<br>
      Roberto Fichera.<br>
      <br>
      <blockquote cite="mid:5395DDDB.1000204@gmail.com" type="cite"> <br>
        Cheers,<br>
        Daniel<br>
        <br>
        <div class="moz-cite-prefix">On 09/06/14 18:12, Roberto Fichera
          wrote:<br>
        </div>
        <blockquote cite="mid:5395DCFE.9070502@tekno-soft.it"
          type="cite">
          <meta content="text/html; charset=ISO-8859-1"
            http-equiv="Content-Type">
          <div class="moz-cite-prefix">On 06/09/2014 06:03 PM, Roberto
            Fichera wrote:<br>
            <br>
            Hi,<br>
            <br>
          </div>
          <blockquote cite="mid:5395DADB.4070603@tekno-soft.it"
            type="cite">
            <meta content="text/html; charset=ISO-8859-1"
              http-equiv="Content-Type">
            <div class="moz-cite-prefix">On 06/09/2014 05:49 PM,
              Daniel-Constantin Mierla wrote:<br>
            </div>
            <blockquote cite="mid:5395D789.1010504@gmail.com"
              type="cite">
              <meta content="text/html; charset=ISO-8859-1"
                http-equiv="Content-Type">
              Hello,<br>
            </blockquote>
            <br>
            Hi,<br>
            <br>
            <blockquote cite="mid:5395D789.1010504@gmail.com"
              type="cite">On 09/06/14 17:41, Roberto Fichera wrote:<br>
              <blockquote cite="mid:5395D5AF.7000100@tekno-soft.it"
                type="cite">
                <meta content="text/html; charset=ISO-8859-1"
                  http-equiv="Content-Type">
                [...]<br>
                <br>
                <blockquote cite="mid:5395CFC1.6090705@gmail.com"
                  type="cite"> your patch seems a bit to complex -- I
                  didn't figure out why you store the message in pkg
                  memory.<br>
                </blockquote>
                <br>
                Ok! So I will need to shm_malloc() the memory in such
                case, right?<br>
              </blockquote>
              I don't get why you need to do that at all. If you need to
              access from, to, etc..., you can get them from the SIP
              response. You go in dangerous zone as you do that cloning.<br>
            </blockquote>
            <br>
            The idea was to set a sip_msg just to have all the
            pseudo-variable available <br>
            within the event route and nothing else.<br>
            <br>
            <blockquote cite="mid:5395D789.1010504@gmail.com"
              type="cite"> Because you want to execute the event route
              on 200ok, the best is to run the event route with the SIP
              response structure.<br>
            </blockquote>
            <br>
            At the beginning this was my choice, but I'd always got
            ps->req = NULL in the callback tmcb_params <br>
            hence the event route wasn't executed. But I'll re-try it
            just to be sure.<br>
          </blockquote>
          <br>
          I can confirm, I'm always getting ps->req = NULL<br>
          <br>
          un 09 17:06:38 ip-10-227-0-26.localdomain
          /usr/sbin/kamailio[25089]: DEBUG: <core>
          [parser/msg_parser.c:170]: get_hdr_field(): get_hdr_field:
          cseq <CSeq>: <10> <MESSAGE><br>
          Jun 09 17:06:38 ip-10-227-0-26.localdomain
          /usr/sbin/kamailio[25089]: DEBUG: tm [t_lookup.c:949]:
          t_reply_matching(): DEBUG: t_reply_matching: hash 39390 label
          0 branch 0<br>
          Jun 09 17:06:38 ip-10-227-0-26.localdomain
          /usr/sbin/kamailio[25089]: DEBUG: tm [t_lookup.c:1004]:
          t_reply_matching(): DEBUG: t_reply_matching: reply matched
          (T=0xb2f7ebfc)!<br>
          Jun 09 17:06:38 ip-10-227-0-26.localdomain
          /usr/sbin/kamailio[25089]: DEBUG: tm [t_lookup.c:1141]:
          t_check_msg(): DEBUG: t_check_msg: msg id=1 global id=1 T
          end=0xb2f7ebfc<br>
          Jun 09 17:06:38 ip-10-227-0-26.localdomain
          /usr/sbin/kamailio[25089]: DEBUG: tm [t_reply.c:2206]:
          reply_received(): DEBUG: reply_received: org. status uas=0,
          uac[0]=0 local=2 is_invite=0)<br>
          Jun 09 17:06:38 ip-10-227-0-26.localdomain
          /usr/sbin/kamailio[25089]: DEBUG: tm [t_reply.c:1304]:
          t_should_relay_response():
          ->>>>>>>>> T_code=0, new_code=200<br>
          Jun 09 17:06:38 ip-10-227-0-26.localdomain
          /usr/sbin/kamailio[25089]: DEBUG: tm [t_reply.c:2086]:
          local_reply(): DEBUG: local_reply: branch=0, save=0, winner=0<br>
          Jun 09 17:06:38 ip-10-227-0-26.localdomain
          /usr/sbin/kamailio[25089]: DEBUG: tm [t_reply.c:2123]:
          local_reply(): DEBUG: local transaction completed<br>
          Jun 09 17:06:38 ip-10-227-0-26.localdomain
          /usr/sbin/kamailio[25089]: DEBUG: tm [t_hooks.c:288]:
          run_trans_callbacks_internal(): DBG: trans=0xb2f7ebfc,
          callback type 1024, id 0 entered<br>
          Jun 09 17:06:38 ip-10-227-0-26.localdomain
          /usr/sbin/kamailio[25089]: DEBUG: msilo [msilo.c:1378]:
          m_tm_callback_on_delivered_event():
          >>>>>>> msilo_notification_event
          0xb301669c<br>
          Jun 09 17:06:38 ip-10-227-0-26.localdomain
          /usr/sbin/kamailio[25089]: DEBUG: msilo [msilo.c:1380]:
          m_tm_callback_on_delivered_event(): completed with status 200
          [mid: 147]<br>
          Jun 09 17:06:38 ip-10-227-0-26.localdomain
          /usr/sbin/kamailio[25089]: DEBUG: msilo [msilo.c:1393]:
          m_tm_callback_on_delivered_event(): message <147> was
          sent successfully<br>
          Jun 09 17:06:38 ip-10-227-0-26.localdomain
          /usr/sbin/kamailio[25089]: DEBUG: msilo [ms_msg_list.c:236]:
          msg_list_set_flag(): mid:147 fl:4<br>
          Jun 09 17:06:38 ip-10-227-0-26.localdomain
          /usr/sbin/kamailio[25089]: DEBUG: msilo [msilo.c:1403]:
          m_tm_callback_on_delivered_event(): executing
          event_route[msilo:on-delivered] (1)<br>
          --->>>>> Jun 09 17:06:38
          ip-10-227-0-26.localdomain /usr/sbin/kamailio[25089]: DEBUG:
          msilo [msilo.c:1410]: m_tm_callback_on_delivered_event():
          event_route[msilo:on-delivered] ps->req=(nil))<br>
          Jun 09 17:06:38 ip-10-227-0-26.localdomain
          /usr/sbin/kamailio[25089]: DEBUG: tm [t_reply.c:1663]:
          cleanup_uac_timers(): DEBUG: cleanup_uac_timers: RETR/FR
          timers reset<br>
          Jun 09 17:06:38 ip-10-227-0-26.localdomain
          /usr/sbin/kamailio[25089]: DEBUG: <core>
          [usr_avp.c:644]: destroy_avp_list(): DEBUG:destroy_avp_list:
          destroying list (nil)<br>
          Jun 09 17:06:38 ip-10-227-0-26.localdomain
          /usr/sbin/kamailio[25089]: DEBUG: <core>
          [usr_avp.c:644]: destroy_avp_list(): DEBUG:destroy_avp_list:
          destroying list (nil)<br>
          Jun 09 17:06:38 ip-10-227-0-26.localdomain
          /usr/sbin/kamailio[25089]: DEBUG: <core>
          [usr_avp.c:644]: destroy_avp_list(): DEBUG:destroy_avp_list:
          destroying list (nil)<br>
          Jun 09 17:06:38 ip-10-227-0-26.localdomain
          /usr/sbin/kamailio[25089]: DEBUG: <core>
          [usr_avp.c:644]: destroy_avp_list(): DEBUG:destroy_avp_list:
          destroying list (nil)<br>
          Jun 09 17:06:38 ip-10-227-0-26.localdomain
          /usr/sbin/kamailio[25089]: DEBUG: <core>
          [usr_avp.c:644]: destroy_avp_list(): DEBUG:destroy_avp_list:
          destroying list (nil)<br>
          Jun 09 17:06:38 ip-10-227-0-26.localdomain
          /usr/sbin/kamailio[25089]: DEBUG: <core>
          [usr_avp.c:644]: destroy_avp_list(): DEBUG:destroy_avp_list:
          destroying list (nil)<br>
          Jun 09 17:06:38 ip-10-227-0-26.localdomain
          /usr/sbin/kamailio[25089]: DEBUG: <core> [xavp.c:448]:
          xavp_destroy_list(): destroying xavp list (nil)<br>
          Jun 09 17:06:38 ip-10-227-0-26.localdomain
          /usr/sbin/kamailio[25089]: DEBUG: <core>
          [receive.c:296]: receive_msg(): receive_msg: cleaning up<br>
          <br>
          <br>
          <blockquote cite="mid:5395DADB.4070603@tekno-soft.it"
            type="cite"> <br>
            BTW! using shm_malloc() I was finally able to execute the
            event route in the script with all the <br>
            pseudo-variable correctly set!<br>
          </blockquote>
          <br>
          Attached you will find the patch I'm actually using.<br>
          <br>
          Cheers,<br>
          Roberto Fichera.<br>
          <br>
          <blockquote cite="mid:5395DADB.4070603@tekno-soft.it"
            type="cite"> <br>
            Cheers,<br>
            Roberto Fichera.<br>
            <br>
            <blockquote cite="mid:5395D789.1010504@gmail.com"
              type="cite"> <br>
              Cheers,<br>
              Daniel<br>
              <pre class="moz-signature" cols="72">-- 
Daniel-Constantin Mierla - <a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://www.asipto.com">http://www.asipto.com</a>
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://twitter.com/#%21/miconda">http://twitter.com/#!/miconda</a> - <a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://www.linkedin.com/in/miconda">http://www.linkedin.com/in/miconda</a></pre>
              <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 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 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>
        <pre class="moz-signature" cols="72">-- 
Daniel-Constantin Mierla - <a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://www.asipto.com">http://www.asipto.com</a>
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://twitter.com/#%21/miconda">http://twitter.com/#!/miconda</a> - <a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://www.linkedin.com/in/miconda">http://www.linkedin.com/in/miconda</a></pre>
        <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>
    <pre class="moz-signature" cols="72">-- 
Daniel-Constantin Mierla - <a class="moz-txt-link-freetext" href="http://www.asipto.com">http://www.asipto.com</a>
<a class="moz-txt-link-freetext" href="http://twitter.com/#!/miconda">http://twitter.com/#!/miconda</a> - <a class="moz-txt-link-freetext" href="http://www.linkedin.com/in/miconda">http://www.linkedin.com/in/miconda</a></pre>
  </body>
</html>