OBiTALK Community

General Support => Installation and Set-Up (Devices) => Topic started by: Darv on October 15, 2019, 10:21:22 PM

Title: Block calls by CNAM (CallerID Name) on OBI200?
Post by: Darv on October 15, 2019, 10:21:22 PM
Is there a way to block calls by Caller ID Name (CNAM) on the OBI200? 

I've also been trying to find how to block thousands of numbers, and usually asterisk/freepbx is recommended for these features but I think that is overkill and quite large and hard to install and maintain.

If Obi can't block by CNAM is there a simple script that could be used as a middle proxy to act as a call blocker (based on number or name) between voip.ms and the Obi200?

I see there are many "sip proxy" scripts but I'm not sure if that is what I would need for this use case. I'd like the smallest, most minimal thing to use to block calls and log them.

sample list of sip proxies https://www.voip-info.org/open-source-voip-software/
Title: Re: Block calls by CNAM (CallerID Name) on OBI200?
Post by: SteveInWA on October 16, 2019, 02:44:06 PM
Please do not start a new discussion on the same topic.  You already have a discussion going on here:

http://www.obitalk.com/forum/index.php?topic=16356 (http://www.obitalk.com/forum/index.php?topic=16356)

No, you cannot block calls by CNAM.  It would be a useless feature, given that most spam calls use spoofed telephone numbers and either no CNAM or the CNAM of the spoofed number.  Many calls from legitimate and from spammer numbers are using mobile phone numbers, and some carriers send a generic CNAM, such as "WIRELESS CALLER", which would not differentiate between a "good" caller and a "bad" caller.

On the other hand, if you have 1000 enemies, and you know the CNAM for each number, then refer to your original discussion.
Title: Re: Block calls by CNAM (CallerID Name) on OBI200?
Post by: Darv on October 16, 2019, 06:39:52 PM
The feature to block by CNAM was different than the feature to block unlimited numbers by Number, hence the separate posts.  The threads can be merged if they are too similar.

I've used CNAM blocking for years so it isn't useless, but I am not sure how to easily implement it on the Obi. Many survey companies use the same CNAM.  Having the feature doesn't mean anyone would need to use it, nor that it would be appropriate to use for all Names, only that it was available as an option.  I do not have "enemies", but I have accumulated a list of nuisance calls (numbers and names) that I'd like to continue to block.


Title: Re: Block calls by CNAM (CallerID Name) on OBI200?
Post by: SteveInWA on October 16, 2019, 06:41:37 PM
There simply is no ability to block by CNAM.
Title: Re: Block calls by CNAM (CallerID Name) on OBI200?
Post by: Lavarock7 on October 17, 2019, 07:54:41 AM
Are those blocked numbers often calling or is that each time you got a spam or telemarketer you blocked them?

I ask because there are better ways of blocking many of them, like NOMOROBO. I also use Voip.Ms and their 'automated attendant' to block most spammers/telemarketers. A simple message "Thanks for calling, press 3 to reach me' works wonders.

Yes, there are SOME people still using rotary dial and you can default them to a timeout that still gets through. Some robo calls hear a long message (simulating an answering machine) rather than a brief one (like a 'hello') and hang up.
Title: Re: Block calls by CNAM (CallerID Name) on OBI200?
Post by: Darv on October 17, 2019, 09:44:25 AM
I will look into that, but it might also block (for example) the reminders from my dentist, or frustrate other legitimate calls that I haven't pre-"whitelisted".    

I am used to the system I have (specifically blocking numbers and names) but it resulted in a long list that the Obi can't seem to support.

I am looking at sip proxy scripts to see if they can be used in the middle as a call blocker, but they all seem to be quite complicated.
Title: Re: Block calls by CNAM (CallerID Name) on OBI200?
Post by: azrobert on October 17, 2019, 10:43:31 AM
Another option is SipSorcery. It would be a relative easy setup, just a dial plan. SipSorcery uses Ruby programming language for their dial plans and I could help. You would be able to block by CallerID number and name. The only problem is the cost, $69/year.

https://www.sipsorcery.com/mainsite/Home/Pricing
Title: Re: Block calls by CNAM (CallerID Name) on OBI200?
Post by: Darv on October 17, 2019, 11:36:03 AM
Interesting service but probably overkill.  I'm looking for a simple & free solution to block calls.  Call blocking is just string matching (on the number or name) and rejecting calls, so I was hoping it would be easy.
Title: Re: Block calls by CNAM (CallerID Name) on OBI200?
Post by: Darv on October 18, 2019, 07:52:16 PM
I am hoping someone with SIP experience can tell me if this would be on the right track:

If I locally use a "SIP Redirect server" that "SIP Registers" with my VOIP.MS account, it will receive all the incoming call INVITE notifications.  It would be a simple script, like the PJSIP Python "call (https://github.com/pjsip/pjproject/blob/master/pjsip-apps/src/python/samples/call.py)" and "register (https://github.com/pjsip/pjproject/blob/master/pjsip-apps/src/python/samples/registration.py)" scripts.

This script will check the CallerID # and Name, and if they are not blacklisted it will send a "302 Redirect" to tell VOIP.MS to "SIP Contact" the OBI200's IP/Port.  
references: Wikipedia SIP Response Codes (https://en.wikipedia.org/wiki/List_of_SIP_response_codes#3xx%E2%80%94Redirection_Responses) , PJSIP Redirect (http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/2008-April/002504.html)

If it is blacklisted I guess it sends a 486 busy or some other response code.

I then set the "ProxyServer" on the Obi200 to VOIP.MS as usual, but I should set the "RegistrarServer" to be  the SIP Redirect server (or is there a way to turn off RegistrarServer?) so the Obi doesn't receive calls directly from voip.ms and therefore won't ring if the number is blocked. I'm not sure if I would also need to set the "OutboundProxy" to VOIP.MS.

I hope authentication with VOIP.MS would still work for all incoming and outgoing calls on the OBI connected phones.

Does that sound reasonable?

Title: Re: Block calls by CNAM (CallerID Name) on OBI200?
Post by: azrobert on October 19, 2019, 06:19:44 AM
You could use Yate PBX. I know you didn't want to use a PBX, but Yate installs in a few minutes and you only need 1 config file when routing calls by IP address. Yate runs on different platforms, but I only used the Windows version. It took me about 15 minutes to code and test blocking by CallerID and Cnam. I already had Yate installed.

http://docs.yate.ro/wiki/Download

Click on "Yate 6.1.0-1" to install.
Title: Re: Block calls by CNAM (CallerID Name) on OBI200?
Post by: Darv on October 19, 2019, 09:16:11 AM
Is the principle the same (Use Yate as a redirection server to block calls?) or how does it then tell the Obi to ring the phone on an incoming call, and accept outgoing calls from the phones attached to the Obi?

What are the Obi & Yate simple settings to make it work?  I'm looking for reliability and something as simple as possible.

I don't want a PBX handling the audio (RTP/SRTP) as that would slow things down and add potential errors.  The audio stream needs to be directly between the Voip.ms server and the Obi, I just need something to simply block Caller Names/Numbers and then have the Obi take over the call.
Title: Re: Block calls by CNAM (CallerID Name) on OBI200?
Post by: Sheffield_Steve on October 19, 2019, 09:24:43 AM
I know you are asking about callerID NAME, but why won't the regular caller ID NUMBER filtering in voip.ms work?
Title: Re: Block calls by CNAM (CallerID Name) on OBI200?
Post by: azrobert on October 19, 2019, 09:43:46 AM
You would route calls to Yate and then Yate would route them back to the OBi200 after selectively rejecting. I don't think anyone on this forum can help with what you want to do. Try here:
https://www.dslreports.com/forum/voip
Title: Re: Block calls by CNAM (CallerID Name) on OBI200?
Post by: Darv on October 19, 2019, 10:07:46 AM
Quote from: Sheffield_Steve on October 19, 2019, 09:24:43 AM
I know you are asking about callerID NAME, but why won't the regular caller ID NUMBER filtering in voip.ms work?

I'm sure it would work, I just want the option to block by Name and the ability to log blocked calls to quickly see if a legitimate call is being blocked by a filter intended for someone else (rare).
Title: Re: Block calls by CNAM (CallerID Name) on OBI200?
Post by: Darv on October 19, 2019, 12:56:09 PM
Quote from: Darv on October 18, 2019, 07:52:16 PM

I then set the "ProxyServer" on the Obi200 to VOIP.MS as usual, but I should set the "RegistrarServer" to be  the SIP Redirect server (or is there a way to turn off RegistrarServer?) so the Obi doesn't receive calls directly from voip.ms and therefore won't ring if the number is blocked.


The Manual says:

RegistrarServer: Hostname or IP address of the SIP registrar. If a value is specified, device sends REGISTER to the given server; otherwise REGISTER is sent to ProxyServer

But is there any way to turn off SIP Registration on the Obi200?
Title: Re: Block calls by CNAM (CallerID Name) on OBI200?
Post by: azrobert on October 19, 2019, 01:35:36 PM
How about the following? The OBi200 forks all calls to the phone port and Yate. If Yate gets a reject match, it answers the call with a SIT tone and the OBi200 phone doesn't ring. You can probably send the call to another service that will produce an error message. If no reject match, Yate produces an authorization error for the call from the OBi200 and the inbound call rings the OBi200 phone. If Yate is down, all calls will ring the OBi200 phone.
Title: Re: Block calls by CNAM (CallerID Name) on OBI200?
Post by: drgeoff on October 19, 2019, 01:40:24 PM
Quote from: Darv on October 19, 2019, 12:56:09 PM
But is there any way to turn off SIP Registration on the Obi200?
X_RegisterEnable tick box under the relevant Voice  Services, SPx.
Title: Re: Block calls by CNAM (CallerID Name) on OBI200?
Post by: Darv on October 19, 2019, 02:49:13 PM
Quote from: drgeoff on October 19, 2019, 01:40:24 PM
X_RegisterEnable tick box under the relevant Voice  Services, SPx.

Thank you!

Quote from: azrobert on October 19, 2019, 01:35:36 PM
How about the following? The OBi200 forks all calls to the phone port and Yate. If Yate gets a reject match, it answers the call with a SIT tone and the OBi200 phone doesn't ring. You can probably send the call to another service that will produce an error message. If no reject match, Yate produces an authorization error for the call from the OBi200 and the inbound call rings the OBi200 phone. If Yate is down, all calls will ring the OBi200 phone.

Interesting, but is there a guarantee that the phone doesn't ring, or is it just a race and hope that it doesn't? 

Also, I don't want another call service, I'm trying to keep it simple and local.  If Yate answers and can send the tone itself that would be better, but isn't answering the phone theoretically more expensive than sending a busy (or other) response code?

I don't know how to configure that type of setup in Obi and Yate, but these links make it seem complicated link1 (https://forum.yate.ro/index.php?topic=158.0) link2 (http://blog.paulisse.com/2014/09/custom-caller-id-names-with-google.html).  I'll have to read more about Yate.
Title: Re: Block calls by CNAM (CallerID Name) on OBI200?
Post by: azrobert on October 19, 2019, 03:39:53 PM
It is a race, but I tried it several times and my phone didn't ring. If you do have a problem, you can change the OBi200 ring pattern to have 1 or 2 seconds of silence at the beginning.

Yate can answer the call with a SIT tone. Yate must answer the call to stop the phone ringing. When one leg of a forked call fails the other leg continues to ring.
Title: Re: Block calls by CNAM (CallerID Name) on OBI200?
Post by: azrobert on October 19, 2019, 03:50:03 PM
Download Yate install for Windows:
http://voip.null.ro/tarballs/yate6/yate-6.1.0-1-setup.exe

Select Run

I think you take all the defaults (it's been a long time since my last install).

Yate files are stored at "Program Files (x86)/Yate"

Again, I think you only need 1 config file.

regexroute.conf
[default]
;
; Lines beginning with ";" are comments
;

; Repeat the following as needed
${caller}^8005551212$= goto RejCall
${callername}^unknown$= goto RejCall

.*$=-;error=noauth
; This produces an authorization error and the call processing ends.
; The call leg to the OBI200 phone is not affected.

[RejCall]
.*$=tone/info
; This answers the call with a SIT tone.


Copy the above code into Notepad. Save it as "regexroute.conf".
Do NOT save it as a text file.
Select "All Files" as the type.
Copy the conf file to "Program Files (x86)/Yate/conf.d"

Yate is installed as a Service.
Start Yate by searching for "services app" and click on it.
The Service name is "Yet Another Telephony Engine".
Right click on it and select Start.
If you want to start Yate on boot, right click and select Properties.
Change Startup Type to "Automatic".
Stop and Start Yate after any config changes.

You can also start Yate as an application.
The app is found here "Program Files (x86)/Yate/yate-console"
Double click to start it.
You can create a desktop shortcut.
The advantage of the app is that error messages are displayed in the app window.
Stop the app by closing the window.

Edit:

I forgot the OBi200 mods.

Voice Services -> SPx Service -> X_InboundCallRoute:
ph,sp4(100@xx.xx.xx.xx)

Change xx.xx.xx.xx to the IP address of the computer running Yate.

Service Providers -> ITSP Profile D -> SIP -> ProxyServer: 127.0.0.1
Service Providers -> ITSP Profile D -> SIP -> X_SpoofCallerID: Checked
Voice Services -> SP4 Service -> AuthUserName: anything
Voice Services -> SP4 Service -> X_RegisterEnable: unchecked
Voice Services -> SP4 Service -> X_ServProvProfile: D

If you have a non-GV trunk, you can use it instead of a dummy trunk defined on SP4. X_SpoofCallerID must be checked.
Title: Re: Block calls by CNAM (CallerID Name) on OBI200?
Post by: Darv on October 19, 2019, 06:03:27 PM
Thank you! That will help a lot.  I do not use GV only voip.ms, and I will be trying to put this on a linux box, and using TLS (sips), so I'll need to read some more about the options you've used.

Since I will be checking a list of 1000 CallerID numbers/names in a sql database or text file, it might take a bit longer which might allow the Obi to start to ring.  I will have to think about the race situation a bit more although it does have the advantage of not requiring the Yate server to be up.

Theoretically a blocked caller could repeatedly call, and each time the Yate would answer, and it would cost the voip.ms account money.  I'm not sure what the best way to reject a call is, while avoiding any cost.

The "link1 (https://forum.yate.ro/index.php?topic=158.0)" I posted above suggests the Obi can forward loop to the Yate and then back to the Obi (rather than forking and racing), unfortunately one of the links in there is dead and I don't yet understand the rest or how to configure that on the Obi. And,  I don't know what the consequences would be if the Yate server was down.  I'll keep reading.
Title: Re: Block calls by CNAM (CallerID Name) on OBI200?
Post by: azrobert on October 20, 2019, 08:39:03 AM
If the race is lost, you can change the ring pattern to ring silence for 1 or 2 seconds. Now the phone port will ring (Phone LED will flash for 1 or 2 sec) until the call is rejected, but the physical ringer will be silent.

Ring Settings -> Ring Profile A -> Ring Pattern 1 -> RingPattern:
Default: 60(2+4)
Change it to: 60;2(0+2);58(2+4) or 60;1(0+1);59(2+4)
Ring for zero seconds followed by 2 seconds of silence then repeat ringing for 2 seconds followed by 4 seconds of silence.

The following was my original design, but I didn't post it because of the reliability problem. All calls are routed to Yate. Good calls are routed back to the OBi200. Bad calls are rejected with an auth error. If Yate is down, all calls are dropped.

regexroute.conf
[default]
;
; Lines beginning with ";" are comments
;

; Repeat the following as needed
${caller}^8005551212$= goto RejCall
${callername}^unknown$= goto RejCall

.*$=sip/sip:0@yy.yy.yy.tt:5063
; Routes good calls back to the OBi200
; Change yy.yy.yy.yy to the IP address of the OBi200
; 5063 is the X_UserAgentPort of SP4

[RejCall]

.*$=-;error=noauth
; This produces an authorization error and rejects the call.


OBi200:

Voice Services -> SP1 Service -> X_InboundCallRoute:
sp4(100@xx.xx.xx.xx)

Routes all calls to Yate
Change xx.xx.xx.xx to the IP address of the computer running Yate.

Service Providers -> ITSP Profile D -> SIP -> ProxyServer: 127.0.0.1
Service Providers -> ITSP Profile D -> SIP -> X_SpoofCallerID: Checked
Voice Services -> SP4 Service -> AuthUserName: anything
Voice Services -> SP4 Service -> X_RegisterEnable: unchecked
Voice Services -> SP4 Service -> X_ServProvProfile: D
Voice Services -> SP4 Service ->  X_UserAgentPort: 5063
Title: Re: Block calls by CNAM (CallerID Name) on OBI200?
Post by: Darv on October 20, 2019, 02:16:09 PM
Thanks again, I will try it both ways.

The forking solution answers the call and plays the tone forever, and never hangs up.  That could be a problem, especially since I am paying for the call.

Ideally the Obi would fork and if Yate rejected the Caller ID then the call would receive a "603 Decline" code, and  the Obi would stop ringing, otherwise, if not rejected, just let the Obi ring.  Is that possible?
Title: Re: Block calls by CNAM (CallerID Name) on OBI200?
Post by: azrobert on October 20, 2019, 04:11:45 PM
Yate doc has duration for one of the Tone parms, but I can't get it to work. Maybe you can.
http://docs.yate.ro/wiki/Tonegen
Title: Re: Block calls by CNAM (CallerID Name) on OBI200?
Post by: azrobert on October 21, 2019, 10:28:12 AM
Here is another solution used with the forking method. Rejected calls are routed to a non-existent extension. The call is answered then dropped. The race is lost because this process takes 2-3 seconds, so you will have to use the Ring Pattern trick to keep the phone from ringing.

regexroute.conf
[default]
;
; Lines beginning with ";" are comments
;

; Repeat the following as needed
${caller}^8005551212$= goto RejCall
${callername}^unknown$= goto RejCall

.*$=-;error=noauth
; This produces an authorization error and the call processing ends.
; The call leg to the OBI200 phone is not affected.

[RejCall]
.*$=;called=100
; This routes the call to a non-existent extension.
;The call is answered then dropped.

Title: Re: Block calls by CNAM (CallerID Name) on OBI200?
Post by: Darv on October 21, 2019, 09:38:51 PM
I have discovered how to put a time limit on the call (5 seconds) in Yate's regexroute.conf


.*$=tone/info;timeout=5000


But I would prefer not to answer the call.

If Obi's X_InboundCallRoute is sending the incoming call to both {ph} and {sp4(100@#.#.#.#)}, is there a way to tell Obi not to ring the {ph} and reject the call, all from the {sp4} side of the fork without answering?  Does the Obi ONLY not ring (or stop ringing) the {ph} if the {sp4} completes the call (answers with SIP code 200)?   I've not found this information in the manual.

I haven't tried them, but Yate can return specific SIP codes and optional reasons.


.*$=-;error=401;reason=Unauthorized
;.*$=-;error=noauth


https://en.wikipedia.org/wiki/List_of_SIP_response_codes
Title: Re: Block calls by CNAM (CallerID Name) on OBI200?
Post by: azrobert on October 22, 2019, 12:45:39 PM
There are 2 calls, 1 to the phone port and another to Yate. The only way I know to stop the call to the phone port is to answer the Yate call. 

"200 OK" is sent after the call is answered. I'm not an SIP expert, but I don't think you can send a "200" without answering. Even if you could, VOIP.MS would think the call was answered.

I tried setting timeout to 1 millisecond. I made a test call and heard about a 1 second tone, so there might be a minimum timeout value. VOIP.MS might not recognize a short call as completed. Does VOIP.MS provide a log of charges?
Title: Re: Block calls by CNAM (CallerID Name) on OBI200?
Post by: Darv on October 22, 2019, 09:00:37 PM
I think voip.ms starts charging upon call connection, with a 6 second billing increment. Ideally there shouldn't be any money spent blocking a telemarketer, so the original call should be denied, not answered.
Title: Re: Block calls by CNAM (CallerID Name) on OBI200?
Post by: Darv on November 13, 2019, 07:18:00 PM
Quote from: azrobert on October 20, 2019, 08:39:03 AM
The following was my original design, but I didn't post it because of the reliability problem. All calls are routed to Yate. Good calls are routed back to the OBi200. Bad calls are rejected with an auth error. If Yate is down, all calls are dropped.

regexroute.conf
[default]
;
; Lines beginning with ";" are comments
;

; Repeat the following as needed
${caller}^8005551212$= goto RejCall
${callername}^unknown$= goto RejCall

.*$=sip/sip:0@yy.yy.yy.tt:5063
; Routes good calls back to the OBi200
; Change yy.yy.yy.yy to the IP address of the OBi200
; 5063 is the X_UserAgentPort of SP4

[RejCall]

.*$=-;error=noauth
; This produces an authorization error and rejects the call.


OBi200:

Voice Services -> SP1 Service -> X_InboundCallRoute:
sp4(100@xx.xx.xx.xx)

Routes all calls to Yate
Change xx.xx.xx.xx to the IP address of the computer running Yate.

Service Providers -> ITSP Profile D -> SIP -> ProxyServer: 127.0.0.1
Service Providers -> ITSP Profile D -> SIP -> X_SpoofCallerID: Checked
Voice Services -> SP4 Service -> AuthUserName: anything
Voice Services -> SP4 Service -> X_RegisterEnable: unchecked
Voice Services -> SP4 Service -> X_ServProvProfile: D
Voice Services -> SP4 Service ->  X_UserAgentPort: 5063


I have been trying the above setup so Yate doesn't have to answer the phone.  It works, but I notice that Yate proxies the call's audio channel. It is acting as a middle-man rather than just handing the call back off to the Obi after it accepts or rejects calls.   If Yate goes down during a call (after it has accepted it), the call will die.

So, I have been trying the small "redirect=yes" modification to the above regexroute.conf file:

.*$=sip/sip:0@yy.yy.yy.tt:5063;redirect=yes


Yate will send a 302 reply instead, and the phone successfully rings on SP4.  However, as soon as I answer the call, the call dies.   I am trying to figure out why it dies.

Is it because my "ITSP A>SIP" with voip.ms is using "TLS"  encryption (and "Voice>SP1"="use SRTP only") ?  When Obi redirects the call to Yate it is using plain UDP (not tls).

Or is it because the SP1 -> Yate -> SP4 is using the same port on the obi  OBI.IP:5063 ?   I notice the INVITE request from SP1 -> Yate has

INVITE sip:101@YATEIP:5080 SIP/2.0
Via: SIP/2.0/UDP OBI-IP:5063;branch=z9aG4bK-bf4a8a9a;rport
Contact: <sip:100@OBI-IP:5063>

and then the Yate 302 Redirect back to SP1 will redirect it to the same port (SP4's port):

SIP/2.0 302 Moved Temporarily
Via: SIP/2.0/UDP OBI-IP:5063;branch=z9hG4bK-f757a93c;rport=5063;received=OBI-IP
Contact: <sip:104@OBI-IP:5063>

Is the Obi able to handle the resulting proxying/forwarding of the audio channel from SP1 to SP4?

Or is there some other way to achieve the 302 redirect in the middle without the call dying?  (SP1 -> Yate, 302 Redirect to SP4 if call is accepted, 603 if not -> SP4 -> {ph})

Title: Re: Block calls by CNAM (CallerID Name) on OBI200?
Post by: CALYTA on November 27, 2019, 03:48:38 PM
Quote from: drgeoff on October 19, 2019, 01:40:24 PM
Quote from: Darv on October 19, 2019, 12:56:09 PM
But is there any way to turn filezilla (https://filezilla.software/) uc browser (https://www.ucbrowser.pro/) rufus (https://rufus.vip/)  off SIP Registration on the Obi200?
X_RegisterEnable tick box under the relevant Voice  Services, SPx.
On the other hand, if you have 1000 enemies, and you know the CNAM for each number, then refer to your original discussion.