Pi-Kodi CallerID - VoIP provider with supported VOIP Adapters - Printable Version +- Kodi Community Forum (https://forum.kodi.tv) +-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33) +--- Forum: General Support (https://forum.kodi.tv/forumdisplay.php?fid=111) +---- Forum: Raspberry Pi (https://forum.kodi.tv/forumdisplay.php?fid=166) +---- Thread: Pi-Kodi CallerID - VoIP provider with supported VOIP Adapters (/showthread.php?tid=233223) |
Pi-Kodi CallerID - VoIP provider with supported VOIP Adapters - npuser - 2015-07-25 Goal: Utilize VOIP adapter's logging feature to display incoming call callerid to all Raspberry PIs running Kodi (Milhouse Build). I missed the TV callerID alert feature so bad after dropping the cable TV service, i started poking around the internet for a solution. Then I come across this post which resulted in a working callerID solution for me. Even though there are so many variables to get this right and the process/script looks bit clunky [my apology in advance], i thought i share the project as-is here for other's benefit. I am not good at instructions, hope this make sense to others. Disclaimer: Credit goes to 'DmCK' from this thread. I simply modify his script to adopt to my environment. If you are using Sipura or Linksys or Cisco (excluding Cisco ATA 18X) Phone adapters, the script should work as-is. The OBixx phone adapter works well as well but needs a slight adjustment in the script below. Similarly, this can be adjusted to make YAC Listner work to send callerID to MAC/PCs. My Environment: 1. Ubuntu server/PI (openelec) - rsyslog server 2. 2 x PI2 Running Openelec Milhouse Build 3. 1 x Cisco SPA 122 Phone Adapter. 4. A BYOD VOIP Provider I. Prepare Linksys/Cisco Phone Adapter 1. Login into Phone Adapter with admin privilege 2. Navigate to Voice - > System -> Enter syslog server IP address. Click "Save". 3. Navigate to Line 1 -> SIP Debug Option: -> select "full excl. OPT|NTFY|REG" from the drop down list. Click "Save" 4. Repeat step 3 if you are using Line 2 (Optional) II. Prepare rSyslog Server (Ubuntu) Note: Raspberry PI's rsyslog service is suffice but I am using separate Ubuntu as example here. 1. Install rsyslog and configure if it is not already. 2. Configure rsyslog to listen to udp 514. un-comment following lines. nano /etc/rsyslog.conf Code: # provides UDP syslog reception Code: $AllowedSender UDP, 127.0.0.1, 192.168.1.xxx 5. Restart rsyslog Code: service rsyslog restart III. Rsyslog Rules 1. Don't log local0 and user stuff to /var/log/messages since the Linksys/Cisco SPA uses those facility categories Code: nano /etc/rsyslog.d/50-default.conf Code: #Don't log local0 and user stuff to /var/log/messages since the SPA uses those facility categories 3. save "50-default.conf" and restart rsyslog service IV. Rsyslog default behavior 1. Add '-r' switch default/rsyslog Code: nano /etc/default/rsyslog V. Install Incron (Note: Still available but sadly, i heard, the incron development incron has stopped.) 1. Install incron Code: apt-get install incron Code: nano /etc/incron.allow VI. User crontab 1. Code: sudo incrontab -e Code: "/var/log/voip/voip.log IN_MODIFY /bin/bash /home/yourusername/callerid.sh" VII. Kodi Setting 1.Enable the webserver Code: Settings>Services>Webserver>Allow control of kodi via HTTP 2. Note username and password if any and adjust callerid.sh setting acordingly callerid.sh Note: Make you script (callerid.sh) executable Code: chmod 777 ~/callerid.sh Code: #!/bin/bash Edit: Sorry - Could not upload images here. Call.png and some screenshots are missing at this point. Re: Pi-Kodi CallerID - VoIP provider with supported VOIP Adapters - Milhouse - 2015-07-25 Rather than use incrontab it would be easier to run callerid.sh as a "daemon" and just tail syslog with the output feeding a read loop, this would also eliminate the need for the flock. For example: Code: #!/bin/bash You might even be able to use netcat/nc in place of syslog and tail. RE: Pi-Kodi CallerID - VoIP provider with supported VOIP Adapters - doug - 2015-07-26 You're welcome for the clunky script! :-) I'm not a programmer at all and pieced that ugly bit of code together from other stuff I saw on the internet. The flock stuff never worked correctly for me and I had actually removed it from my script. I've since moved on from a Ubuntu server and now use unRaid. I haven't looked at getting the script working again because most of my calls are now on my mobile and my voip phone is hardly used. Good luck with improving the script though! Edit: This should probably be in the general part of the forum as it's not specific to the RPi. RE: Pi-Kodi CallerID - VoIP provider with supported VOIP Adapters - JonSnow88 - 2015-07-26 cool stuff, will try on my SPA2102 once I have switched VOIP providers. I assume the script will work the same for my 2102. RE: Pi-Kodi CallerID - VoIP provider with supported VOIP Adapters - npuser - 2015-07-27 Thank you @Milhouse for the suggestions. I am getting good result from the tail and gawk. I will revamp the script and the installation steps, and report here again once i test them. Code: tail -qF -n0 /var/log/syslog -f | gawk -v FS=';' '{match($3, /From: (.*)@/, m); print m[1]}' @doug thank you for the script. It works wonder for me. @jebise - yes linksys spa2102 will work with this. thanks NPuser RE: Pi-Kodi CallerID - VoIP provider with supported VOIP Adapters - JonSnow88 - 2015-08-09 any updates on the script? I configured my syslog on a separate Pi but do not see anything in voip.log, my other devices are logging just fine. Does the debug level need to be updated under Voice > System on the ATA? mine is set to 0 RE: Pi-Kodi CallerID - VoIP provider with supported VOIP Adapters - JonSnow88 - 2015-10-22 need some help, I have followed everything exactly as OP but voip.log stays empty RE: Pi-Kodi CallerID - VoIP provider with supported VOIP Adapters - Ruckus - 2016-10-03 taking this thread as a great place to start, i began work on this today using an Obi202 unit that i got configured for Google voice calls yesterday. because the logging works slightly differently in the obi units i was looking for a way around the callerid.sh script. I decided to use perl for this and to keep the idea of sending a curl to a kodi unit. I've got everything running right up to the point of sending the curl to kodi and am stuck there. so how do i send this curl command to kodi with a variable in it? Code: curl -v -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{"id":1,"jsonrpc":"2.0","method":"GUI.ShowNotification","params":{"title":"Incoming Phone Call","message":"$callerid"}}' http://192.168.1.100:8080/jsonrpc where $callerid is the number i want to present on the popup in kodi. any help appreciated |