<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Hi Charles, <br>
    <br>
    Thanks for the information, I was intending to use dmq_is_from_node
    as a security check to ensure that the dmq message arrived from a
    node that it saw as part of the notification address list (excluding
    itself of course). <br>
    <br>
    I see that it is not intended to be used this way. I'll build on
    your snippet along with ipops to check these messages.<br>
    <br>
    Thanks again.<br>
    <br>
    <div class="moz-cite-prefix">On 22/07/2015 15:46, Charles Chance
      wrote:<br>
    </div>
    <blockquote
cite="mid:CAOvxgzDYgKB=9GGTFJ8VVsDrzG67ay6mbrZGTYUXsy_4GjAo-Q@mail.gmail.com"
      type="cite">
      <div dir="ltr">Hi,
        <div><br>
        </div>
        <div>This is expected. The point of DMQ is to enable dynamic
          scaling without having to define every node in advance in
          Kamailio config.</div>
        <div><br>
        </div>
        <div>You should not use dmq_is_from_node() with
          dmq_handle_message() - it is not intended to be a security
          check for KDMQ messages, but for other messages replicated
          directly in your config (e.g. REGISTER).</div>
        <div><br>
        </div>
        <div>For KDMQ, you should listen on a dedicated IP and/or port
          and lock down at network/firewall level. Then your DMQ
          handling block should look something like:</div>
        <div><br>
        </div>
        <div>
          <div>        if (method == "KDMQ") {</div>
          <div>                if ($Rp == 5070) {</div>
          <div>                        dmq_handle_message();<br>
          </div>
          <div>                } else {</div>
          <div>                        drop;</div>
          <div>                }</div>
          <div>        }</div>
        </div>
        <div><br>
        </div>
        <div>Do this help? Or is there something else you're looking to
          achieve?</div>
        <div><br>
        </div>
        <div>Cheers,</div>
        <div>Charles</div>
        <div><br>
        </div>
        <div class="gmail_extra"><br>
          <div class="gmail_quote">On 22 July 2015 at 15:22, Asgaroth <span
              dir="ltr"><<a moz-do-not-send="true"
                href="mailto:00asgaroth00@gmail.com" target="_blank">00asgaroth00@gmail.com</a>></span>
            wrote:<br>
            <blockquote class="gmail_quote" style="margin:0 0 0
              .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi All,<br>
              <br>
              I have an issue with the dmq_is_from_node() function,
              whereby it does not detect a node is on the bus if it has
              been removed from its "table" due to previously failed, i
              presume, ping requests.<br>
              <br>
              I have the following snippet in my main routing block:<br>
              <br>
              if(is_method("KDMQ")) {<br>
                      if (dmq_is_from_node()) {<br>
                          dmq_handle_message();<br>
                          exit;<br>
                      } else {<br>
                          xlog("L_INFO", "KDMQ message recieved from
              node not on our bus!! ($si:$sp) Dropping.");<br>
                          exit;<br>
                      }<br>
                  }<br>
              <br>
              I have the following dmq module parameters enabled for
              dmq:<br>
              <br>
              modparam("dmq", "server_address", DMQ_ADDRESS)<br>
              modparam("dmq", "notification_address", "sip:<a
                moz-do-not-send="true" href="http://lb.domain.com:5060"
                rel="noreferrer" target="_blank">lb.domain.com:5060</a>")<br>
              modparam("dmq", "multi_notify", 1)<br>
              modparam("dmq", "num_workers", 4)<br>
              <br>
              DMQ_ADDRESS is set to each of the addresses in the <a
                moz-do-not-send="true" href="http://lb.domain.com"
                rel="noreferrer" target="_blank">lb.domain.com</a> for
              each local kamailio instance<br>
              <br>
              <a moz-do-not-send="true" href="http://lb.domain.com"
                rel="noreferrer" target="_blank">lb.domain.com</a>
              resolves to the following addresses:<br>
                  10.6.0.109<br>
                  10.6.0.110<br>
                  10.6.0.111<br>
              <br>
              If I start up the 1st instance of kamailio and do not
              start the other 2 within the default ping timout then I
              get the expected log message of dmq removing the nodes
              from its table, for example:<br>
              <br>
              kamailio[26657]: ERROR: dmq [notification_peer.c:588]:
              notification_resp_callback_f(): deleting server sip:<a
                moz-do-not-send="true" href="http://10.6.0.111:5060"
                rel="noreferrer" target="_blank">10.6.0.111:5060</a>
              because of failed request<br>
              kamailio[26657]: ERROR: dmq [notification_peer.c:588]:
              notification_resp_callback_f(): deleting server sip:<a
                moz-do-not-send="true" href="http://10.6.0.110:5060"
                rel="noreferrer" target="_blank">10.6.0.110:5060</a>
              because of failed request<br>
              <br>
              However, if I then start one, or both, of the other nodes,
              then the KDMQ requests are dropped due to my snippet
              above, I presume, because dmq_is_from_node() checks its
              "active" table. See messages below as an example of the
              above snippet in action:<br>
              <br>
              kamailio[26656]: INFO: <script>: KDMQ message
              recieved from node not on our bus!! (<a
                moz-do-not-send="true" href="http://10.6.0.110:5060"
                rel="noreferrer" target="_blank">10.6.0.110:5060</a>)
              Dropping.<br>
              kamailio[26656]: INFO: <script>: KDMQ message
              recieved from node not on our bus!! (<a
                moz-do-not-send="true" href="http://10.6.0.111:5060"
                rel="noreferrer" target="_blank">10.6.0.111:5060</a>)
              Dropping.<br>
              <br>
              Is this expected behaviour from the dmq_is_from_node()
              function? I would have expected it to always check the
              addresses resolved in the notification address, or am I
              using this function in a manner not intended.<br>
              <br>
              Any suggestions/tips would be greatly appreciated.<br>
              <br>
              Thanks<br>
              <br>
              <br>
              _______________________________________________<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"
                target="_blank">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"
                rel="noreferrer" target="_blank">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a><br>
            </blockquote>
          </div>
          <br>
          <br clear="all">
          <div><br>
          </div>
        </div>
      </div>
      <br>
      <div><font face="Helvetica, Arial, sans-serif"><font size="2"><b>**
              We're rebranding! Learn more <a moz-do-not-send="true"
                href="http://www.sipcentric.com/2015/07/were-rebranding/"
                target="_blank">here</a> **</b></font></font></div>
      <div><br>
      </div>
      <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="">_______________________________________________
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>