<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hello,<br>
    <br>
    one thing I wanted to add -- it may be good to backup the old value
    of the sock and restore it later.<br>
    <br>
    I am not sure if this is used in a context of a request that is
    going to be forwarded as well to some other address. If yes, then
    perhaps is it safer to backup and restore initial socket value.<br>
    <br>
    Perhaps it needs to check if the transaction exists and if not,
    create it first via tm api, then set the new socket for message and
    call the t_replicate function, not to get the dmq server socket in
    tm.<br>
    <br>
    Cheers,<br>
    Daniel<br>
    <br>
    <div class="moz-cite-prefix">On 15/10/14 15:41, Charles Chance
      wrote:<br>
    </div>
    <blockquote
cite="mid:CAOvxgzArgNqn3+HCVgLGeSw_8RsDwbru==_QKY+p+Du7X1fVjg@mail.gmail.com"
      type="cite">
      <div dir="ltr">Hi Victor,
        <div><br>
        </div>
        <div>I have now tested with Kamailio/DMQ listening on separate
          IPs and the added forcing of send socket appears to address
          the broken logic you describe.</div>
        <div><br>
        </div>
        <div>So I will commit the change shortly, unless you can see any
          problem with the proposed solution?</div>
        <div><br>
        </div>
        <div>Best regards,</div>
        <div><br>
        </div>
        <div>Charles</div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div class="gmail_extra"><br>
          <div class="gmail_quote">On 13 October 2014 23:04, Charles
            Chance <span dir="ltr"><<a moz-do-not-send="true"
                href="mailto:charles.chance@sipcentric.com"
                target="_blank">charles.chance@sipcentric.com</a>></span>
            wrote:<br>
            <blockquote class="gmail_quote" style="margin:0 0 0
              .8ex;border-left:1px #ccc solid;padding-left:1ex">
              <div dir="ltr">Hi Victor,
                <div><br>
                </div>
                <div>Have not had chance to test but can you try with
                  the following small patch (against master):</div>
                <div><br>
                </div>
                <div>
                  <div><font face="courier new, monospace">diff --git
                      a/modules/dmq/dmq_funcs.c
                      b/modules/dmq/dmq_funcs.c</font></div>
                  <div><font face="courier new, monospace">index
                      3c9c8c3..331591f 100644</font></div>
                  <div><font face="courier new, monospace">---
                      a/modules/dmq/dmq_funcs.c</font></div>
                  <div><font face="courier new, monospace">+++
                      b/modules/dmq/dmq_funcs.c</font></div>
                  <div><font face="courier new, monospace">@@ -370,6
                      +370,7 @@ error:</font></div>
                  <div><font face="courier new, monospace"> int
                      cfg_dmq_t_replicate(struct sip_msg* msg, char* s)</font></div>
                  <div><font face="courier new, monospace"> {</font></div>
                  <div><font face="courier new, monospace">       
                      dmq_node_t* node;</font></div>
                  <div><font face="courier new, monospace">+      
                      struct socket_info* sock;</font></div>
                  <div><font face="courier new, monospace">        int i
                      = 0;</font></div>
                  <div><font face="courier new, monospace"><br>
                    </font></div>
                  <div><font face="courier new, monospace">        /*
                      avoid loops - do not replicate if message has come
                      from another node</font></div>
                  <div><font face="courier new, monospace">@@ -381,6
                      +382,11 @@ int cfg_dmq_t_replicate(struct sip_msg*
                      msg, char* s)</font></div>
                  <div><font face="courier new, monospace">             
                        return -1;</font></div>
                  <div><font face="courier new, monospace">        }</font></div>
                  <div><font face="courier new, monospace"><br>
                    </font></div>
                  <div><font face="courier new, monospace">+       sock
                      = lookup_local_socket(&dmq_server_socket);</font></div>
                  <div><font face="courier new, monospace">+       if
                      (sock) {</font></div>
                  <div><font face="courier new, monospace">+            
                        set_force_socket(msg, sock);</font></div>
                  <div><font face="courier new, monospace">+       }</font></div>
                  <div><font face="courier new, monospace">+</font></div>
                  <div><font face="courier new, monospace">       
                      lock_get(&node_list->lock);</font></div>
                  <div><font face="courier new, monospace">        node
                      = node_list->nodes;</font></div>
                  <div><font face="courier new, monospace">       
                      while(node) {</font></div>
                </div>
                <div><br>
                </div>
                <div><br>
                </div>
                <div><br>
                </div>
                <div>Cheers,</div>
                <div><br>
                </div>
                <div>Charles</div>
                <div>
                  <div class="h5">
                    <div><br>
                    </div>
                    <div class="gmail_extra"><br>
                      <div class="gmail_quote">On 13 October 2014 14:05,
                        Victor V. Kustov <span dir="ltr"><<a
                            moz-do-not-send="true"
                            href="mailto:coyote@bks.tv" target="_blank">coyote@bks.tv</a>></span>
                        wrote:<br>
                        <blockquote class="gmail_quote" style="margin:0
                          0 0 .8ex;border-left:1px #ccc
                          solid;padding-left:1ex">Hi, Charles<br>
                          <br>
                          Main problem - usage t_replicate from TM
                          module. All TM funcs operate<br>
                          with main kamailio interface and socket, but
                          DMQ interfaces and sockets<br>
                          needed.<br>
                          <br>
                          <br>
                          --<br>
                           WBR, Victor<br>
                            JID: <a moz-do-not-send="true"
                            href="mailto:coyote@bks.tv" target="_blank">coyote@bks.tv</a><br>
                            JID: <a moz-do-not-send="true"
                            href="mailto:coyote@bryansktel.ru"
                            target="_blank">coyote@bryansktel.ru</a><br>
                          <div>
                            <div><br>
_______________________________________________<br>
                              sr-dev mailing list<br>
                              <a moz-do-not-send="true"
                                href="mailto:sr-dev@lists.sip-router.org"
                                target="_blank">sr-dev@lists.sip-router.org</a><br>
                              <a moz-do-not-send="true"
                                href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev"
                                target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev</a><br>
                            </div>
                          </div>
                        </blockquote>
                      </div>
                      <br>
                      <br clear="all">
                      <div><br>
                      </div>
                    </div>
                  </div>
                </div>
              </div>
            </blockquote>
          </div>
          <br>
          <div><br>
          </div>
        </div>
      </div>
      <br>
      <font face="Helvetica, Arial, sans-serif"><font size="2"><span
            style="font-size:10pt"><a moz-do-not-send="true"
              href="http://www.sipcentric.com/"
              title="blocked::http://www.sipcentric.com/"
              target="_blank">www.sipcentric.com</a><br>
            <br>
            Follow us on twitter <a moz-do-not-send="true"
              href="http://twitter.com/sipcentric"
              title="blocked::http://twitter.com/sipcentric"
              target="_blank">@sipcentric</a><br>
            <br>
            <font color="gray">Sipcentric Ltd. Company registered in
              England & Wales no. 7365592.</font> <font color="gray">Registered

              office: Faraday Wharf, Innovation Birmingham Campus, Holt
              Street, Birmingham Science Park, Birmingham B7 4BB.</font></span></font></font>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
sr-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:sr-dev@lists.sip-router.org">sr-dev@lists.sip-router.org</a>
<a 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 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>