<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hello,<br>
    <br>
    parsing should be done only if the onsend route is enabled:<br>
    <br>
    - perhaps would be good to add a define in onsend.h, not to hardcode
    in other modules the test on onsend_rt.rlist, like:<br>
    <br>
    #define onsend_enabled() (onsend_rt.rlist[DEFAULT_RT]?1:0)<br>
    <br>
    From performances point of view, there can be added a config
    parameter to enable running of onsend_route for replies:<br>
    <br>
    onsend_route_reply = 0|1<br>
    <br>
    #define onsend_enabled(rtype)
(onsend_rt.rlist[DEFAULT_RT]?((rtype==SIP_REPLY)?onsend_route_reply:1):0)<br>
    <br>
    On the other hand, is onsend_route also executed for local requests?
    I had in mind it is only for received requests that are forwarded
    ... Iirc, on onsend_route, the sip message is the one received, the
    outgoing content being accessible via $snd(buf).<br>
    <br>
    Cheers,<br>
    Daniel<br>
    <br>
    <div class="moz-cite-prefix">On 27/08/14 13:19, Lucian Balaceanu
      wrote:<br>
    </div>
    <blockquote cite="mid:53FDBEDF.2060308@1and1.ro" type="cite">
      <meta content="text/html; charset=windows-1252"
        http-equiv="Content-Type">
      <title></title>
      Hi,<br>
      <br>
      In response to the previous mail, I have attempted to create a
      suitable patch for calling onsend_route in the replies. However, I
      need some input from somebody more knowledgeable.<br>
      <br>
      You will find I changed the following code locations:<br>
      <br>
      forward.c  -> do_forward_reply() function<br>
      sl_funcs.c -> sl_reply_helper() function<br>
      t_reply.c  -> _reply_light() function<br>
      <br>
      Am I missing out any location where the onsend function should be
      called? I am particularly thinking of such cases as relayed
      replies, retransmitted replies (t_retransmit_reply).<br>
      <br>
      Additionally, in t_reply.c, I force the parsing of the message
      buffer into a sip_msg; do you see this as a perceivable slowdown
      in general kamailio performance?<br>
      <br>
      Any input is valuable.<br>
      <br>
      Thank you,<br>
      Lucian<br>
      <br>
      On 08/04/2014 05:16 PM, Daniel-Constantin Mierla wrote:
      <blockquote cite="mid:53DF95B1.7050901@gmail.com" type="cite">
        <meta http-equiv="Content-Type" content="text/html;
          charset=windows-1252">
        Hello,<br>
        <br>
        the reason for onsend_route was to get access to outgoing buffer
        (what is sent to network) as well as the local socket and remote
        socket attributes (proto, ip, port). There is no option to make
        changes on the outgoing buffer anymore, the action that could be
        done is stop sending to the network (discarding).<br>
        <br>
        It was done for requests, but there were discussions to make
        this available for replies as well. The code you provided in not
        in public repository, but it seems it aims for that (at least
        for stateless replies). The onsend callback should be indeed
        called before msg_send() to get the behavior expected (to be
        able to drop the reply, for example).<br>
        <br>
        If you get a patch to have the onsend_route for replies, it
        would be welcomed on the public repo.<br>
        <br>
        Cheers,<br>
        Daniel<br>
        <br>
        <div class="moz-cite-prefix">On 04/08/14 15:57, Lucian Balaceanu
          wrote:<br>
        </div>
        <blockquote cite="mid:53DF915C.6030302@1and1.ro" type="cite">
          Hi,<br>
          <br>
          I am currently trying to understand some kamailio code and
          came across this construct inside do_forward_reply() function
          (code in italics is not part of upstream kamailio):<br>
          <br>
          <b>do_forward_reply(struct sip_msg* msg, int mode){</b><br>
              ...<br>
              ...<br>
              apply_force_send_socket(&dst, msg);<br>
          <br>
              if (msg_send(&dst, new_buf, new_len)<0)<br>
              {<br>
                  STATS_RPL_FWD_DROP();<br>
                  goto error;<br>
              }<br>
          <i><b>    ...  <br>
                  dst.send_sock=get_send_socket(msg, &dst.to,
              dst.proto);<br>
                  ...<br>
                  run_onsend(msg, &dst, new_buf, new_len);</b></i><br>
          <b>}</b><br>
          <br>
          Is there really a sense in calling run_onsend() after the
          msg_send() function? In my understanding (based on
          onsend_route uasge) run_onsend() is used to make some last
          minute changes before a message is sent to a destination. <br>
          <br>
          Thank you,<br>
          Lucian Balaceanu<br>
          <br>
          <fieldset class="mimeAttachmentHeader"></fieldset>
          <br>
          <pre wrap="">_______________________________________________
sr-dev mailing list
<a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:sr-dev@lists.sip-router.org">sr-dev@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-dev">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev</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>
        <pre wrap=""><fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
sr-dev mailing list
<a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:sr-dev@lists.sip-router.org">sr-dev@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-dev">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev</a>
</pre>
      </blockquote>
      <br>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="72">-- 
Daniel-Constantin Mierla
<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>
Next Kamailio Advanced Trainings 2014 - <a class="moz-txt-link-freetext" href="http://www.asipto.com">http://www.asipto.com</a>
Sep 22-25, Berlin, Germany ::: Oct 15-17, San Francisco, USA</pre>
  </body>
</html>