thebottle

thebottle Blog

February 22, 2009

Elastix Block Anonymous – Restricted Calls

Filed under: VoIP — Tony @ 11:14 am

So I was trying to block a certain someone from calling me and after I set up the blacklist they started to *67 my number and it would still ring through as Restricted. This was not acceptable and I could not figure out how to block this for the longest time until I came across this patch for Elastix. This post will show you how to set up the blacklist in Elastix as well as block Anonymous, Restricted, and Private type calls.

Blacklist
Blacklist is not a built-in feature in the Elastix build that I am using. In order to install and use Blacklist, you must click on the PBX tab on the top and then click on Unembedded FreePBX. The default login is admin:admin. Once you are logged in then go to the Tools tab and then under that Module Admin. Find Blacklist, click on it, check Install, and on the bottom click on the Process button. This will install Blacklist and you can block any numbers that you want by accessing it through Unembedded FreePBX.

Anonymous Call Block
If you want to completely block anonymous, restricted, private, unidentified, etc. calls then you will want to do the following.

SSH into your Elastix box.
[root@elastix ~]# locate page.did.php
/var/www/html/admin/modules/core/page.did.php

We just found where the page.did.php file is located, now we want to edit the lines outlined in this patch. I like to use nano when I need to search through a file, so if you don’t have it installed yet then type:
[root@elastix ~]# yum -install nano

To edit the file type:
[root@elastix ~]# nano -w /var/www/html/admin/modules/core/page.did.php

We will basically be finding this line:
if (!isDialpattern(theForm.cidnum.value))

deleting the last close-parenthesis and adding:
&& theForm.cidnum.value != "Private" && theForm.cidnum.value != "Blocked" && theForm.cidnum.value != "Unknown" && theForm.cidnum.value != "Restricted" && theForm.cidnum.value != "Unavailable")

Save the file, you are now done editing files. I know the patch says that the functions.inc.php file needs to be edited, but I didn’t touch that file and everything works fine for me.

For the next step go back into the Elastix WebUI and go to the PBX tab and then to Inbound Call Routes.

For the Caller ID Number type in Restricted or Unknown or Private or Blocked or Unavailable. It is case sensitive so make sure you have the proper case. Then you can set the destination to Terminate Call and it will hangup when that type of call comes in, but I am sure that you would rather have it go to a message that says you do not accept blocked calls. If you want to do that then do the following.

Go to System Recordings and go to Built-in Recordings and select privacy-unident. You will now see this recording listed on the right-side menu. Click on it and change the name to “Unidentified”. Save and apply. Then from the second drop down select privacy-thankyou. Save and apply. Then from the third drop down select goodbye. Save and apply. The “Unidentified” message will now be, “The party you are trying to reach does not accept unidentified calls, thank you, goodbye.”

Go to Announcements and name it “Restricted”, select the “Unidentified” recording, and choose Terminate Call. Save and Apply.

Now go back and edit your Restricted, Private, Unknown, etc routes and instead of having the destination be set to terminate the call, have it set to play the “Restricted” announcement.

UPDATE:
I recently upgraded to version 1.5.2 and this version includes the ability to enter “Blocked,” “Restricted,” “Anonymous,” etc. but my calls are sent to me as “1Restricted” so I still had to edit a couple of files to make it accept “1Restricted.”

[root@elastix ~]# nano -w /var/www/html/admin/modules/core/page.did.php

Search for restrict and where you see this line:
if (!isDialpattern(mycid) && mycid.substring(0,4) != "priv" && mycid.substring(0,5) != "block" && mycid != "unknown" && mycid.substring(0,8) != "restrict" && mycid.substring(0,7) != "unavail" && mycid.substring(0,6) != "anonym")

Change:
"restrict"
to:
"1restric"

[root@elastix ~]# nano -w /var/www/html/admin/modules/core/functions.inc.php

Search through functions.inc.php for restrict and you will find a similar line as above. You must do the same thing by changing “restrict” to “1restric”. I also found that in this version of FreePBX/Elastix that I had to check CID Priority Route on my inbound route in order for it to actually take effect, so check that if you haven’t already. Now you will be able to block restricted calls sent from CallWithUs.


3 Responses to “Elastix Block Anonymous – Restricted Calls”

  1. Luis Alejandro says:

    what about the Elastix 1.6 64 Bit version. Is the same procedure than 1.5.2 ?

  2. Tony says:

    You won’t need to edit any files because version 1.5.2+ allow for Restricted, Private, etc. unless your calls come in as 1Restricted like mine. Then you will need to follow this article.

  3. Sherlyn says:

    ZzWQPQ Good point. I hadn’t thought about it quite that way. :)

Leave a Reply

© 2006-2010 by thebottle