<div dir="ltr">Some of my code for registration events in nodejs.. sorry, I didn&#39;t want to just throw it up - I don&#39;t really remember how it works and what other stuff is there.<div><br></div><div>var esl = require(&#39;modesl&#39;); <br>

</div><div><br></div><div><div>var conn = new esl.Connection(&#39;127.0.0.1&#39;, 8021, &#39;ClueCon&#39;, connectedToESL);</div><div><br></div><div><br></div><div>function connectedToESL(){</div><div><span class="" style="white-space:pre">        </span>conn.subscribe([<br>

</div><div><span class="" style="white-space:pre">                </span>&#39;sofia::register&#39;,<br></div><div><span class="" style="white-space:pre">                </span>&#39;sofia::unregister&#39;,</div><div><span class="" style="white-space:pre">                </span>&#39;sofia::register_attempt&#39;,</div>

<div><span class="" style="white-space:pre">                </span>&#39;sofia::expire&#39;</div><div><span class="" style="white-space:pre">                </span>], function() {</div><div><span class="" style="white-space:pre">                        </span>console.log(&quot;successfully subscribed&quot;);</div>

<div><span class="" style="white-space:pre">                        </span>});</div><div>}</div></div><div><br></div><div>var regexExpireContactIP=/@([^:]*):(\d*)/;<br></div><div><br></div><div>client.on(&#39;CUSTOM&#39;,function show_heartbeat(data){<br>

</div><div><div><span class="" style="white-space:pre">        </span>if(data.body[&#39;Event-Subclass&#39;]==&quot;sofia::register&quot;){</div><div><span class="" style="white-space:pre">                </span>console.log(&#39;sofia register for user &#39; + data.body.username+ &#39; from &#39; +data.body[&#39;network-ip&#39;]);</div>

<div><span class="" style="white-space:pre">                </span>//console.log(data.body);</div><div><br></div><div><span class="" style="white-space:pre">                </span>}</div><div><span class="" style="white-space:pre">        </span>else if(data.body[&#39;Event-Subclass&#39;]==&quot;sofia::unregister&quot;){</div>

<div><span class="" style="white-space:pre">                </span>console.log(&#39;sofia DE-register for user &#39; + data.body.username);</div><div><span class="" style="white-space:pre">                </span>//console.log(data.body);</div><div>
<span class="" style="white-space:pre">                </span>}</div>
<div><span class="" style="white-space:pre">        </span>else if(data.body[&#39;Event-Subclass&#39;]==&quot;sofia::register_attempt&quot;){</div><div><span class="" style="white-space:pre">                </span>console.log(&#39;sofia register_attempt for user &#39; + data.body.username+ &#39; from &#39; +data.body[&#39;network-ip&#39;]);</div>

<div><span class="" style="white-space:pre">                </span>//console.log(data.body);</div><div><span class="" style="white-space:pre">                </span>}</div><div><span class="" style="white-space:pre">        </span>else if(data.body[&#39;Event-Subclass&#39;]==&quot;sofia::expire&quot;){</div>

<div><span class="" style="white-space:pre">                </span>var ip=[&#39;&#39;,&#39;&#39;,&#39;&#39;];</div><div><span class="" style="white-space:pre">                </span>if(data.body &amp;&amp; data.body.contact) ip=regexExpireContactIP.exec(data.body.contact);</div>

<div><span class="" style="white-space:pre">                </span>console.log(&#39;sofia EXPIRE for user &#39; + data.body.user + &#39;, was via &#39; + ip[1]+&#39;:&#39; + ip[2] + &#39;, agent of &#39; + data.body[&#39;user-agent&#39;]);//@data.host<br>

</div><div><br></div><div><span class="" style="white-space:pre">                </span>}</div></div><div>}</div><div><br></div></div><div class="gmail_extra"><br clear="all"><div><div dir="ltr"><span style="font-family:Verdana,Arial,Helvetica,sans-serif;font-size:small">-Avi Marcus</span><br>

<br><span style="font-family:Verdana,Arial,Helvetica,sans-serif">1-718-989-9485 (USA)</span><font face="Verdana, Arial, Helvetica, sans-serif"><br></font><div><font face="Verdana, Arial, Helvetica, sans-serif">1-866-202-5850 (USA &amp; Canada Toll Free)</font><br>

<font face="Verdana, Arial, Helvetica, sans-serif"></font><span style="font-family:Verdana,Arial,Helvetica,sans-serif;font-size:small">02-372-</span><span style="font-family:Verdana,Arial,Helvetica,sans-serif;font-size:13px;line-height:15px;white-space:pre;background-color:rgb(255,255,255)">1570</span><span style="font-family:Verdana,Arial,Helvetica,sans-serif;font-size:small"> (Israel)<br>

</span><span style="font-family:Verdana,Arial,Helvetica,sans-serif"><span style="font-size:small">020-3298-2875 (UK)</span></span></div></div></div>
<br><br><div class="gmail_quote">On Mon, Jun 9, 2014 at 6:13 PM, Alex Lake <span dir="ltr">&lt;<a href="mailto:alex@digitalmail.com" target="_blank">alex@digitalmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


  
    
  
  <div text="#000000" bgcolor="#FFFFFF">
    <div>Oooh, that&#39;d be my first one - scary!<br>
      Your logic sounds extremely plausible.<br>
      Suspect that ESL subscription would be the technically correct way
      to do it, though.<br>
      I think a logged warning for failed OPTIONS request seems more
      obvious, but I may as well put in both.<br>
      <br>
      Cheers<div><div class="h5"><br>
      <br>
      On 09/06/2014 15:07, Steven Ayre wrote:<br>
    </div></div></div>
    <blockquote type="cite"><div><div class="h5">
      <div dir="ltr">You could file a wishlist Jira... if the event is
        raised then it&#39;d be trivial to log at the same time.
        <div><br>
        </div>
        <div>The registration logs are there to support fail2ban so that
          you can automatically block attacks... that could explain why
          there&#39;s no logging of deregistration at present, since only
          the former is needed for fail2ban.</div>
      </div>
      <div class="gmail_extra"><br>
        <br>
        <div class="gmail_quote">On 9 June 2014 15:06, Steven Ayre <span dir="ltr">&lt;<a href="mailto:steveayre@gmail.com" target="_blank">steveayre@gmail.com</a>&gt;</span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div dir="ltr">Registration is expiration based - they
              expire unless you send another REGISTER within the expiry
              time.
              <div><br>
              </div>
              <div>I believe there&#39;s an ESL event when they expire that
                you can subscribe to, but I don&#39;t think it appears in
                the logs.</div>
            </div>
            <div>
              <div>
                <div class="gmail_extra"><br>
                  <br>
                  <div class="gmail_quote">On 9 June 2014 14:41, Alex
                    Lake <span dir="ltr">&lt;<a href="mailto:alex@digitalmail.com" target="_blank">alex@digitalmail.com</a>&gt;</span>
                    wrote:<br>
                    <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
                      Is there a way to get the console to show end-user
                      registrations and<br>
                      de-registrations as they happen?<br>
                      <br>
                      I note that registrations are OK, you get
                      something like this:<br>
                      <br>
                      2014-06-09 13:37:44.091960 [WARNING]
                      sofia_reg.c:1541 SIP auth challenge<br>
                      (REGISTER) on sofia profile &#39;internal&#39; for<br>
                      [<a href="mailto:1129301@004-1129.sb12.dmclub.org" target="_blank">1129301@004-1129.sb12.dmclub.org</a>]
                      from ip 84.92.90.149<br>
                      <br>
                      But de-registrations are very quiet.<br>
                      <br>
                      Also, is there an api command to send a &quot;SIP
                      OPTIONS&quot; message to a<br>
                      particular registered session?<br>
                      <br>
_________________________________________________________________________<br>
                      Professional FreeSWITCH Consulting Services:<br>
                      <a href="mailto:consulting@freeswitch.org" target="_blank">consulting@freeswitch.org</a><br>
                      <a href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a><br>
                      <br>
                      FreeSWITCH-powered IP PBX: The CudaTel
                      Communication Server<br>
                      <a href="http://www.cudatel.com" target="_blank">http://www.cudatel.com</a><br>
                      <br>
                      Official FreeSWITCH Sites<br>
                      <a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
                      <a href="http://wiki.freeswitch.org" target="_blank">http://wiki.freeswitch.org</a><br>
                      <a href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a><br>
                      <br>
                      FreeSWITCH-users mailing list<br>
                      <a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a><br>
                      <a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
                      UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
                      <a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
                    </blockquote>
                  </div>
                  <br>
                </div>
              </div>
            </div>
          </blockquote>
        </div>
        <br>
      </div>
      <br>
      <fieldset></fieldset>
      <br>
      <pre>_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
<a href="mailto:consulting@freeswitch.org" target="_blank">consulting@freeswitch.org</a>
<a href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a>

FreeSWITCH-powered IP PBX: The CudaTel Communication Server
<a href="http://www.cudatel.com" target="_blank">http://www.cudatel.com</a>

Official FreeSWITCH Sites
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a>
<a href="http://wiki.freeswitch.org" target="_blank">http://wiki.freeswitch.org</a>
<a href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a>

FreeSWITCH-users mailing list
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org" target="_blank">FreeSWITCH-users@lists.freeswitch.org</a>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a>
</pre>
      <br>
      <fieldset></fieldset>
      <br>
      </div></div><p color="#000000" align="left">No virus
        found in this message.<br>
        Checked by AVG - <a href="http://www.avg.com" target="_blank">www.avg.com</a><br>
        Version: 2014.0.4570 / Virus Database: 3955/7646 - Release Date:
        06/09/14</p>
    </blockquote>
    <br>
  </div>

<br>_________________________________________________________________________<br>
Professional FreeSWITCH Consulting Services:<br>
<a href="mailto:consulting@freeswitch.org">consulting@freeswitch.org</a><br>
<a href="http://www.freeswitchsolutions.com" target="_blank">http://www.freeswitchsolutions.com</a><br>
<br>
FreeSWITCH-powered IP PBX: The CudaTel Communication Server<br>
<a href="http://www.cudatel.com" target="_blank">http://www.cudatel.com</a><br>
<br>
Official FreeSWITCH Sites<br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<a href="http://wiki.freeswitch.org" target="_blank">http://wiki.freeswitch.org</a><br>
<a href="http://www.cluecon.com" target="_blank">http://www.cluecon.com</a><br>
<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
<br></blockquote></div><br></div>