<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[FOP2 & hot desking]]></title><description><![CDATA[<p dir="auto">I recently deployed a vanilla Asterisk 10 server with MySQL based hot desking (more or less as per the example here: <a href="http://ofps.oreilly.com/titles/9780596517342/asterisk-DB.html" rel="nofollow ugc">http://ofps.oreilly.com/titles/97805965 ... sk-DB.html</a>).  Since I'm not using the "private queue" workaround for the hot desk users, I don't really have a fixed device to monitor for my users other than a custom device I'm manipulating through dialplan magic, and FOP2 kicks a fuss if I try to tell it to use [Custom/${EXTEN}] (I fill in the substitution myself, but for example's sake...)</p>
<p dir="auto">Two questions:</p>
<ol>
<li>Is there a straightforward way for me to get FOP2 to monitor my users instead of a device?</li>
<li>Is there a supported way to get FOP2 to use the login credentials out of my existing MySQL database for the hotdesking, so I can let people have the same PIN for logging into both the phones and FOP2?</li>
</ol>
]]></description><link>http://localhost:4567/topic/1057/fop2-hot-desking</link><generator>RSS for Node</generator><lastBuildDate>Tue, 27 Oct 2026 08:09:29 GMT</lastBuildDate><atom:link href="http://localhost:4567/topic/1057.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 23 Feb 2012 13:19:52 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to FOP2 & hot desking on Sat, 25 Feb 2012 02:51:11 GMT]]></title><description><![CDATA[<p dir="auto">Thanks for your detailed example, I am sure it will help other users!</p>
<blockquote>
<p dir="auto">I do have two questions.  I see some reference in the documentation to "when fop2 is reloaded".  Is it possible to fire an event that will reload fop2 from within the Asterisk dialplan?</p>
</blockquote>
<p dir="auto">A module reload in asterisk should trigger a FOP2 reload too.</p>
<blockquote>
<p dir="auto">Related... If I am logged into FOP2 in IE when I change the buttons config file on the server and run service fop2 restart from the server CLI, when IE "reconnects" to FOP2, it doesn't pickup the changed buttons config (and usually this winds up with the "existing" buttons being horribly messed up).  Is there a way to fix this, or something I have misconfigured that is causing it?</p>
</blockquote>
<p dir="auto">The client is supposed to detect button configuration changes and force a reload when that happens, but now that I think of it, it might do that on reload only and not on restart. I will make some tests next monday/tuesday and try to remember to update this post with my findings.</p>
<p dir="auto">Best regards,</p>
]]></description><link>http://localhost:4567/post/4722</link><guid isPermaLink="true">http://localhost:4567/post/4722</guid><dc:creator><![CDATA[nicolas]]></dc:creator><pubDate>Sat, 25 Feb 2012 02:51:11 GMT</pubDate></item><item><title><![CDATA[Reply to FOP2 & hot desking on Sat, 25 Feb 2012 01:41:51 GMT]]></title><description><![CDATA[<p dir="auto">Thank you very much!  That worked as you said it should.</p>
<p dir="auto">My magics for other poor souls that might stumble across this via google or whatever...</p>
<ol>
<li>
<p dir="auto">For the sake of getting up and going, I manually created /AMPUSER/EXTEN/device: EXTEN entries in my AstDB.  I probably should set up some sort of bash script or something that goes through my hotdesk MySQL table and keeps the extensions up to date, but that'll be a "later" project.</p>
</li>
<li>
<p dir="auto">Within the dialplan, when a user successfully logs in, fire this dialplan logic (besides the part to log the user in).  Note that ${LOCATION} is the SIP device the user logged into, and ${E} is the user's extension.</p>
</li>
</ol>
<pre><code>same =&gt; n,UserEvent(UserDeviceAdded,${E},SIP/${LOCATION})
same =&gt; n,Set(DB(DEVICE/${E}/dial)=SIP/${LOCATION})
</code></pre>
<ol start="3">
<li>Within the dialplan, when a user successfully logs out, fire this dialplan logic (besides the part to log the user out).  NOte that ${LOCATION} is the SIP device the user logged out of, and ${E} is the user's extension.</li>
</ol>
<pre><code>same =&gt; n,UserEvent(UserDeviceRemoved,${E},SIP/${LOCATION})
same =&gt; n,Set(LOGOUT=${DB_DELETE(DEVICE/${E}/dial)})
</code></pre>
<ol start="4">
<li>Within the FOP2 config files:<br />
fop2.cfg:</li>
</ol>
<pre><code>#exec autousers.sh
buttonfile=autobuttons.cfg
</code></pre>
<p dir="auto"><a href="http://autousers.sh" rel="nofollow ugc">autousers.sh</a>:</p>
<pre><code>#!/bin/bash
DBNAME=MyDBName
DBUSER=MyDBUser
DBPASSWORD=MyDBPassword
DBHOST=MyDBHost

while read EXTEN PIN
do
	echo "user=${EXTEN}:${PIN}:all"
done &lt; &lt;(mysql -h ${DBHOST} ${DBNAME} -u ${DBUSER} -p${DBPASSWORD} -se "SELECT extension, pin FROM ast_hotdesk")
</code></pre>
<p dir="auto">autobuttons.cfg:</p>
<pre><code>#exec autobuttons.sh
*snip My Static Buttons (Queues, Trunks, etc)*
</code></pre>
<p dir="auto"><a href="http://autobuttons.sh" rel="nofollow ugc">autobuttons.sh</a>:</p>
<pre><code>#!/bin/bash
DBNAME=MyDBName
DBUSER=MyDBUser
DBPASSWORD=MyDBPassword
DBHOST=MyDBHost

while read EXTEN VMCONTEXT NAME
do
	echo "[USER/${EXTEN}]"
	echo "type=extension"
	echo "extension=${EXTEN}"
	echo "context=MyContext"
	echo "label=${NAME}"
	echo "mailbox=${EXTEN}@${VMCONTEXT}"
done &lt; &lt;(mysql -h ${DBHOST} ${DBNAME} -u ${DBUSER} -p${DBPASSWORD} -se "SELECT extension, vmcontext, cid_name FROM ast_hotdesk ORDER BY extension ASC")
</code></pre>
<p dir="auto">It's important to have cid_name <strong>last</strong> in your mysql query if you have spaces in your cid_names, otherwise the bash script will split on the space within the cid_name and everything will be messy.</p>
<hr />
<p dir="auto">I do have two questions.  I see some reference in the documentation to "when fop2 is reloaded".  Is it possible to fire an event that will reload fop2 from within the Asterisk dialplan?</p>
<p dir="auto">Related... If I am logged into FOP2 in IE when I change the buttons config file on the server and run service fop2 restart from the server CLI, when IE "reconnects" to FOP2, it doesn't pickup the changed buttons config (and usually this winds up with the "existing" buttons being horribly messed up).  Is there a way to fix this, or something I have misconfigured that is causing it?</p>
]]></description><link>http://localhost:4567/post/4721</link><guid isPermaLink="true">http://localhost:4567/post/4721</guid><dc:creator><![CDATA[DLNoah]]></dc:creator><pubDate>Sat, 25 Feb 2012 01:41:51 GMT</pubDate></item><item><title><![CDATA[Reply to FOP2 & hot desking on Fri, 24 Feb 2012 18:04:01 GMT]]></title><description><![CDATA[<p dir="auto">The button config file is easy, I posted the important part above:</p>
<p dir="auto">[USER/200]<br />
type=extension<br />
extension=200<br />
domain=from-internal<br />
label=John</p>
<p dir="auto">The hard part is to replicate the ASTDB entries and fire the proper UserEvents when a user logs in or out. I do not recall from memory, and it is not straightforward at all, it seems in FreePBX the feature was an after though or a kind of convoluted implementation, because there are several ASTDB entries to set/check.</p>
<p dir="auto">Here is an example entry:</p>
<p dir="auto">/AMPUSER/1002/device                              : 1002<br />
/DEVICE/1002/dial                                 : SIP/john</p>
<p dir="auto">Whit those entries, fop2 will monitor SIP/john for USER/1002</p>
<p dir="auto">Then the manager userevent should have this information when a user logs in or out:</p>
<p dir="auto">Event: UserDeviceAdded<br />
Data: 1002,SIP/john</p>
<p dir="auto">Event: UserDeviceRemoved<br />
Data: 1002,SIP/john</p>
<p dir="auto">Best regards,</p>
]]></description><link>http://localhost:4567/post/4720</link><guid isPermaLink="true">http://localhost:4567/post/4720</guid><dc:creator><![CDATA[nicolas]]></dc:creator><pubDate>Fri, 24 Feb 2012 18:04:01 GMT</pubDate></item><item><title><![CDATA[Reply to FOP2 & hot desking on Thu, 23 Feb 2012 23:06:46 GMT]]></title><description><![CDATA[<p dir="auto">Okay, thank you.  Does anyone have a sample of what the buttons.cfg file winds up "looking like" in device&amp;user mode for FreePBX to give me a nudge in the right direction?</p>
]]></description><link>http://localhost:4567/post/4719</link><guid isPermaLink="true">http://localhost:4567/post/4719</guid><dc:creator><![CDATA[DLNoah]]></dc:creator><pubDate>Thu, 23 Feb 2012 23:06:46 GMT</pubDate></item><item><title><![CDATA[Reply to FOP2 & hot desking on Thu, 23 Feb 2012 16:48:16 GMT]]></title><description><![CDATA[<p dir="auto">Fop2 supports hotdesking via freepbx device&amp;user mode, if you can replicate that in your setup, fop2 will work, the button definition will have to be</p>
<p dir="auto">[USER/200]</p>
<p dir="auto">The thing is that the mode in freepbx requires several astdb entries to be set in a kind of unorganized manner, and also userevents in the manager should be fired whenever a user logs in or out.</p>
<p dir="auto">Regarding the user/passwords, you can customize the <a href="http://autoconfig-users-freepbx.sh" rel="nofollow ugc">autoconfig-users-freepbx.sh</a> to your needs or write any custom script accesing any kind of database or system.</p>
<p dir="auto">Best regards,</p>
]]></description><link>http://localhost:4567/post/4718</link><guid isPermaLink="true">http://localhost:4567/post/4718</guid><dc:creator><![CDATA[nicolas]]></dc:creator><pubDate>Thu, 23 Feb 2012 16:48:16 GMT</pubDate></item></channel></rss>