<div dir="ltr">I have a lua script that does this:<div><br></div><div><div>function extension_registered(domain_name, sip_profile, extension)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>api = freeswitch.API();</div>

<div><span class="Apple-tab-span" style="white-space:pre">        </span>result = api:execute(&quot;sofia_contact&quot;, sip_profile..&quot;/&quot;..extension..&quot;@&quot;..domain_name);</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>if (result == &quot;error/user_not_registered&quot;) then</div>

<div><span class="Apple-tab-span" style="white-space:pre">                </span>return false;</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>else</div><div><span class="Apple-tab-span" style="white-space:pre">                </span>return true;</div>

<div><span class="Apple-tab-span" style="white-space:pre">        </span>end</div><div>end</div></div><div><br></div><div>IIRC, you can hardcode the sip_profile to * and just drop the @domain_name part.</div><div><br></div><div>

<span style="font-family:Verdana,Arial,Helvetica,sans-serif">-Avi</span></div><div><br><div class="gmail_quote">On Tue, Jul 30, 2013 at 6:22 PM, James Lotery <span dir="ltr">&lt;<a href="mailto:jlotery@gmail.com" target="_blank">jlotery@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">Hello, I&#39;m trying to detect if a user is online within a lua script called from a chatplan. <div><br>

</div><div>From what I&#39;ve read I should use sofia_contact in the chatplan, save the output in a custom channel variable and read the variable in my lua script. However as there is no session object active i don&#39;t see an easy way to read my custom channel variable from within my lua script.</div>


<div><br></div><div>How would you more experienced folks out there do this? I just want to know if the user is offline, so that I can send the message via other means if they are etc.</div><div><br></div><div>Thanks in advance</div>

<span class="HOEnZb"><font color="#888888">
<div><br></div><div>James</div></font></span></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></div>