<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Have you tested with async mi commands? The function
    build_async_handler() is cloning the information in shared memory,
    expecting that the response to the mi command to be done from
    another process. In that case, the socket is no longer valid,
    because it was created only in the mi process.<br>
    <br>
    I haven't analyzed deeply, but it is very likely to be what I said
    above.<br>
    <br>
    Options coming in my mind:<br>
    <br>
    - for async case keep the old way of creating a new socket. This can
    be propagated by setting field tx_sock=0<br>
    - try to bind to same socket in async handler, provided the initial
    socket is created with resuse addr/port<br>
    <br>
    Cheers,<br>
    Daniel<br>
    <br>
    <div class="moz-cite-prefix">On 28/03/14 21:49, Muhammad Shahzad
      wrote:<br>
    </div>
    <blockquote
cite="mid:CAFZQphxnqd60p-Rx=DP2UdZMysmN0QfEu_eMxhGFtEhg0pPQ_Q@mail.gmail.com"
      type="cite">
      <div dir="ltr">Please find attached updated patch as requested.<br>
      </div>
      <div class="gmail_extra"><br>
        <br>
        <div class="gmail_quote">On Fri, Mar 28, 2014 at 8:49 PM,
          Daniel-Constantin Mierla <span dir="ltr"><<a
              moz-do-not-send="true" href="mailto:miconda@gmail.com"
              target="_blank">miconda@gmail.com</a>></span> wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">Thanks for
            the patch. Can you resend it without commented code? Just
            remove the lines that are no longer used, to have clean
            code.<br>
            <br>
            Cheers,<br>
            Daniel
            <div class="HOEnZb">
              <div class="h5"><br>
                <br>
                On 28/03/14 01:29, Muhammad Shahzad wrote:<br>
                <blockquote class="gmail_quote" style="margin:0 0 0
                  .8ex;border-left:1px #ccc solid;padding-left:1ex">
                  Hi,<br>
                  <br>
                  After wasting most of the day trying to make
                  mi_datagram over UDP socket work. I eventually realize
                  that it does asymmetric UDP communication, which
                  creates a lot of trouble for writing a useful MI
                  script using PERL or Python etc.<br>
                  <br>
                  Anyhow, i go through the module code and was able to
                  write a patch for symmetric UDP communication using
                  mi_datagram.<br>
                  <br>
                  I have tested the patch using both Kamailio 4.1 and
                  trunk branches and it seems to compile and run
                  flawlessly.<br>
                  <br>
                  I am attaching here with this patch for Kamailio
                  community. It would be great if Kamailio developers
                  would review and commit this patch to source trunk.<br>
                  <br>
                  Thank you.<br>
                  <br>
                  <br>
                </blockquote>
                <br>
              </div>
            </div>
            <span class="HOEnZb"><font color="#888888">
                -- <br>
                Daniel-Constantin Mierla - <a moz-do-not-send="true"
                  href="http://www.asipto.com" target="_blank">http://www.asipto.com</a><br>
                <a moz-do-not-send="true"
                  href="http://twitter.com/#%21/miconda" target="_blank">http://twitter.com/#!/miconda</a>
                - <a moz-do-not-send="true"
                  href="http://www.linkedin.com/in/miconda"
                  target="_blank">http://www.linkedin.com/in/miconda</a><br>
                Kamailio World Conference - April 2-4, 2014, Berlin,
                Germany<br>
                <a moz-do-not-send="true"
                  href="http://www.kamailioworld.com" target="_blank">http://www.kamailioworld.com</a><br>
                <br>
              </font></span></blockquote>
        </div>
        <br>
      </div>
    </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>
Kamailio World Conference - April 2-4, 2014, Berlin, Germany
<a class="moz-txt-link-freetext" href="http://www.kamailioworld.com">http://www.kamailioworld.com</a></pre>
  </body>
</html>