How To : CallerID display on MythDora from FreePBX / Asterisk

  • user warning: Table './drupal_gding/cache_filter' is marked as crashed and should be repaired query: SELECT data, created, headers, expire, serialized FROM cache_filter WHERE cid = '1:534b9395fbecf2a21dc72171940878c8' in /var/www/mythdora/html/includes/cache.inc on line 26.
  • user warning: Table './drupal_gding/cache_filter' is marked as crashed and should be repaired query: UPDATE cache_filter SET data = '<p>After spending countless hours trying to put together the the right way to display Caller ID info onscreen on my MythDora frontends I finally accomplished it. In an effort to save others the same amount of trial and error I am documenting how this is accomplished. Sort of a payback for all the help I have received from others over the years. The steps are all from various online sources and I give full credit to those that have put together the individual steps. What I have done that I could not find anywhere was a comprehensive sequence to follow especially for MythDora. As always YMMV but the WAF I have received after just a few days has been well worth it.</p>\n<p>For those who don\'t know, Asterisk is a VOIP telephone systems that is run on linux and is free just like MythTV. It can be used to connect your local intranet directly to a VOIP provider thereby elimimnating AT&amp;T. The number of features is fantastic and it can be run from a relatively low powered computer. It is kind of like Vonage but without the proprietory software or hardware. While you can connect up regular analog telephones using adaptors between the computer and the phone these can be a little pricey. If you replace your analog phones with VoIP phones then no additional harware is required. I am using IP phones by Cisco in my home and one of the best features is whole house hands-free intercom. FreePBX is a web enabled GUI for Asterisk and has replaced the previous version called Asterisk@Home. A one touch installation is contained in \"PBX in a Flash\" (PiaF) which, like MythDora consists of a bootable CD image which loads Centos OS and a host of other apps to make a simple and functional FreePBX deployment. For more details see <a href=\"http://pbxinaflash.com/\" class=\"bb-url\">the PiaF website</a>. For CallerID, VoIP is nice because the information is immediately available when the phone starts ringing unlike traditional POTS callerID which usually have a delay until the second ring.</p>\n<p>For my setup I am using PiaF ver 1.4 and MythDora 10.21. Both the Piaf and MythDora backend are on dedeicated machiones and I have multiple separate MythDora frontends. This assumes you have MythDora installed and running and FreePBX installed and operational. you also need to have a Ring Goup setup in FeePBX.</p>\n<p>Lets start by setting up FreePBX to send the CallerID to the individual frontends. We will configure the frontends later.</p>\n<p>First sign into your FreePBX Administrative webpage.</p>\n<p>Under Tools tab&gt; System Administration &gt; Custom Destinations<br />\nClick \"Add Custom Destination\"<br />\nFor Custom Destination type \"custom-callerID,s,1\"<br />\nFor Description type \"CallerID to MythTV\"<br />\nFor Notes type nothing or anything you want<br />\nClick \"Submit Changes\"</p>\n<p>Switch to Setup tab &gt; Internal Options &amp; Configurations &gt; Misc Applications<br />\nClick \"Add Misc Application\"<br />\nFor Decription type \"MythTVCallerID\"<br />\nFor Feature Code, type any combination of numbers not currently being used for extensions or features. In my case I used \"7890\".<br />\nFor Feature Status \"enabled\" (I think this is default)<br />\nFor Destination at the bottom of the page there should be a Custom Destination drop down box which should contain you new \"CallerID to MythTV\" destination. Click that option.<br />\nClick \"Submit Changes\" button<br />\nClick the orange \"Apply Configuration Changes\" button at the top of the page.follow that by clicking the \"Continue with Reload\" option on the popup screen.</p>\n<p>Go back to the Tools tab &gt; maintenance &gt; Config Edit<br />\nUsing the /etc/asterisk group list (I think this is the default group) find and click on \"extensions_custom.conf\". Scroll down to the end of the file and add the following:</p>\n<p><span style=\"color:blue\"><br />\n<code></code></span></p>\n<p>[custom-callerID]<br />\n;<br />\n; Call FreePBX macro to set CALLERID(name) to caller\'s identity<br />\n;<br />\nexten =&gt; s,1,Macro(user-callerid)<br />\n;<br />\n; The following section is optional...<br />\n;<br />\n; Rewrite the numeric string to include hyphens<br />\n; <br />\n; Examples: 2345678 -&gt; 234-5678<br />\n; 12345678 -&gt; 1-234-5678<br />\n; 2345678901 -&gt; 234-567-8901<br />\n; 12345678901 -&gt; 1-234-567-8901<br />\n;<br />\nexten =&gt; s,n,Set(len=$[${LEN(${CALLERID(num)})}])<br />\nexten =&gt; s,n,GotoIf($[${len} &lt; 7]?send)<br />\nexten =&gt; s,n,Set(CALLERID(num)=${CALLERID(num):0:$[${len}-4]}-${CALLERID(num):$[${len}-4]:${len}})<br />\nexten =&gt; s,n,GotoIf($[${len} &lt; 8]?send)<br />\nexten =&gt; s,n,Set(CALLERID(num)=${CALLERID(num):0:$[${len}-7]}-${CALLERID(num):$[${len}-7]:$[${len}+1]})<br />\nexten =&gt; s,n,GotoIf($[${len} &lt; 11]?send)<br />\nexten =&gt; s,n,Set(CALLERID(num)=${CALLERID(num):0:$[${len}-10]}-${CALLERID(num):$[${len}-10]:$[${len}+3]});<br />\n; Send a formatted string to MythTV using netcat (nc)<br />\n;<br />\nexten =&gt; s,n,System(/bin/echo -n -e \"@CALL${CALLERID(name)}~${CALLERID(num)}\" | nc -w 1 192.168.X.X 10629) <br />\n<br />\n<span style=\"font-weight:bold\"> NOTE: Due to this web page formatting the above code has some single lines that have been broken into 2 lines. Every actual new line starts with \"exten =&gt;\" </span></p>\n<p>Substitute the IP address for your target MythFrontend machine for the \"192.168.X.X\" shown. For more than 1 target frontend you add a new line exactly as above with the different target IP address. My configuration file has 6 separate lines for my different targets.</p>\n<p>next, click \"Update\" button at the bottom of the page</p>\n<p>Go back to Setup tab &gt; Inbound Call Control &gt; Ring Groups<br />\nTo your new or existing Ring Group that will be activated with each inbound call add the extension \"7890#\" or whatever Feature Code number you used when you added the Misc Application above. Note that you need to include a \"#\" at the end of the number. Click \"Submit Changes\" button and orange \"Apply Configuration Changes\" bar and \"Continue with Reload\" on popup screen.</p>\n<p>Now you need to restart Asterisk. I\'m not sure the best way to do this so I went to a SSH screen and using admin privaleges typed \"amportal restart\". That concludes the FreePBX portion. </p>\n<p>At this point your FreePBX/Asterisk will broadcast the caller ID information to the LAN addresses you specified earlier. Next, we need to get the MythDora frontends to receive that information and display it. For that, MythTV comes with MythNotify which displays information when MythTV is playing recorded programs or videos. But I wanted to display the callerID info even if I was browsing available programs or using different MythAddons. For that we need to use xyac. This program combines xosd and a listener for broadcasted callerID information.</p>\n<p>On each frontend:<br />\nFirst you need to make sure the 10629 port is open. I am sure there must be a way to do this better but I decided that I did not need iptables firewall service on these frontends because none of them communicates with the outside. I disabled the firewall on each of these by typing at the command prompt </p>\n<p><span style=\"color:blue\"><code><br />\n#service iptables stop<br />\n</code></span></p>\n<p>and kept it from restarting at boot with</p>\n<p><span style=\"color:blue\"><code><br />\n#chkconfig iptables off<br />\n</code></span></p>\n<p>next we need to download and install xyac and its dependency files</p>\n<p><span style=\"color:blue\"><code><br />\n#yum install xosd xosd-devel<br />\n</code></span></p>\n<p>and the following series of commands:</p>\n<p><span style=\"color:blue\"><code><br />\n#wget <a href=\"http://bah.org/tivo/xyac/xyac-0.1.tar.gz\">http://bah.org/tivo/xyac/xyac-0.1.tar.gz</a> <br />\n#gunzip xyac-0.1.tar.gz <br />\n#tar -xvf xyac-0.1.tar <br />\n#cd xyac-0.1 <br />\n#make<br />\n#make install<br />\n</code></span></p>\n<p>if you get a<br />\n<span style=\"color:blue\"><code><br />\nmake:gcc:command not found<br />\n</code></span><br />\nerror you need to run<br />\n<span style=\"color:blue\"><code><br />\n#yum install gcc<br />\n</code></span><br />\nthan try \"make\" and \"make install\" again</p>\n<p>After completing this, xyac is installed in the /usr/local/bin folder</p>\n<p>Now you need to get xyac started during the frontend boot. What worked for me was to place a call to the xyac program in the startup file for Mythdora. You could create a file to start xyac and place it in the ~/.kde/Autostart folder, but that does work if your desktop environment is Gnome. By adding the xyac startup line in /usr/share/mythdora/mythfontend.sh the xyac is started regardless of desktop environment but will need to be added again if mythfrontend.sh ever gets overwritten (maybe during an upgrade?).</p>\n<p>I added the following line just below the PATH line in mythfrontend.sh<br />\n<span style=\"color:blue\"><code><br />\n/usr/local/bin/xyac –c yellow –A center –f –adobe-helvetica-bold-r-normal-*-*-240-100-100-p-*-iso9959-1 –o 100 –s 5 –d 10<br />\n</code></span><br />\nThis needs to be all on one line. The -A option determines the horizontal location of the message (left, center, right), the -o option is the vertical offset from the top of the screen (lower number puts the message closer to the top). The -s option is a drop shadow, and the -d option is the duration of the displayed message in seconds. There are a few other options as well which are documented by typing at the command prompt<br />\n<span style=\"color:blue\"><code><br />\n#xyac --help<br />\n</code></span></p>\n<p>Once mythfrontend.sh has been modified and saved you can restart the myhtfrontend and check that xyac is loaded by typing at the command promt <br />\n<span style=\"color:blue\"><code><br />\n#ps aux | grep xyac<br />\n</code></span></p>\n<p>You should see something like this</p>\n<p><span style=\"color:blue\"><code><br />\nmythtv 12169 0.0 0.0 13468 1344 ? Sl 01:33 0:00 /usr/local/bin/ xyac -c yellow -A center -f -adobe-helvetica-bold-r-normal-*-*-240-100-100-p-*-i so8859-1 -o 100 -s 5 -d 15<br />\nroot 32178 0.0 0.0 4044 672 pts/1 R+ 14:22 0:00 grep xyac<br />\n</code></span></p>\n<p>If you only see the \"root ..... grep xyac\" line there is something wrong.</p>\n<p>Now you should be able to test the frontend by issuing the following from a command prompt on the FreePBX box:<br />\n<span style=\"color:blue\"><code><br />\n#echo -n -e \"test\" | nc -w 1 192.168.X.X 10629<br />\n</code></span><br />\nwhere you substitute the IP address for your frontend for the 192.168.X.X .</p>\n<p>If that works you just need to wait for the phone to ring!</p>\n', created = 1369024523, expire = 1369110923, headers = '', serialized = 0 WHERE cid = '1:534b9395fbecf2a21dc72171940878c8' in /var/www/mythdora/html/includes/cache.inc on line 109.
  • user warning: Table './drupal_gding/cache_filter' is marked as crashed and should be repaired query: SELECT data, created, headers, expire, serialized FROM cache_filter WHERE cid = '1:7f867e18240c210fe61dbc817dc80c56' in /var/www/mythdora/html/includes/cache.inc on line 26.
  • user warning: Table './drupal_gding/cache_filter' is marked as crashed and should be repaired query: UPDATE cache_filter SET data = '<p>Great info. I did have a few issues.<br />\n1) I think you need to add the (send) label to the System call line (<a href=\"http://www.voip-info.org/wiki/view/Asterisk+cmd+GotoIf\">http://www.voip-info.org/wiki/view/Asterisk+cmd+GotoIf</a>).</p>\n<p>exten =&gt; s,n(send),System(/bin/echo -n -e \"@CALL${CALLERID(name)}~${CALLERID(num)}\" | nc -w 1 192.168.1.202 10629)</p>\n<p>Without it, my /etc/asterisks/full log shows this error and no caller id info was displayed:<br />\n[2009-11-24 21:46:06] NOTICE[23977] pbx.c: No such label \'send\' in extension \'s\' in context \'custom-callerID\'<br />\n[2009-11-24 21:46:06] WARNING[23977] pbx.c: Priority \'send\' must be a number &gt; 0, or valid label</p>\n<p>2) Also the \"amportal restart\" command was not causing my system to reread the config file. I used this which caused an update:<br />\nasterisk -vvvvvr<br />\nand then \"restart gracefully\" w/in the asterisk CLI</p>\n<p>3) one must install the Custom Destination module</p>\n<p>Also my post here (<a href=\"http://pbxinaflash.com/forum/showthread.php?p=36996#post36996\">http://pbxinaflash.com/forum/showthread.php?p=36996#post36996</a>) indicated that superfecta (<a href=\"http://projects.colsolgrp.net/wiki/superfecta\">http://projects.colsolgrp.net/wiki/superfecta</a>) might be used here.</p>\n<p>Hope this helps others.</p>\n<p>Mike</p>\n', created = 1369024523, expire = 1369110923, headers = '', serialized = 0 WHERE cid = '1:7f867e18240c210fe61dbc817dc80c56' in /var/www/mythdora/html/includes/cache.inc on line 109.
  • user warning: Table './drupal_gding/cache_filter' is marked as crashed and should be repaired query: SELECT data, created, headers, expire, serialized FROM cache_filter WHERE cid = '1:71c4200d25cc24ab43d7fe8f4bd93837' in /var/www/mythdora/html/includes/cache.inc on line 26.
  • user warning: Table './drupal_gding/cache_filter' is marked as crashed and should be repaired query: UPDATE cache_filter SET data = '<p>Mike,<br />\nThanks for the corrections. </p>\n<p>It sounds like you might have missed including the line <br />\nexten =&gt; s,1,Macro(user-callerID) (5th line from the top) when you created the [custom-callerID] section of extensions_custom.conf. That would explain the error messages you were getting.</p>\n<p>Your other corrections are very helpful. Unfortuneatly the original post apparently cannot be edited. If any of the moderators see this .. please make the corrections in the original post if you can for items 2) and 3) from Mikes post. Thanks<br />\nRobert</p>\n', created = 1369024523, expire = 1369110923, headers = '', serialized = 0 WHERE cid = '1:71c4200d25cc24ab43d7fe8f4bd93837' in /var/www/mythdora/html/includes/cache.inc on line 109.
  • user warning: Table './drupal_gding/cache_filter' is marked as crashed and should be repaired query: SELECT data, created, headers, expire, serialized FROM cache_filter WHERE cid = '1:69457cc73cf9863abb66c2533b7169e7' in /var/www/mythdora/html/includes/cache.inc on line 26.
  • user warning: Table './drupal_gding/cache_filter' is marked as crashed and should be repaired query: UPDATE cache_filter SET data = '<p>Robert,<br />\nNot sure, but I did have that line there. Either way it works now. Your original post was a great help.</p>\n<p>Mike</p>\n', created = 1369024523, expire = 1369110923, headers = '', serialized = 0 WHERE cid = '1:69457cc73cf9863abb66c2533b7169e7' in /var/www/mythdora/html/includes/cache.inc on line 109.
  • user warning: Table './drupal_gding/cache_filter' is marked as crashed and should be repaired query: SELECT data, created, headers, expire, serialized FROM cache_filter WHERE cid = '1:893ff6058b7fc358ba29204fcfc4a472' in /var/www/mythdora/html/includes/cache.inc on line 26.
  • user warning: Table './drupal_gding/cache_filter' is marked as crashed and should be repaired query: UPDATE cache_filter SET data = '<p>Woops. Replied in the wrong place</p>\n', created = 1369024523, expire = 1369110923, headers = '', serialized = 0 WHERE cid = '1:893ff6058b7fc358ba29204fcfc4a472' in /var/www/mythdora/html/includes/cache.inc on line 109.
  • user warning: Table './drupal_gding/cache_filter' is marked as crashed and should be repaired query: SELECT data, created, headers, expire, serialized FROM cache_filter WHERE cid = '1:5eb736377e4a421dc5c14f05e0e96f1a' in /var/www/mythdora/html/includes/cache.inc on line 26.
  • user warning: Table './drupal_gding/cache_filter' is marked as crashed and should be repaired query: UPDATE cache_filter SET data = '<p>Of course MythPhone has already been removed from 0.22 as of last Winter but I do believe Mythnotify as you used here remains intact.</p>\n', created = 1369024523, expire = 1369110923, headers = '', serialized = 0 WHERE cid = '1:5eb736377e4a421dc5c14f05e0e96f1a' in /var/www/mythdora/html/includes/cache.inc on line 109.
  • user warning: Table './drupal_gding/cache_filter' is marked as crashed and should be repaired query: SELECT data, created, headers, expire, serialized FROM cache_filter WHERE cid = '1:6387c0779fc9040cdd92f224ef39c6b8' in /var/www/mythdora/html/includes/cache.inc on line 26.
  • user warning: Table './drupal_gding/cache_filter' is marked as crashed and should be repaired query: UPDATE cache_filter SET data = '<p>The posted configuration does not involve MythPhone or even MythNotify. The problem with MythNotify is that it provides onscreen display ONLY when MythTV is in program replay or video play mode. So if the phone rings while you are scanning the list of recorded programs in MythTV, no CallerID info will appear!</p>\n<p>The above method bypasses this limitation of MythNotify by using XYAC to provide on-screen display. Although I have set it up to start from within the mythfrontend startup script, it can be started without mythtv and can even be used to display CallerID on a non MythTV linux box.</p>\n<p>Robert</p>\n', created = 1369024523, expire = 1369110923, headers = '', serialized = 0 WHERE cid = '1:6387c0779fc9040cdd92f224ef39c6b8' in /var/www/mythdora/html/includes/cache.inc on line 109.
  • user warning: Table './drupal_gding/cache_filter' is marked as crashed and should be repaired query: SELECT data, created, headers, expire, serialized FROM cache_filter WHERE cid = '1:810dce23744ea3ac9ac12c0fbe2c2d27' in /var/www/mythdora/html/includes/cache.inc on line 26.
  • user warning: Table './drupal_gding/cache_filter' is marked as crashed and should be repaired query: UPDATE cache_filter SET data = '<p>Even better that it is independent. I stand corrected here.</p>\n<p> BTW, your config looks great in Opera 10, the config text is colored so it stands out, normal text from the post is black and white. This needs to be saved in tips n\' tricks if you ask me.</p>\n', created = 1369024523, expire = 1369110923, headers = '', serialized = 0 WHERE cid = '1:810dce23744ea3ac9ac12c0fbe2c2d27' in /var/www/mythdora/html/includes/cache.inc on line 109.
  • user warning: Table './drupal_gding/cache_filter' is marked as crashed and should be repaired query: SELECT data, created, headers, expire, serialized FROM cache_filter WHERE cid = '1:8e74b349080cc032f67279d5fa9fe3d0' in /var/www/mythdora/html/includes/cache.inc on line 26.
  • user warning: Table './drupal_gding/cache_filter' is marked as crashed and should be repaired query: UPDATE cache_filter SET data = '<p>\n<div class=\"quote-msg\">\n<div class=\"quote-author\"><em>Davesworld</em> wrote:</div>\n<p>Even better that it is independent. I stand corrected here.</p>\n<p> BTW, your config looks great in Opera 10, the config text is colored so it stands out, normal text from the post is black and white. This needs to be saved in tips n\' tricks if you ask me. </p></div>\n</p>\n<p>Glad to hear this worked well for you. It would be great if this could be moved to Tips n\' Tricks</p>\n', created = 1369024523, expire = 1369110923, headers = '', serialized = 0 WHERE cid = '1:8e74b349080cc032f67279d5fa9fe3d0' in /var/www/mythdora/html/includes/cache.inc on line 109.

After spending countless hours trying to put together the the right way to display Caller ID info onscreen on my MythDora frontends I finally accomplished it. In an effort to save others the same amount of trial and error I am documenting how this is accomplished. Sort of a payback for all the help I have received from others over the years. The steps are all from various online sources and I give full credit to those that have put together the individual steps. What I have done that I could not find anywhere was a comprehensive sequence to follow especially for MythDora. As always YMMV but the WAF I have received after just a few days has been well worth it.

For those who don't know, Asterisk is a VOIP telephone systems that is run on linux and is free just like MythTV. It can be used to connect your local intranet directly to a VOIP provider thereby elimimnating AT&T. The number of features is fantastic and it can be run from a relatively low powered computer. It is kind of like Vonage but without the proprietory software or hardware. While you can connect up regular analog telephones using adaptors between the computer and the phone these can be a little pricey. If you replace your analog phones with VoIP phones then no additional harware is required. I am using IP phones by Cisco in my home and one of the best features is whole house hands-free intercom. FreePBX is a web enabled GUI for Asterisk and has replaced the previous version called Asterisk@Home. A one touch installation is contained in "PBX in a Flash" (PiaF) which, like MythDora consists of a bootable CD image which loads Centos OS and a host of other apps to make a simple and functional FreePBX deployment. For more details see the PiaF website. For CallerID, VoIP is nice because the information is immediately available when the phone starts ringing unlike traditional POTS callerID which usually have a delay until the second ring.

For my setup I am using PiaF ver 1.4 and MythDora 10.21. Both the Piaf and MythDora backend are on dedeicated machiones and I have multiple separate MythDora frontends. This assumes you have MythDora installed and running and FreePBX installed and operational. you also need to have a Ring Goup setup in FeePBX.

Lets start by setting up FreePBX to send the CallerID to the individual frontends. We will configure the frontends later.

First sign into your FreePBX Administrative webpage.

Under Tools tab> System Administration > Custom Destinations
Click "Add Custom Destination"
For Custom Destination type "custom-callerID,s,1"
For Description type "CallerID to MythTV"
For Notes type nothing or anything you want
Click "Submit Changes"

Switch to Setup tab > Internal Options & Configurations > Misc Applications
Click "Add Misc Application"
For Decription type "MythTVCallerID"
For Feature Code, type any combination of numbers not currently being used for extensions or features. In my case I used "7890".
For Feature Status "enabled" (I think this is default)
For Destination at the bottom of the page there should be a Custom Destination drop down box which should contain you new "CallerID to MythTV" destination. Click that option.
Click "Submit Changes" button
Click the orange "Apply Configuration Changes" button at the top of the page.follow that by clicking the "Continue with Reload" option on the popup screen.

Go back to the Tools tab > maintenance > Config Edit
Using the /etc/asterisk group list (I think this is the default group) find and click on "extensions_custom.conf". Scroll down to the end of the file and add the following:


[custom-callerID]
;
; Call FreePBX macro to set CALLERID(name) to caller's identity
;
exten => s,1,Macro(user-callerid)
;
; The following section is optional...
;
; Rewrite the numeric string to include hyphens
;
; Examples: 2345678 -> 234-5678
; 12345678 -> 1-234-5678
; 2345678901 -> 234-567-8901
; 12345678901 -> 1-234-567-8901
;
exten => s,n,Set(len=$[${LEN(${CALLERID(num)})}])
exten => s,n,GotoIf($[${len} < 7]?send)
exten => s,n,Set(CALLERID(num)=${CALLERID(num):0:$[${len}-4]}-${CALLERID(num):$[${len}-4]:${len}})
exten => s,n,GotoIf($[${len} < 8]?send)
exten => s,n,Set(CALLERID(num)=${CALLERID(num):0:$[${len}-7]}-${CALLERID(num):$[${len}-7]:$[${len}+1]})
exten => s,n,GotoIf($[${len} < 11]?send)
exten => s,n,Set(CALLERID(num)=${CALLERID(num):0:$[${len}-10]}-${CALLERID(num):$[${len}-10]:$[${len}+3]});
; Send a formatted string to MythTV using netcat (nc)
;
exten => s,n,System(/bin/echo -n -e "@CALL${CALLERID(name)}~${CALLERID(num)}" | nc -w 1 192.168.X.X 10629)

NOTE: Due to this web page formatting the above code has some single lines that have been broken into 2 lines. Every actual new line starts with "exten =>"

Substitute the IP address for your target MythFrontend machine for the "192.168.X.X" shown. For more than 1 target frontend you add a new line exactly as above with the different target IP address. My configuration file has 6 separate lines for my different targets.

next, click "Update" button at the bottom of the page

Go back to Setup tab > Inbound Call Control > Ring Groups
To your new or existing Ring Group that will be activated with each inbound call add the extension "7890#" or whatever Feature Code number you used when you added the Misc Application above. Note that you need to include a "#" at the end of the number. Click "Submit Changes" button and orange "Apply Configuration Changes" bar and "Continue with Reload" on popup screen.

Now you need to restart Asterisk. I'm not sure the best way to do this so I went to a SSH screen and using admin privaleges typed "amportal restart". That concludes the FreePBX portion.

At this point your FreePBX/Asterisk will broadcast the caller ID information to the LAN addresses you specified earlier. Next, we need to get the MythDora frontends to receive that information and display it. For that, MythTV comes with MythNotify which displays information when MythTV is playing recorded programs or videos. But I wanted to display the callerID info even if I was browsing available programs or using different MythAddons. For that we need to use xyac. This program combines xosd and a listener for broadcasted callerID information.

On each frontend:
First you need to make sure the 10629 port is open. I am sure there must be a way to do this better but I decided that I did not need iptables firewall service on these frontends because none of them communicates with the outside. I disabled the firewall on each of these by typing at the command prompt


#service iptables stop

and kept it from restarting at boot with


#chkconfig iptables off

next we need to download and install xyac and its dependency files


#yum install xosd xosd-devel

and the following series of commands:


#wget http://bah.org/tivo/xyac/xyac-0.1.tar.gz
#gunzip xyac-0.1.tar.gz
#tar -xvf xyac-0.1.tar
#cd xyac-0.1
#make
#make install

if you get a

make:gcc:command not found

error you need to run

#yum install gcc

than try "make" and "make install" again

After completing this, xyac is installed in the /usr/local/bin folder

Now you need to get xyac started during the frontend boot. What worked for me was to place a call to the xyac program in the startup file for Mythdora. You could create a file to start xyac and place it in the ~/.kde/Autostart folder, but that does work if your desktop environment is Gnome. By adding the xyac startup line in /usr/share/mythdora/mythfontend.sh the xyac is started regardless of desktop environment but will need to be added again if mythfrontend.sh ever gets overwritten (maybe during an upgrade?).

I added the following line just below the PATH line in mythfrontend.sh

/usr/local/bin/xyac –c yellow –A center –f –adobe-helvetica-bold-r-normal-*-*-240-100-100-p-*-iso9959-1 –o 100 –s 5 –d 10

This needs to be all on one line. The -A option determines the horizontal location of the message (left, center, right), the -o option is the vertical offset from the top of the screen (lower number puts the message closer to the top). The -s option is a drop shadow, and the -d option is the duration of the displayed message in seconds. There are a few other options as well which are documented by typing at the command prompt

#xyac --help

Once mythfrontend.sh has been modified and saved you can restart the myhtfrontend and check that xyac is loaded by typing at the command promt

#ps aux | grep xyac

You should see something like this


mythtv 12169 0.0 0.0 13468 1344 ? Sl 01:33 0:00 /usr/local/bin/ xyac -c yellow -A center -f -adobe-helvetica-bold-r-normal-*-*-240-100-100-p-*-i so8859-1 -o 100 -s 5 -d 15
root 32178 0.0 0.0 4044 672 pts/1 R+ 14:22 0:00 grep xyac

If you only see the "root ..... grep xyac" line there is something wrong.

Now you should be able to test the frontend by issuing the following from a command prompt on the FreePBX box:

#echo -n -e "test" | nc -w 1 192.168.X.X 10629

where you substitute the IP address for your frontend for the 192.168.X.X .

If that works you just need to wait for the phone to ring!

MInor Updates

Great info. I did have a few issues.
1) I think you need to add the (send) label to the System call line (http://www.voip-info.org/wiki/view/Asterisk+cmd+GotoIf).

exten => s,n(send),System(/bin/echo -n -e "@CALL${CALLERID(name)}~${CALLERID(num)}" | nc -w 1 192.168.1.202 10629)

Without it, my /etc/asterisks/full log shows this error and no caller id info was displayed:
[2009-11-24 21:46:06] NOTICE[23977] pbx.c: No such label 'send' in extension 's' in context 'custom-callerID'
[2009-11-24 21:46:06] WARNING[23977] pbx.c: Priority 'send' must be a number > 0, or valid label

2) Also the "amportal restart" command was not causing my system to reread the config file. I used this which caused an update:
asterisk -vvvvvr
and then "restart gracefully" w/in the asterisk CLI

3) one must install the Custom Destination module

Also my post here (http://pbxinaflash.com/forum/showthread.php?p=36996#post36996) indicated that superfecta (http://projects.colsolgrp.net/wiki/superfecta) might be used here.

Hope this helps others.

Mike

Thank you for the corrections

Mike,
Thanks for the corrections.

It sounds like you might have missed including the line
exten => s,1,Macro(user-callerID) (5th line from the top) when you created the [custom-callerID] section of extensions_custom.conf. That would explain the error messages you were getting.

Your other corrections are very helpful. Unfortuneatly the original post apparently cannot be edited. If any of the moderators see this .. please make the corrections in the original post if you can for items 2) and 3) from Mikes post. Thanks
Robert

Not sure

Robert,
Not sure, but I did have that line there. Either way it works now. Your original post was a great help.

Mike

Woops. Replied in the wrong

Woops. Replied in the wrong place

Of course MythPhone has

Of course MythPhone has already been removed from 0.22 as of last Winter but I do believe Mythnotify as you used here remains intact.

The posted configuration

The posted configuration does not involve MythPhone or even MythNotify. The problem with MythNotify is that it provides onscreen display ONLY when MythTV is in program replay or video play mode. So if the phone rings while you are scanning the list of recorded programs in MythTV, no CallerID info will appear!

The above method bypasses this limitation of MythNotify by using XYAC to provide on-screen display. Although I have set it up to start from within the mythfrontend startup script, it can be started without mythtv and can even be used to display CallerID on a non MythTV linux box.

Robert

Even better that it is

Even better that it is independent. I stand corrected here.

BTW, your config looks great in Opera 10, the config text is colored so it stands out, normal text from the post is black and white. This needs to be saved in tips n' tricks if you ask me.

Glad it worked

Davesworld wrote:

Even better that it is independent. I stand corrected here.

BTW, your config looks great in Opera 10, the config text is colored so it stands out, normal text from the post is black and white. This needs to be saved in tips n' tricks if you ask me.

Glad to hear this worked well for you. It would be great if this could be moved to Tips n' Tricks