<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix"><tt>Hi Michele,</tt><tt><br>
      </tt><tt><br>
      </tt><tt>The problem in your script is that you do not handle the
        sequential (in-dialog) SUBSCRIBE requests (as you have the
        second one in your </tt><tt>trace, ending with 404 and
        terminating the subscription).</tt><tt><br>
      </tt><tt><br>
      </tt><tt>In the " if ( has_totag() ) " </tt><tt>block, you have:</tt><tt>   
      </tt><tt><br>
      </tt><tt>    </tt><tt>} else {</tt>
      <div class="de1"><tt>        if (is_method("SUBSCRIBE") &amp;&amp;
          $rd == "127.0.0.1:5060") { # CUSTOMIZE ME</tt><tt><br>
        </tt><tt><br>
        </tt><tt>The $rd detection does not cover all your cases, as you
          configure the presence module to advertise as SIP contact "</tt><tt><a
            moz-do-not-send="true" class="moz-txt-link-rfc2396E"
            href="mailto:sip:presence@voip.unisi.it:5060">si<font
              color="#000000">p:presence@voip.unisi.it:5060</font></a></tt><tt>".
          So, the test fails.</tt><tt><br>
        </tt><tt><br>
        </tt><tt>You can adapt the test like:</tt><tt><br>
        </tt><tt>        if (is_method("SUBSCRIBE") &amp;&amp; $rd ==
          "voip.unisi.it") { # CUSTOMIZE ME</tt><tt><br>
        </tt><tt><br>
        </tt><tt>Or set the contact in presence with the real IP:</tt><tt><br>
        </tt><tt>        </tt><tt>modparam("presence",
          "server_address", <a class="moz-txt-link-rfc2396E" href="mailto:sip:presence@127.0.0.1:5060">"sip:presence@127.0.0.1:5060"</a>)</tt></div>
      <tt><br>
        Best regards,<br>
      </tt>
      <pre class="moz-signature" cols="72">Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
<a class="moz-txt-link-freetext" href="http://www.opensips-solutions.com">http://www.opensips-solutions.com</a></pre>
      On 24.02.2015 12:04, Michele Pinassi wrote:<br>
    </div>
    <blockquote cite="mid:54EC4C92.8040204@unisi.it" type="cite">
      <meta http-equiv="content-type" content="text/html;
        charset=windows-1252">
      Hi all,<br>
      <br>
      <meta http-equiv="content-type" content="text/html;
        charset=windows-1252">
      I'm still stuck on this issue: BLF not working. For example, on my
      SNOM 760 (ext 5002) i activated BLF for some ext, like 5020. Using
      SIPGREP i saw:<br>
      <b><br>
      </b><b>SUBSCRIBE <a moz-do-not-send="true"
          class="moz-txt-link-abbreviated"
          href="mailto:sip:5020@voip.unisi.it;user=phone">sip:5020@voip.unisi.it;user=phone</a>
        SIP/2.0.</b><br>
      Via: SIP/2.0/UDP
      172.20.1.10:57286;branch=z9hG4bK-nprg3gvnk4q1;rport.<br>
      From: <a moz-do-not-send="true" class="moz-txt-link-rfc2396E"
        href="mailto:sip:5002@voip.unisi.it:5060">&lt;sip:5002@voip.unisi.it:5060&gt;</a>;tag=nyux2omhly.<br>
      To: <a moz-do-not-send="true" class="moz-txt-link-rfc2396E"
        href="mailto:sip:5020@voip.unisi.it;user=phone">&lt;sip:5020@voip.unisi.it;user=phone&gt;</a>.<br>
      Call-ID: 3944ec54dc20-pfzjpjhrpm6p.<br>
      CSeq: 2 SUBSCRIBE.<br>
      Max-Forwards: 70.<br>
      Contact: <a moz-do-not-send="true" class="moz-txt-link-rfc2396E"
        href="mailto:sip:5002@172.20.1.10:57286">&lt;sip:5002@172.20.1.10:57286&gt;</a>;reg-id=1.<br>
      Event: dialog.<br>
      Accept: application/dialog-info+xml.<br>
      User-Agent: snom760/8.7.3.25.9.<br>
      Proxy-Authorization: Digest <br>
      Expires: 3600.<br>
      Content-Length: 0.<br>
      <br>
      <b>SIP/2.0 200 OK.</b><br>
      Via: SIP/2.0/UDP
172.20.1.10:57286;received=172.20.1.10;branch=z9hG4bK-nprg3gvnk4q1;rport=57286.<br>
      From: <a moz-do-not-send="true" class="moz-txt-link-rfc2396E"
        href="mailto:sip:5002@voip.unisi.it:5060">&lt;sip:5002@voip.unisi.it:5060&gt;</a>;tag=nyux2omhly.<br>
      To:
      <a moz-do-not-send="true" class="moz-txt-link-rfc2396E"
        href="mailto:sip:5020@voip.unisi.it;user=phone">&lt;sip:5020@voip.unisi.it;user=phone&gt;</a>;tag=f315b2d58ae8829149b784764c5a40e3-163d.<br>
      Call-ID: 3944ec54dc20-pfzjpjhrpm6p.<br>
      CSeq: 2 SUBSCRIBE.<br>
      Expires: 3600.<br>
      Contact: <a moz-do-not-send="true" class="moz-txt-link-rfc2396E"
        href="mailto:sip:presence@voip.unisi.it:5060">&lt;sip:presence@voip.unisi.it:5060&gt;</a>.<br>
      Server: OpenSIPS (1.11.3-tls (i386/linux)).<br>
      Content-Length: 0.<br>
      <br>
      <b>NOTIFY <a moz-do-not-send="true"
          class="moz-txt-link-abbreviated"
          href="mailto:sip:5002@172.20.1.10:57286">sip:5002@172.20.1.10:57286</a>
        SIP/2.0.</b><br>
      Via: SIP/2.0/UDP 172.20.1.2:5060;branch=z9hG4bKdb02.83d58916.0.<br>
      To: <a moz-do-not-send="true" class="moz-txt-link-rfc2396E"
        href="mailto:sip:5002@voip.unisi.it">&lt;sip:5002@voip.unisi.it&gt;</a>;tag=nyux2omhly.<br>
      From:
      <a moz-do-not-send="true" class="moz-txt-link-rfc2396E"
        href="mailto:sip:5020@voip.unisi.it">&lt;sip:5020@voip.unisi.it&gt;</a>;tag=f315b2d58ae8829149b784764c5a40e3-163d.<br>
      CSeq: 1 NOTIFY.<br>
      Call-ID: 3944ec54dc20-pfzjpjhrpm6p.<br>
      Max-Forwards: 70.<br>
      Content-Length: 147.<br>
      User-Agent: OpenSIPS (1.11.3-tls (i386/linux)).<br>
      Event: dialog.<br>
      Contact: <a moz-do-not-send="true" class="moz-txt-link-rfc2396E"
        href="mailto:sip:presence@voip.unisi.it:5060">&lt;sip:presence@voip.unisi.it:5060&gt;</a>.<br>
      Subscription-State: active;expires=3600.<br>
      Content-Type: application/dialog-info+xml.<br>
      .<br>
      &lt;?xml version="1.0"?&gt;<br>
      &lt;dialog-info xmlns="urn:ietf:params:xml:ns:dialog-info"
      version="0" state="full" entity=<a moz-do-not-send="true"
        class="moz-txt-link-rfc2396E"
        href="mailto:sip:5020@voip.unisi.it">"sip:5020@voip.unisi.it"</a>/&gt;<br>
      <b><br>
      </b><b>SIP/2.0 200 Ok.</b><br>
      Via: SIP/2.0/UDP 172.20.1.2:5060;branch=z9hG4bKdb02.83d58916.0.<br>
      From:
      <a moz-do-not-send="true" class="moz-txt-link-rfc2396E"
        href="mailto:sip:5020@voip.unisi.it">&lt;sip:5020@voip.unisi.it&gt;</a>;tag=f315b2d58ae8829149b784764c5a40e3-163d.<br>
      To: <a moz-do-not-send="true" class="moz-txt-link-rfc2396E"
        href="mailto:sip:5002@voip.unisi.it">&lt;sip:5002@voip.unisi.it&gt;</a>;tag=nyux2omhly.<br>
      Call-ID: 3944ec54dc20-pfzjpjhrpm6p.<br>
      CSeq: 1 NOTIFY.<br>
      Content-Length: 0.<br>
      <br>
      <b>SUBSCRIBE <a moz-do-not-send="true"
          class="moz-txt-link-abbreviated"
          href="mailto:sip:presence@voip.unisi.it:5060">sip:presence@voip.unisi.it:5060</a>
        SIP/2.0.</b><br>
      Via: SIP/2.0/UDP
      172.20.1.25:32768;branch=z9hG4bK-lbgnea3kuorq;rport.<br>
      From: <a moz-do-not-send="true" class="moz-txt-link-rfc2396E"
        href="mailto:sip:5007@voip.unisi.it:5060">&lt;sip:5007@voip.unisi.it:5060&gt;</a>;tag=w8vp9q5iyn.<br>
      To:
      <a moz-do-not-send="true" class="moz-txt-link-rfc2396E"
        href="mailto:sip:5002@voip.unisi.it;user=phone">&lt;sip:5002@voip.unisi.it;user=phone&gt;</a>;tag=f315b2d58ae8829149b784764c5a40e3-29cc.<br>
      Call-ID: 54ec3a578c9e-klgn0s3i32zo.<br>
      CSeq: 75 SUBSCRIBE.<br>
      Max-Forwards: 70.<br>
      Contact: <a moz-do-not-send="true" class="moz-txt-link-rfc2396E"
        href="mailto:sip:5007@172.20.1.25:32768">&lt;sip:5007@172.20.1.25:32768&gt;</a>;reg-id=1.<br>
      Event: dialog.<br>
      Accept: application/dialog-info+xml.<br>
      User-Agent: snom710/8.7.3.25.9.<br>
      Expires: 3600.<br>
      Content-Length: 0.<br>
      <b><br>
      </b><b>SIP/2.0 404 Not here.</b><br>
      Via: SIP/2.0/UDP
172.20.1.25:32768;received=172.20.1.25;branch=z9hG4bK-lbgnea3kuorq;rport=32768.<br>
      From: <a moz-do-not-send="true" class="moz-txt-link-rfc2396E"
        href="mailto:sip:5007@voip.unisi.it:5060">&lt;sip:5007@voip.unisi.it:5060&gt;</a>;tag=w8vp9q5iyn.<br>
      To:
      <a moz-do-not-send="true" class="moz-txt-link-rfc2396E"
        href="mailto:sip:5002@voip.unisi.it;user=phone">&lt;sip:5002@voip.unisi.it;user=phone&gt;</a>;tag=f315b2d58ae8829149b784764c5a40e3-29cc.<br>
      Call-ID: 54ec3a578c9e-klgn0s3i32zo.<br>
      CSeq: 75 SUBSCRIBE.<br>
      Server: OpenSIPS (1.11.3-tls (i386/linux)).<br>
      Content-Length: 0.<br>
      <br>
      <b>NOTIFY <a moz-do-not-send="true"
          class="moz-txt-link-abbreviated"
          href="mailto:sip:5002@172.20.1.10:57286">sip:5002@172.20.1.10:57286</a>
        SIP/2.0.</b><br>
      Via: SIP/2.0/UDP 172.20.1.2:5060;branch=z9hG4bKdbe9.7966c706.0.<br>
      To: <a moz-do-not-send="true" class="moz-txt-link-rfc2396E"
        href="mailto:sip:5002@voip.unisi.it">&lt;sip:5002@voip.unisi.it&gt;</a>;tag=iklb1qjh1v.<br>
      From:
      <a moz-do-not-send="true" class="moz-txt-link-rfc2396E"
        href="mailto:sip:5007@voip.unisi.it">&lt;sip:5007@voip.unisi.it&gt;</a>;tag=f315b2d58ae8829149b784764c5a40e3-b571.<br>
      CSeq: 2 NOTIFY.<br>
      Call-ID: ee35ec54a72b-draf1nwo4qn7.<br>
      Max-Forwards: 70.<br>
      Content-Length: 0.<br>
      User-Agent: OpenSIPS (1.11.3-tls (i386/linux)).<br>
      Event: dialog.<br>
      Contact: <a moz-do-not-send="true" class="moz-txt-link-rfc2396E"
        href="mailto:sip:presence@voip.unisi.it:5060">&lt;sip:presence@voip.unisi.it:5060&gt;</a>.<br>
      <b>Subscription-State: terminated;reason=timeout.</b><br>
      <b><br>
      </b><b>SIP/2.0 200 Ok.</b><br>
      Via: SIP/2.0/UDP 172.20.1.2:5060;branch=z9hG4bKdbe9.7966c706.0.<br>
      From:
      <a moz-do-not-send="true" class="moz-txt-link-rfc2396E"
        href="mailto:sip:5007@voip.unisi.it">&lt;sip:5007@voip.unisi.it&gt;</a>;tag=f315b2d58ae8829149b784764c5a40e3-b571.<br>
      To: <a moz-do-not-send="true" class="moz-txt-link-rfc2396E"
        href="mailto:sip:5002@voip.unisi.it">&lt;sip:5002@voip.unisi.it&gt;</a>;tag=iklb1qjh1v.<br>
      Call-ID: ee35ec54a72b-draf1nwo4qn7.<br>
      CSeq: 2 NOTIFY.<br>
      Content-Length: 0.<br>
      <br>
      The line 5020 was active but no lamp was powered. Also no NOTIFY
      or other event was sent by Opensips server when i try to call
      (from another phone) 5020.<br>
      <br>
      The full opensips.cfg is available here: <a
        moz-do-not-send="true" class="moz-txt-link-freetext"
        href="http://pastebin.com/e6SfbFfq">http://pastebin.com/e6SfbFfq</a><br>
      <br>
      Thanks for any help.<br>
      <br>
      Michele<br>
      <br>
      <pre class="moz-signature" cols="72">-- 
Michele Pinassi
Responsabile Telefonia di Ateneo
Servizio Reti, Sistemi e Sicurezza Informatica - Universitą degli Studi di Siena
tel: 0577.(23)5000 - fax: 0577.(23)2053

Per trovare una soluzione rapida ai tuoi problemi tecnici
consulta le FAQ di Ateneo, <a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://www.faq.unisi.it">http://www.faq.unisi.it</a> </pre>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a>
<a class="moz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>