Caller name lookup script for Asterisk 1.4 and FreePBX 2.3.0 Imprimer

Here is a little script that allows you to look up for the caller name based on the caller phone number. It is pretty basic and works with parsing the HTML returned by http://findaperson.canada-411.ca/ 14990/search/ReversePhone?phone=${NUMBER} and falls back on http://canada411.yellowpages.ca/ search/?src=&stype=re&pac=${NUMBER:0:3}...

 

Since the script parses the HTML returned by http://findaperson.canada-411.ca or http://canada411.yellowpages.ca it may stop working if the format of the HTML sent by those sites changes. It is nevertheless trivial to replace the lines in the script calling these web sites and substitute them with your own database calls to lookup for the caller name.

Here the logic :

1) Asterisk sends the caller number and name to the script.

2) if a valid number is provided, the script does a lookup to find a matching name.

3) if no name is found by the script, the script just returns the name that Asterisk sent to the script in the first place if any.

How to install:

In FreePBX go to CallerID Lookup Sources and define your own source as following:

Source type: HTTP
cache results: yes ( populates PhoneBook automatically and saves bandwidth)
Host: localhost

Port: 8071

Path: /

Query: [NUMBER]&${CALLERID(name)}

In FreePBX go to Inboud Routes:

Set the CID Lookup Source to your own source in all Inbound Routes

Make an entry in /etc/inetd.conf to map port 8071 to the lookup script:

8071 stream tcp nowait asterisk /usr/local/bin/callerid.sh

and restart inetd

Alternatively, if you are using xinetd, put the following in your /etc/services:

asterisklookup 8071/tcp # asterisk lookup

and put the following in xinetd.conf:

service asterisklookup
{
socket_type = stream
protocol = tcp
wait = no
user = asterisk
group = asterisk
server = /usr/local/bin/callerid.sh
disable = no
}

and restart xinetd

Download and install script:

Download from this link

Rename callerid.sh, copy into /usr/local/bin and make it executable by issuing the command :

chmod 755 /usr/local/bin/callerid.sh

 

 

Commentaires / Comments (3)
script
1 samedi, 06 avril 2013 00:42
Jess
maybe you can post the contents of the script instead of having a dead link? Would be great help!
Link fixed
2 mardi, 09 avril 2013 13:36
oc9
The link for the script has been fixed.
Comments
3 samedi, 16 novembre 2013 23:10
Sylvain
Maybe just asking nicely would have been better than that crap Jess!

Ajouter votre commentaire / Add your comment

Votre nom / Your name:
Sujet / Subject:
Commentaire:
SPAM: Ne pas inclure de lien ou utiliser le stratagème suivant: "yahoo.com slash mapage.html"     Nous utilisons un filtre qui bloque les commentaires suspects avec une erreur 403. De même, du code de programmation ou sql peut provoquer des erreurs 403. Veuillez utiliser un lien vers votre code tel que: "pastebin.com slash jVNqLieD"    Merci!
Comment:
SPAM: Do not include any links in your post or use the following construct: "yahoo.com slash mypage.html"    We are using a filter that denies suspicious posts with a 403 error. Programming language or SQL code may also cause a 403 error. Please provide a link to your code instead like: "pastebin.com slash jVNqLieD"    Thank you! :
  Lettres de vérification; lettres minuscules seulement, pas d
Retaper les lettres affichées / Word verification:
Mis à jour / Last updated ( mardi, 18 décembre 2007 19:42 )