<div dir="ltr">Some of my code for registration events in nodejs.. sorry, I didn't want to just throw it up - I don't really remember how it works and what other stuff is there.<div><br></div><div>var esl = require('modesl'); <br>
</div><div><br></div><div><div>var conn = new esl.Connection('127.0.0.1', 8021, 'ClueCon', 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>'sofia::register',<br></div><div><span class="" style="white-space:pre">                </span>'sofia::unregister',</div><div><span class="" style="white-space:pre">                </span>'sofia::register_attempt',</div>
<div><span class="" style="white-space:pre">                </span>'sofia::expire'</div><div><span class="" style="white-space:pre">                </span>], function() {</div><div><span class="" style="white-space:pre">                        </span>console.log("successfully subscribed");</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('CUSTOM',function show_heartbeat(data){<br>
</div><div><div><span class="" style="white-space:pre">        </span>if(data.body['Event-Subclass']=="sofia::register"){</div><div><span class="" style="white-space:pre">                </span>console.log('sofia register for user ' + data.body.username+ ' from ' +data.body['network-ip']);</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['Event-Subclass']=="sofia::unregister"){</div>
<div><span class="" style="white-space:pre">                </span>console.log('sofia DE-register for user ' + 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['Event-Subclass']=="sofia::register_attempt"){</div><div><span class="" style="white-space:pre">                </span>console.log('sofia register_attempt for user ' + data.body.username+ ' from ' +data.body['network-ip']);</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['Event-Subclass']=="sofia::expire"){</div>
<div><span class="" style="white-space:pre">                </span>var ip=['','',''];</div><div><span class="" style="white-space:pre">                </span>if(data.body && data.body.contact) ip=regexExpireContactIP.exec(data.body.contact);</div>
<div><span class="" style="white-space:pre">                </span>console.log('sofia EXPIRE for user ' + data.body.user + ', was via ' + ip[1]+':' + ip[2] + ', agent of ' + data.body['user-agent']);//@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 & 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"><<a href="mailto:alex@digitalmail.com" target="_blank">alex@digitalmail.com</a>></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'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'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'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"><<a href="mailto:steveayre@gmail.com" target="_blank">steveayre@gmail.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">Registration is expiration based - they
              expire unless you send another REGISTER within the expiry
              time.
              <div><br>
              </div>
              <div>I believe there's an ESL event when they expire that
                you can subscribe to, but I don'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"><<a href="mailto:alex@digitalmail.com" target="_blank">alex@digitalmail.com</a>></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 'internal' 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 "SIP
                      OPTIONS" 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>