<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Crossed Wires &#187; freepbx</title>
	<atom:link href="http://veejoe.net/blog/tag/freepbx/feed/" rel="self" type="application/rss+xml" />
	<link>http://veejoe.net/blog</link>
	<description>Vic's Blog</description>
	<lastBuildDate>Fri, 04 May 2012 13:31:28 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>FreePBX device-and-user mode, part two</title>
		<link>http://veejoe.net/blog/2009/07/freepbx-device-and-user-mode-part-two/</link>
		<comments>http://veejoe.net/blog/2009/07/freepbx-device-and-user-mode-part-two/#comments</comments>
		<pubDate>Sun, 12 Jul 2009 09:53:21 +0000</pubDate>
		<dc:creator>Vic</dc:creator>
				<category><![CDATA[Telephony]]></category>
		<category><![CDATA[asterisk]]></category>
		<category><![CDATA[freepbx]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[phone]]></category>
		<category><![CDATA[voip]]></category>

		<guid isPermaLink="false">http://veejoe.net/blog/?p=5407</guid>
		<description><![CDATA[In part one, I described how I reconsidered device-and-user mode in FreePBX, and did the initial changeover.  Read on to find out how I overcame a major issue with the configuration! I have an ISDN phone line coming into my Asterisk system.  One of the indials is for our home number, the other is one [...]]]></description>
			<content:encoded><![CDATA[<address>In <a title="Revisiting device-and-user mode in FreePBX" href="http://veejoe.net/blog/2009/07/revisiting-device-and-user-mode-in-freepbx/" target="_self">part one</a>, I described how I reconsidered device-and-user mode in FreePBX, and did the initial changeover.  Read on to find out how I overcame a major issue with the configuration!</address>
<p>I have an ISDN phone line coming into my Asterisk system.  One of the indials is for our home number, the other is one I use for work.  Before I found FreePBX, I had manually worked the Asterisk dialplan to have calls made from my work phone(s) appear from the work phone number&#8211;useful not just for Caller-ID, but also required for the long-distance provider I use to bill calls for work.  With FreePBX I was able to use a custom context to pre-select a route that dialled the provider override prefix to send the calls through the other provider, but it was a bit of a hack using hand-written dialplan code and a bit of luck.</p>
<p>Before I changed to device-and-user, I naively assumed that FreePBX would allow a user to be associated with a context in the same way a device/extension can be.  This is not the case, and the context of the device is still used for routing.  This meant that I could not use a device for either work or personal calls without having to log onto FreePBX and change the device context (logging on as the work user was not enough).  I was back to square one&#8230;</p>
<p>I did a little research.  Firstly, I rediscovered how I was making the existing routing work.  The ISDN interface I use (driven by <strong>chan_capi</strong> in Asterisk) simply uses the outgoing caller-id of the call to select from available MSNs[1].  So I had one route that had the &#8220;normal&#8221; MSN set as the outbound caller-id, another route with the &#8220;work&#8221; MSN (plus the rewrites to add the long-distance override code at the front), and a custom context for the work devices that made only the route with the work MSN available.</p>
<p>Looking more closely at the user definition page, I saw that there is an &#8220;Outgoing Caller-ID&#8221; field.  By using this field, I was able to do away with the separate route and the custom context and set the work MSN there instead.  This gives me just what I need: a way to control my outbound MSN on a per-user basis!  This got me half-way there, as I still needed a way to set the long-distance override codes for work calls.  A bit more research turned up a predialling macro hook that the FreePBX folks made available.  With a bit of code to test the caller-id and the number dialled (the long distance company doesn&#8217;t handle free calls, for instance) I get just what I need.</p>
<p>Here&#8217;s the macro hook (this is added to extensions_custom.conf):</p>
<blockquote>
<pre>[macro-dialout-trunk-predial-hook]
exten =&gt; s,1,NoOp(Trunk is ${OUT_${DIAL_TRUNK}}, CallerID ${CALLERID(num)} calling ${OUTNUM} )
exten =&gt; s,n,GotoIf($["${CALLERID(num)}" != "xxxxxxxxx"]?endit)
exten =&gt; s,n,GotoIf($["${OUT_${DIAL_TRUNK}:4:11}" != "CAPI/contr1"]?endit)
exten =&gt; s,n,GotoIf($["${OUTNUM}:0:4}" = "1800"]?endit)
exten =&gt; s,n,Set(OUTNUM=1xxx${OUTNUM})
exten =&gt; s,n(endit),MacroExit()</pre>
</blockquote>
<p>So I&#8217;m now a happy device-and-user user!</p>
<address>[1] Actually I don&#8217;t know if that&#8217;s chan_capi doing it for me or whether it&#8217;s just the way the ISDN network works.</address>
]]></content:encoded>
			<wfw:commentRss>http://veejoe.net/blog/2009/07/freepbx-device-and-user-mode-part-two/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Revisiting device-and-user mode in FreePBX</title>
		<link>http://veejoe.net/blog/2009/07/revisiting-device-and-user-mode-in-freepbx/</link>
		<comments>http://veejoe.net/blog/2009/07/revisiting-device-and-user-mode-in-freepbx/#comments</comments>
		<pubDate>Sun, 12 Jul 2009 09:49:09 +0000</pubDate>
		<dc:creator>Vic</dc:creator>
				<category><![CDATA[Telephony]]></category>
		<category><![CDATA[asterisk]]></category>
		<category><![CDATA[freepbx]]></category>
		<category><![CDATA[linkedin]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[phone]]></category>
		<category><![CDATA[voip]]></category>

		<guid isPermaLink="false">http://veejoe.net/blog/?p=5405</guid>
		<description><![CDATA[Buoyed by the success of a colleague I introduced to Asterisk and FreePBX a little while ago, I decided to have another look at the extension configuration mode I use on our system. Check this post for a recap of the FreePBX configuration modes and my first thoughts. Last time I looked at this I [...]]]></description>
			<content:encoded><![CDATA[<p>Buoyed by the success of a colleague I introduced to Asterisk and FreePBX a little while ago, I decided to have another look at the extension configuration mode I use on our system.</p>
<address>Check <a title="FreePBX Modes" href="http://veejoe.net/blog/2007/10/freepbx-modes/" target="_blank">this post</a> for a recap of the FreePBX configuration modes and my first thoughts.</address>
<p>Last time I looked at this I thought there were some problems with the way it was implemented that meant it didn&#8217;t work for my installation, so I ended up hacking together a mess of fake extensions, ring groups and queues that more-or-less reimplemented the good parts of device-and-user mode and still letting me use things from extensions mode.  Doing this however meant that FreePBX always complained about what it called &#8220;invalid destinations&#8221;, and I had to use some custom logic for doing something simple like a common voicemail access number.</p>
<p>What won me over to device-and-user mode again though was the ability to log a device on and off from a number.  I have a couple of Nokia handsets that have SIP clients now, and it&#8217;s handy to just have one device that all my work calls (for example) arrive on.  After-hours though, I didn&#8217;t want that device to still be tied up to the work line; it made more sense to be able to use that device for home calls.  To do that with extensions mode and my ring-group hack would mean reprogramming the ring-group (and one other change, which I&#8217;ll talk about later) when I wanted to switch over.  Presumably I could write some script or AGI logic that I could tie to a feature code in FreePBX, but I&#8217;d simply be making more custom modifications for little real gain.</p>
<p>In the end, I realised that the main thing keeping me in extensions mode&#8211;the ability to call a device by it&#8217;s &#8220;extension&#8221; number regardless of who&#8217;s logged on to it&#8211;wasn&#8217;t something I used often enough to warrant all the work I&#8217;d have to do to make extensions mode do what I needed.  With that in mind, I edited <strong>amportal.conf</strong> and made the all-important change:</p>
<blockquote>
<pre>AMPEXTENSIONS=deviceanduser</pre>
</blockquote>
<p>I had to reload the FreePBX admin page a couple of times, but eventually the &#8220;Extensions&#8221; tab changed into two tabs, &#8220;Devices&#8221; and &#8220;Users&#8221;.  True to the description of extension and device-and-user modes given in the FreePBX doco, the Devices and Users tabs had the same number of entries.  All I needed to do was delete the users that were no longer required (i.e. almost all of them) and the devices that belonged to the voicemail extensions from my original setup.  I then ran through each of the device definitions and correctly assigned them as either &#8220;Fixed&#8221; (statically allocated to a user) or &#8220;Ad-Hoc&#8221; (able to be logged on to a user).</p>
<p>This was the point at which I worked out a solution to my original dial-a-device-directly problem.  I realised that the majority of times I need that functionality is when testing.  So, for those devices that I use for testing, I left the user definition in place and made it the &#8220;default&#8221; user for that device.  This means that when I log out of the real user from that device it is reachable by the default user number, and I can dial it directly for testing.  The other use for direct-connection to a device, the intercom, requires a separate SIP endpoint anyway (due to the Cisco phones not adhering to the SIP command for remote off-hook) so I need to keep those as separate users too.</p>
<p>I&#8217;m quite happy with how it&#8217;s turned out&#8211;at least, I was once I&#8217;d overcome the showstopper I found!  Read about that in <a title="FreePBX device-and-user mode part two" href="http://veejoe.net/blog/2009/07/freepbx-device-and-user-mode-part-two/" target="_self">part two</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://veejoe.net/blog/2009/07/revisiting-device-and-user-mode-in-freepbx/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>FreePBX modes</title>
		<link>http://veejoe.net/blog/2007/10/freepbx-modes/</link>
		<comments>http://veejoe.net/blog/2007/10/freepbx-modes/#comments</comments>
		<pubDate>Tue, 30 Oct 2007 00:26:30 +0000</pubDate>
		<dc:creator>Vic</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[asterisk]]></category>
		<category><![CDATA[freepbx]]></category>
		<category><![CDATA[voip]]></category>

		<guid isPermaLink="false">http://veejoe.net/blog/?p=631</guid>
		<description><![CDATA[When I first set up FreePBX, I was frustrated by the inability to create a voicemail user independently of an extension.&#160;&#160;It looked to me like an office system, where each handset was associated with an individual and had its own voicemail.&#160;&#160;In the end I created a few extensions that were not associated with handsets and [...]]]></description>
			<content:encoded><![CDATA[<p>When I first set up <a href="http://www.freepbx.org">FreePBX</a>, I was frustrated by the inability to create a voicemail user independently of an extension.&nbsp;&nbsp;It looked to me like an office system, where each handset was associated with an individual and had its own voicemail.&nbsp;&nbsp;In the end I created a few extensions that were not associated with handsets and used them as the voicemail boxes (I disabled voicemail on all other extensions) and wrote a custom dialplan entry to work out which voicemail box was associated with the &#8220;usual&#8221; user of each handset.&nbsp;&nbsp;Works fine, even if I have to check each upgrade of FreePBX doesn&#8217;t knock out my custom dialplan stuff.</p>
<p>Recently though, I found that FreePBX does indeed have an alternate programming method that matches up with my original intended use.&nbsp;&nbsp;The default method is called &#8220;Extensions&#8221; mode, while the different method is called &#8220;Device-and-User&#8221;.&nbsp;&nbsp;The extensions mode, in effect, creates a user for every device defined, and calls it an extension.&nbsp;&nbsp;The device-and-user mode however allows you to configure each separately.&nbsp;&nbsp;Your device configurations are simply end-points for your handsets (SIP definitions for example) and users are the entities you actually want to reach (i.e. people).</p>
<p>A device can be either &#8220;Fixed&#8221;, where it is always associated with a particular user, or it can be &#8220;Ad-hoc&#8221;.&nbsp;&nbsp;An ad-hoc device allows a user to log on to the device and receive their calls at that device.&nbsp;&nbsp;A user can be logged on to multiple devices at once, or even a mixture of fixed and ad-hoc devices.</p>
<p>I was really excited by this, as it seemed that I could replace everything I had set up with my extra extensions and associated Ring Groups by just switching to device-and-user.&nbsp;&nbsp;There is a little snag though &#8212; even though devices still have to have a numeric name that looks just like an extension, it is not available to the dialplan in its own right.&nbsp;&nbsp;If I have configured my ATA-attached cordless phone as device 852, I cannot dial 852 and make it ring.&nbsp;&nbsp;I can only dial whatever user number the device is associated with, which in turn means that if no-one is logged-in to an ad-hoc device there is no way to make it ring.&nbsp;&nbsp;Also, a device can only be associated with one user at a time.</p>
<p>I have auto-answer SIP presences on all the handsets that support it, which I use as a two-way intercom system.&nbsp;&nbsp;This supplements FreePBX&#8217;s Paging facility which I use for broadcast, one-way announcements to all (such as &#8220;dinner is on the table!).&nbsp;&nbsp;I couldn&#8217;t switch to device-and-user mode completely, as I would lose the ability to selectively dial devices such as the intercom lines that would not be associated with a user (or would need to be associated with more than one user to support both paging and intercom).</p>
<p>So for now I&#8217;m sticking with what I&#8217;ve got.&nbsp;&nbsp;I like device-and-user, but by not making the device&#8217;s number addressable in the dialplan they&#8217;re eliminating a lot of flexibility and possible functionality.&nbsp;&nbsp;When we moved into our current home I ripped out much of the builder&#8217;s phone wiring and replaced it because I didn&#8217;t want all my phones in parallel&#8230; that&#8217;s what device-and-user feels like right now: everything in parallel.&nbsp;&nbsp;I&#8217;ll keep an eye on it though&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://veejoe.net/blog/2007/10/freepbx-modes/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

