Mollien dot Net is IPv6 Enabled!


   My About.Me page
   View my profile on LinkedIn
   Follow me on Twitter
    View my Facebook profile   View my Hyves profile   View my YouTube favorites and uploads

      01010011
      01100101
      01110010
      01101001
      01101111
      01110101
      01110011
      01000111
      01100101
      01100101
      01101011

IPv6 Certification Badge for Cas Mollien
 


 
FreePBX
 
Broadcasting CallerID through FreePBX
 
I've been looking for a way to get CallerID broadcasted to various machines (and mechanisms) in my home and found that at the time of this writing, November 2009, there is no mechanism for broadcasting CallerID built in to FreePBX.

What I was looking for is a way to send CID info to my Ubuntu box through the standard notification options and to send CID info to my media center boxes, Mediaportal on Windows using the YAC plugin and XBMC on AppleTV using the built-in web server 'notifications' mechanism.

Therefore, I could not use any proprietary programs, or programs that limit me to a desktop system.

There are several hacks around the internet that show how to get something like this going, some of which I have used with various levels of success over time, but all of them seem to break sooner rather then later, or just don't offer the flexibility and ease-of-use that I would like to see.

If you are using ring groups for incoming calls, like I do, you can add an 'extension' to the ring group that takes care of the broadcast through a custom environment in the configs. The ability to create custom environments has been included in FreePBX since (at least) their 'Asterisk Management Portal' days and is very stable.

By taking this approach, you can use any mechanism available on your OS, for any reason you want to, without being stuck to a single system.

Here's how I did it:

Decide on an extension number that you will likely never use. For me, that would be ****999.

Add this extension to the ring group that you use for incoming calls, and add a pound-sign (hash for you Brits) at the end (do not reload yet):
****999#

Now, edit /etc/asterisk/extensions_custom.conf and add a custom environment by adding:

[from-internal-custom]
exten => ****999,1,NoOp("Sending CID notifications: ${CALLERID(all)}")
exten => ****999,n,NoOp("Sending CID notification over XMPP/Jabber")
exten => ****999,n,System(/bin/echo -n "Asterisk: There is an incoming call from ${CALLERID(name)} (${CALLERID(num)})" \| /usr/bin/sendxmpp-new -f /path/to/.sendxmpprc recipient@jabber.org)
exten => ****999,n,NoOp("Sending CID notification to AppleTV-XBMC")
exten => ****999,n,System(/path/to/send-curl.sh "INCOMING CALL" "From: ${CALLERID(name)} (${CALLERID(num)})")
exten => ****999,n,NoOp("Sending CID notification to Ubuntu box using libnotify over SSH")
exten => ****999,n,System(/usr/bin/ssh -i /path/to/id_rsa_asterisk user@ubuntu-workstation "export DISPLAY=:0 && /usr/bin/notify-send \\\"Asterisk\\\" \\\"There is an incoming call from ${CALLERID(name)} (${CALLERID(num)})\\\" -i notification-message-im" &)
exten => ****999,n,NoOp("Sending CID notification to YAC client")
exten => ****999,n,System(echo -e "'Call received on ${MyDNID} from ${CALLERID(name)} with number ${CALLERID(number)}'" | nc -w 1 mediacenter 1235)
exten => ****999,n,Busy


When you are done editing, 'reload' the extensions within FreePBX and make a few test calls (start with dialing 7777).

All the things you see above are examples of tests that I have ran and know are working. Let you creativity run wild and create something even better.

If you do create something better, please let me know! :-)




*** send-curl is a simple bash-script that posts to the XBMC web interface using curl, containing:

#!/bin/bash
# $1 is the subject
# $2 is the message

/usr/bin/curl -uusername:password http://xbmcbox:8080/xbmcCmds/xbmcHttp --data-urlencode "command=ExecBuiltIn(Notification($1, $2))"


 
Found this script/snippet useful? Please consider buying me a beer - or something else useful..
 

 
Terug naar Mollien Dot Net

Terug naar Mollien Dot Net

Terug naar Mollien Dot Net
Total Hits: 1
Unique Visitors: 1
Page Impressions : 1
Remote address: 54.82.56.95