<?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>Dave's Occasional Brainfart &#187; FreePBX</title>
	<atom:link href="http://blog.kayosdesign.com/category/voip/asterisk/freepbx/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.kayosdesign.com</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Sat, 08 May 2010 07:21:39 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Openfire/Jabber/FreePBX integration #2</title>
		<link>http://blog.kayosdesign.com/2010/01/06/openfirejabberfreepbx-integration-2/</link>
		<comments>http://blog.kayosdesign.com/2010/01/06/openfirejabberfreepbx-integration-2/#comments</comments>
		<pubDate>Wed, 06 Jan 2010 06:55:06 +0000</pubDate>
		<dc:creator>Dave</dc:creator>
				<category><![CDATA[Asterisk]]></category>
		<category><![CDATA[FreePBX]]></category>
		<category><![CDATA[Openfire]]></category>
		<category><![CDATA[VoIP]]></category>

		<guid isPermaLink="false">http://blog.kayosdesign.com/?p=133</guid>
		<description><![CDATA[Having played some more I&#8217;ve come up with the following solution &#8211; I&#8217;m not overly happy with it but it allows me to get what I wanted. All of the following occurs in extensions_override_freepbx.conf NOTE: This assumes you have gotten the Openfire Asterisk-IM plugin working and that you have jabber.conf configured correctly to talk to [...]]]></description>
			<content:encoded><![CDATA[<p>Having played some more I&#8217;ve come up with the following solution &#8211; I&#8217;m not overly happy with it but it allows me to get what I wanted.<br />
All of the following occurs in extensions_override_freepbx.conf<br />
<strong>NOTE:</strong> This assumes you have gotten the <a href="/category/linux/openfire/" title="View all posts filed under Openfire">Openfire</a> <a href="/category/voip/asterisk/" title="View all posts filed under Asterisk">Asterisk</a>-IM plugin working and that you have jabber.conf configured correctly to talk to your openfire server.</p>
<h3><a href="/category/voip/asterisk/" title="View all posts filed under Asterisk">Asterisk</a> obeying <a href="/category/linux/openfire/" title="View all posts filed under Openfire">Openfire</a> Status</h3>
<p>eg. When you mark yourself as away/DND inbound calls will be directed to Voicemail.</p>
<p>This inserts itself into the standard <a href="/category/voip/asterisk/freepbx/" title="View all posts filed under FreePBX">FreePBX</a> call queue for internal calls. I haven&#8217;t got an inbound link setup yet so I haven&#8217;t figured out how to get that bit working.</p>
<p>The jabber-notify block must contain every extension in the system this is to work on. It could be altered to return to the normal call path if a desired extension isn&#8217;t in the list &#8211; but I haven&#8217;t implemented that.</p>
<p>Basically a call to an extension picks up the appropriate jabber information and runs the macro &#8220;reach_user_with_presence&#8221;. There is probably some way to hook this into a db/ldap server so you don&#8217;t have to enter everyone in manually.</p>
<p>This then checks the users jabber status and if they are not available it jumps to their voicemail. Else it returns to the normal call path.</p>
<pre lang="bash">[from-internal]
include =&gt; jabber-notify

[jabber-notify]
;include =&gt; macro-reach_user_with_presence
exten =&gt; 10,1,Macro(reach_user_with_presence,user10@jabber.kayosdesign.com,${EXTEN})
exten =&gt; 11,1,Macro(reach_user_with_presence,user20@jabber.kayosdesign.com,${EXTEN})
exten =&gt; 12,1,Macro(reach_user_with_presence,user30@jabber.kayosdesign.com,${EXTEN})
exten =&gt; 13,1,Macro(reach_user_with_presence,user40@jabber.kayosdesign.com,${EXTEN})

[from-internal-original]
include =&gt; from-internal-xfer
include =&gt; bad-number

[macro-reach_user_with_presence]
; ${ARG1} is a jabber address such as test@jabber.server
; ${ARG2} is the voicemail box of the user

exten =&gt; s,1,jabberstatus(asterisk,${ARG1},STATUS)
;presence in will be 1-6.
;In order : Online, Chatty, Away, XAway, DND, Offline
;If not in roster variable will = 7
exten =&gt; s,n,gotoif($[$[${STATUS}]&lt;3]?available:unavailable) ;GotoIf(condition?label_if_true:label_if_false) ;exten =&gt; s,n(available),jabbersend(asterisk,${ARG2},"Call from ${CALLERID(name)} at number ${CALLERID(num)} on ${STRFTIME(,GMT-1,%A %B %d %G at %l:%M:%S %p)}")
exten =&gt; s,n(available),Goto(from-internal-original,${ARG2},1)
exten =&gt; s,n(unavailable),VoiceMail(${ARG2},u)
exten =&gt; s,1,Goto(from-internal-original,s,1)
exten =&gt; h,1,Macro(hangupcall)</pre>
<h3>Call groups being notified by jabber for inbound calls.</h3>
<p>We utilise the Counterpath Bria softphone. It&#8217;s a bit stupid and does not follow ALERT notifications such as  different ring tones.  As such there is no way for a user to know if an inbound call is implicitely for them or if it is coming in on the call group.</p>
<p>As such I hooked <a href="/category/voip/asterisk/" title="View all posts filed under Asterisk">Asterisk</a> into jabber to broadcast a message to all people in the call group. I don&#8217;t particularly like this as you cannot create call groups dynamically using the <a href="/category/voip/asterisk/freepbx/" title="View all posts filed under FreePBX">FreePBX</a> interface. If you do create one you <span style="text-decoration: underline;">MUST</span> rebuild this section appropriately. Basically all it does is override the default settings and sends out an IM to everyone listed (you have to add each individual in the group to the ext-group section), after that it returns to the setup created by <a href="/category/voip/asterisk/freepbx/" title="View all posts filed under FreePBX">FreePBX</a>.</p>
<pre>[ext-group]
exten =&gt; 330,1,jabbersend(asterisk,user10@jabber.kayosdesign.com,"Group call")
exten =&gt; 330,n,jabbersend(asterisk,user20@jabber.kayosdesign.com,"Group call")

exten =&gt; 330,n,Goto(ext-group-original,330,1)

[ext-group-original]
exten =&gt; 330,1,Macro(user-callerid,)
exten =&gt; 330,n,GotoIf($["foo${BLKVM_OVERRIDE}" = "foo"]?skipdb)
exten =&gt; 330,n,GotoIf($["${DB(${BLKVM_OVERRIDE})}" = "TRUE"]?skipov)
exten =&gt; 330,n(skipdb),Set(__NODEST=)
exten =&gt; 330,n,Set(__BLKVM_OVERRIDE=BLKVM/${EXTEN}/${CHANNEL})
exten =&gt; 330,n,Set(__BLKVM_BASE=${EXTEN})
exten =&gt; 330,n,Set(DB(${BLKVM_OVERRIDE})=TRUE)
exten =&gt; 330,n(skipov),Set(RRNODEST=${NODEST})
exten =&gt; 330,n(skipvmblk),Set(__NODEST=${EXTEN})
exten =&gt; 330,n,Set(RecordMethod=Group)
exten =&gt; 330,n,Macro(record-enable,11-13,${RecordMethod})
exten =&gt; 330,n,Set(RingGroupMethod=ringall)
exten =&gt; 330,n,Set(__ALERT_INFO='\\;info=ring_two')

exten =&gt; 330,n(DIALGRP),Macro(dial,20,${DIAL_OPTIONS},11-13)
exten =&gt; 330,n,Set(RingGroupMethod=)
exten =&gt; 330,n,GotoIf($["foo${RRNODEST}" != "foo"]?nodest)
exten =&gt; 330,n,Set(__NODEST=)
exten =&gt; 330,n,dbDel(${BLKVM_OVERRIDE})
exten =&gt; 330,n,Hangup
exten =&gt; 330,n(nodest),Noop(SKIPPING DEST, CALL CAME FROM Q/RG: ${RRNODEST})</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.kayosdesign.com/2010/01/06/openfirejabberfreepbx-integration-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Asterisk &#8211; Jabber integration</title>
		<link>http://blog.kayosdesign.com/2009/12/31/asterisk-jabber-integration/</link>
		<comments>http://blog.kayosdesign.com/2009/12/31/asterisk-jabber-integration/#comments</comments>
		<pubDate>Thu, 31 Dec 2009 00:03:33 +0000</pubDate>
		<dc:creator>Dave</dc:creator>
				<category><![CDATA[Asterisk]]></category>
		<category><![CDATA[FreePBX]]></category>
		<category><![CDATA[Openfire]]></category>
		<category><![CDATA[VoIP]]></category>

		<guid isPermaLink="false">http://blog.kayosdesign.com/?p=112</guid>
		<description><![CDATA[I have a test server running Asterisk &#38; Openfire. Integrating Openfire to Asterisk was pretty simple using the Asterisk-IM plugin. It is configured and working using the documentation provided by Openfire. No when someone receives/makes a call Openfire updates their IM status to &#8220;On the phone&#8221;. However, it does not appear to be bi-directional eg. [...]]]></description>
			<content:encoded><![CDATA[<p>I have a test server running <a href="/category/voip/asterisk/" title="View all posts filed under Asterisk">Asterisk</a> &amp; <a href="/category/linux/openfire/" title="View all posts filed under Openfire">Openfire</a>. Integrating <a href="/category/linux/openfire/" title="View all posts filed under Openfire">Openfire</a> to <a href="/category/voip/asterisk/" title="View all posts filed under Asterisk">Asterisk</a> was pretty simple using the <a href="/category/voip/asterisk/" title="View all posts filed under Asterisk">Asterisk</a>-IM plugin.</p>
<p>It is configured and working using the documentation provided by <a href="/category/linux/openfire/" title="View all posts filed under Openfire">Openfire</a>. No when someone receives/makes a call <a href="/category/linux/openfire/" title="View all posts filed under Openfire">Openfire</a> updates their IM status to &#8220;On the phone&#8221;.</p>
<p>However, it does not appear to be bi-directional eg. Setting jabber status to DND does not tell <a href="/category/voip/asterisk/" title="View all posts filed under Asterisk">Asterisk</a> to send your calls to voicemail.</p>
<p>Having played with the config I now have bi directional communication between asterisk/openfire working within the <a href="/category/voip/asterisk/freepbx/" title="View all posts filed under FreePBX">FreePBX</a> framework.</p>
<p>The code below will check extensions to see what their status is in jabber before passing the call on to them.</p>
<p>If they are flagged as available, the server will send them an IM telling them about the incoming call &amp; then pass the call through.</p>
<p>If they are not available, the server will direct the incoming call to voicemail.</p>
<p>editing extensions_custom.conf you need the following</p>
<pre>[from-internal-custom]
include =&gt; macro-reach_user_with_presence
exten =&gt; 10,1,Macro(reach_user_with_presence,SIP/10,test@jabber.server,${EXTEN})
[macro-reach_user_with_presence]
; ${ARG1} is a destination such as SIP/10
; ${ARG2} is a jabber address such as test@jabber.server
; ${ARG3} is the voicemail box of the user

exten =&gt; s,1,jabberstatus(asterisk,${ARG2},STATUS)
;presence in will be 1-6.
;In order : Online, Chatty, Away, XAway, DND, Offline
;If not in roster variable will = 7
exten =&gt; s,n,gotoif($[$[${STATUS}]&lt;3]?available:unavailable)
;GotoIf(condition?label_if_true:label_if_false)
exten =&gt; s,n(available),jabbersend(asterisk,${ARG2},"Call from ${CALLERID(name)} at number ${CALLERID(num)} on ${STRFTIME(,GMT-1,%A %B %d %G at %l:%M:%S %p)}")
exten =&gt; s,n,Goto(from-trunk,${ARG3},1)
exten =&gt; s,n(unavailable),VoiceMail(${ARG3},u)</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.kayosdesign.com/2009/12/31/asterisk-jabber-integration/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Integrating Jabber into Asterisk with FreePBX</title>
		<link>http://blog.kayosdesign.com/2009/12/31/integrating-jabber-into-asterisk-with-freepbx/</link>
		<comments>http://blog.kayosdesign.com/2009/12/31/integrating-jabber-into-asterisk-with-freepbx/#comments</comments>
		<pubDate>Wed, 30 Dec 2009 23:58:48 +0000</pubDate>
		<dc:creator>Dave</dc:creator>
				<category><![CDATA[Asterisk]]></category>
		<category><![CDATA[FreePBX]]></category>

		<guid isPermaLink="false">http://blog.kayosdesign.com/?p=109</guid>
		<description><![CDATA[I was poking around with Asterisk trying to hook it into an Openfire XMPP server and get Asterisk to send IMs when various events happen. I have Asterisk set up as a Jabber client by setting the following in jabber.conf [asterisk] type=client serverhost=jabber.server username=asterisk@jabber.server/AsteriskServer secret=password port=5222 usetls=yes usesasl=yes statusmessage="Asterisk Test Server" The more interesting part [...]]]></description>
			<content:encoded><![CDATA[<p>I was poking around with <a href="/category/voip/asterisk/" title="View all posts filed under Asterisk">Asterisk</a> trying to hook it into an <a href="/category/linux/openfire/" title="View all posts filed under Openfire">Openfire</a> XMPP server and get <a href="/category/voip/asterisk/" title="View all posts filed under Asterisk">Asterisk</a> to send IMs when various events happen.</p>
<p>I have <a href="/category/voip/asterisk/" title="View all posts filed under Asterisk">Asterisk</a> set up as a Jabber client by setting the following in jabber.conf</p>
<pre>[asterisk]
type=client
serverhost=jabber.server
username=asterisk@jabber.server/<a href="/category/voip/asterisk/" title="View all posts filed under Asterisk">Asterisk</a>Server
secret=password
port=5222
usetls=yes
usesasl=yes
statusmessage="<a href="/category/voip/asterisk/" title="View all posts filed under Asterisk">Asterisk</a> Test Server"</pre>
<p>The more interesting part came when trying to get <a href="/category/voip/asterisk/" title="View all posts filed under Asterisk">Asterisk</a> to send messages to Jabber clients for incoming calls. I found a lot of information on the web on how to do it, but not where to put the config when you&#8217;re using <a href="/category/voip/asterisk/freepbx/" title="View all posts filed under FreePBX">FreePBX</a>.  It turned out to be fairly simple in the end.</p>
<p>Editing the extensions_custom.conf put int he following code.</p>
<pre>[from-internal-custom]
exten =&gt; 10,1,jabbersend(asterisk,user@jabber.server,"Call from ${CALLERID(name)} at number ${CALLERID(num)} on ${STRFTIME(,GMT-1,%A %B %d %G at %l:%M:%S %p)}")
exten =&gt; _X!,n,Goto(from-trunk,${EXTEN},1)</pre>
<p>This sends an IM to user@jabber.server whenever they get an incoming call.</p>
<p>It could probably be improved to look up the appropriate user for the extension with a DB lookup (which means you&#8217;d only need one bit of code for all extensions) but I wouldn&#8217;t have a clue how to go about it.</p>
<p>The next step is to identify when an incoming call is for that extension in particular or if it&#8217;s a ring group.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.kayosdesign.com/2009/12/31/integrating-jabber-into-asterisk-with-freepbx/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
