Skip Ribbon Commands
Skip to main content

Caller ID, YAC, XBMC and Asterisk

OK, so you have an Asterisk box and you want to send Caller ID to your Apple TV's that are running XBMC and also have the caller ID information popup on all your computers in the network.  There are a few lines of code to add to your extensions_custom.conf on Asterisk to make this work.
 
You will also need to install nc (netcat) and wget on your Asterisk server if they are not already there.
 
Just add the following code at the end of your config. Also this won't cause internal calls to trigger the script, only incoming external calls.
 
[from-pstn-custom]
exten => _.,1,Gosub(cidlookup,cidlookup_1,1)
exten => _.,n,System(echo -n -e "@CALL${CALLERID(name)} ~${CALLERID(number)}" | nc -w 1 192.168.0.1 10629 &)
exten => _.,n,System(wget --delete-after --tries=1 --timeout=1 http://192.168.0.103:8080/xbmcCmds/xbmcHttp?command=ExecBuiltIn\\(Notification\\("${CALLERID(name)}",${CALLERID(number)},15000,${CALLERID(number)}.jpg\\)\\) &)
exten => _.,n,System(wget --delete-after --tries=1 --timeout=1 http://192.168.0.103:8080/xbmcCmds/xbmcHttp?command=Pause &)
 
In the example above I have a PC at 192.168.0.1 and an Apple TV2 running XBMC at 192.168.0.103. I send the callerid to the PC and then the XBMC and then I send the command to pause the XBMC.  The notification time can be adjusted by changeing the 15000 (15 second) to whatever you want.  You'll want to create a JPG image for all your friends and store them on the Apple TV.  For example, name the image 5851239191.jpg.