FreePBX | Register | Issues | Wiki | Portal | Support

[SOLVED]Inbound routing


#1

Hi, I have checked the forum on inbound routing and noted that some have done this by using IVR etc. From doco it appears that I should be able to do the following;

  1. if CID is set to ‘anonymous’ by the provider then any call destined to my DID with CID set to anonymous be simply forwarded to my voice mail.
  2. if CID is set to any other value then a call destined to my DID with the non-anonymous CID be routed to a handset.

The above logic fails every time and all calls whether their CIDs set to anonymous or not get routed to the handset.

Can someone please point out what I am doing wrong here?

Many thanks


#2

On a blocked call, what is shown in the CallerID field of the CDR? If something appears between angle brackets, use that value in your Incoming Route. For example, if you see “Anonymous” <0>, put 0 in the CallerID Number field in your Incoming Route. If you see just a word such as UNKNOWN, use that in your Incoming Route.

If you still have trouble, post a log for a failing call, the corresponding CDR entry and your inbound routes settings.

BTW, your request seems strange to me. If this is for a business, be aware that some customers don’t like to leave messages. They get voicemail and decide you are not in. After a few tries, they give up and go to a competitor. Better to first route such calls to an announcement, e.g. “Thank you for calling Acme Widgets.
We’re sorry, but your number did not register in our system. Please call back, being sure to unblock your number. Or, you can stay on the line to leave a message. Include your number so we can get back to you. Thanks.”

For a home system, most of your unwanted calls will likely have spoofed or misleading numbers. Consider using other methods to avoid being disturbed by undesired calls.


(Itzik) #3

Seems like any of your clients never experienced harassment…
Although blacklisting is a great feature, but i can say that once we implemented to send anonymous calls to a Voicemail Box, they are much happier than ever…


#4

@Stewart1, Thanks for the response. What I did is to make a call with CID disabled and check Wireshark capture as well as check the FreePBX log and here is what I saw.

Wireshark SIP Invite

Frame 117: 1239 bytes on wire (9912 bits), 1239 bytes captured (9912 bits) on interface 0
Ethernet II, Src: Technico_6a:d7:72 (e0:b9:e5:6a:d7:72), Dst: Raspberr_03:23:44 (b8:27:eb:03:23:44)
Internet Protocol Version 4, Src: X.X.X.X, Dst: 10.10.10.231
User Datagram Protocol, Src Port: 5060, Dst Port: XXXX
Session Initiation Protocol (INVITE)
Request-Line: INVITE sip:XXXXXXXXXX@X.X.X.X:5160 SIP/2.0
Message Header
Via: SIP/2.0/UDP 203.2.134.1:5060;branch=z9hG4bKn4i3th10bouqu7df0700.1
Transport: UDP
Sent-by Address: X.X.X.X
Sent-by port: 5060
Branch: z9hG4bKn4i3th10bouqu7df0700.1
From: "Anonymous"sip:anonymous@anonymous.invalid;tag=433279280-1520759216127-
SIP Display info: "Anonymous"
SIP from address: sip:anonymous@anonymous.invalid
SIP from address User Part: anonymous
SIP from address Host Part: anonymous.invalid
SIP from tag: 433279280-1520759216127-
To: "Phone"sip:XXXXXXXXXX@sip.a.b.c
SIP Display info: "Phone"
SIP to address: sip:XXXXXXXXXX@sip.a.b.c
SIP to address User Part:XXXXXXXXXX
SIP to address Host Part: sip.a.b.c
Call-ID: BW090656127110318-40737211@Y.Y.Y.Y
CSeq: 170396672 INVITE
Sequence Number: 170396672
Method: INVITE
Contact: sip:anonymous@X.X.X.X:5060;transport=udp
Contact URI: sip:anonymous@X.X.X.X:5060;transport=udp
Contact URI User Part: anonymous
Contact URI Host Part: X.X.X.X
Contact URI Host Port: 5060
Contact URI parameter: transport=udp
Supported: 100rel
Allow: ACK,BYE,CANCEL,INFO,INVITE,OPTIONS,PRACK,REFER,NOTIFY
Accept: application/media_control+xml,application/sdp,multipart/mixed
Max-Forwards: 69
Content-Type: application/sdp
Content-Length: 584
Message Body

Asterisk log

[2018-03-11 20:06:56] VERBOSE[790][C-0000003f] pbx.c: Executing [s@macro-user-callerid:35] Set(“SIP/XXXXXXXXXX-000000b5”, “CALLERID(number)=anonymous”) in new stack
[2018-03-11 20:06:56] VERBOSE[790][C-0000003f] pbx.c: Executing [s@macro-user-callerid:36] Set(“SIP/XXXXXXXXXX-000000b5”, “CALLERID(name)=Anonymous”) in new stack

In my inbound routes I have one entry to catch XXXXXXXXXX DID and “anonymous” CID
and another route for XXXXXXXXXX DID and ANY CID

As mentioned earlier, all calls whether CID is set or not goes to the second route.

With regards to your comment about the reason for this set up, as @PitzKey has already mentioned, the purpose is to send all calls without a CID to voicemail directly and most telemarketers never bother to leave messages.

I am also looking at the IVR option which is documented by someone else in this forum but it would be nice to know why I cannot do this using simple routing - obviously I am missing something here?

Thanks


(Itzik) #5

Most of these telemarketer calls are a robot that tells you to press 1 to be connected to an agent.
So if you point your inbound route to a IVR which you have to press any key in order to proceed, and set the timeout to terminate the call, you’ll just get rid of all these automated calls.


#6

@PitzKey, as you may have already realized this is for home use and I prefer not to require my family and acquaintances to go through IVR although it may just mean having to press one button. My plan is to route all No CID callers to the IVR which will include mostly telemarketers and a few friends who may have set up their phone not to send the CID and hence the need to get the inbound routing working. Obviously, telemarketers who present their CID will get through but since I have CID Lookup set up I can then decide whether to answer a particular call or not.


(Itzik) #7

FYI, if you search on the community, there are plenty posts from users who integrated “blacklist” with a global blacklists.

(After all, there are some people, like police departments etc who will call you anonymously)


#8

Sorry for being so negative about blocked caller ID – in the US and EU, nearly all spammers and scammers use spoofed or otherwise misleading numbers, rarely blocking. Anonymous calls may come from misguided friends and relatives who have per-line blocking on their phones. It appears that (perhaps because of stronger laws or regulations), spoofing is not so common in Australia.

I cannot see from your log why the selective routing isn’t working. Here are a few things to try:

  1. The tool tip for Caller ID Number mentions Anonymous (rather than anonymous) – try that if you haven’t already.
  2. Test that selective routing does work by setting Caller ID Number to your mobile number (in the format that NodePhone sends it, probably e.g. 0422333444).
  3. If the above test fails, see whether an unconditional route to voicemail works.
  4. If (2) passes, you can likely work around the problem by routing onymous calls to your phone, with the Any CID route going to voicemail. Try setting Caller ID Number to “_[0-9]XX.” (without the quotes).

I’m a migratory bird with locations far apart, so unwanted calls come in at all hours of the day and night. Over the years, I’ve made a pretty good spam filter. A simplified description: The incoming caller’s number is checked against a whitelist (Asterisk Phonebook). If found, my phone is rung. Otherwise, the caller is routed to a simple IVR; the announcement says “For Stew, please press 7.” If the caller presses 7 within 5 seconds, his number is automatically added to the whitelist and my phone is rung. Otherwise, the number is looked up with a ‘caller reputation’ service. If the spam probability is high, the call is disconnected. Otherwise, the call is sent to voicemail. On outbound calls, the called number is automatically whitelisted. Performance is improved by using a DID provider that delivers blocked numbers (in the P-Asserted-Identity header).

This system blocks virtually 100% of spam, but some desired calls are also blocked. Robocalls such as an appointment reminder from the dentist’s office may be blocked, though sending them to voicemail is usually not a problem. On very rare occasions, someone not yet whitelisted fails the test, e.g. because they were driving or didn’t understand the instruction. The most common failure is when you call a large company for customer service and they schedule an automated callback, in which case I manually disable the spam filter while awaiting their call.


#9

@Stewart1, @PitzKey , thanks a lot for your suggestions and comments.

It appears that CID matching on the inbound route is case sensitive! My provider sends it as ‘anonymous’! All along I have been trying out with ANONYMOUS and Anonymous and both of course failed. A trap for the new players, I guess :slight_smile:

@Stewart1, can you please let me know how you do the incoming CID check against the Phonebook and determine whether there is a match or not?


Change call flow based on results of a custom destination
#10

Here is some of my spam filtering logic. For each filtered DID, there is a little custom dialplan in extensions_custom.conf :

;Stewreno
[custom-stewreno]
exten => s,1,NoOp(CID:${CALLERID(num)})
exten => s,n,GotoIf(${DB_EXISTS(cidname/${CALLERID(num)})}?wl)
exten => s,n,Set(CDR(userfield)=F)
exten => s,n,Goto(ivr-4,s,1)
exten => s,n(wl),Set(CDR(userfield)=W)
exten => s,n,Set(CALLERID(name)=${DB(cidname/${CALLERID(num)})})
exten => s,n,Goto(from-did-direct,1001,1)

[custom-stewreno-pass]
exten => s,1,Set(CDR(userfield)=P)
exten => s,n,Goto(from-did-direct,1001,1) 

The Inbound Route for my Reno DID goes to a Custom Destination that points to custom-stewreno.
If the number is not in the phonebook, the CDR is (tentatively) marked F (fail) and control is transferred to an IVR specific to each filtered DID. If it is in the phonebook, the CDR is marked W (whitelisted) and control is transferred to extension 1001.

The ‘success’ destination of the IVR is custom-stewreno-pass, which marks the CDR P (pass) and goes to ring the extension.

The ‘failure’ destination of the IVR (invalid or no key entered) goes to custom code (not shown and not applicable to Australia) that queries a reputation service to decide between voicemail or just hanging up.

Automatic additions to the phonebook are done outside of FreePBX by a script that queries various sources for a name to associate with the number. I chose this method so problems with the process would not cause calls to fail or be delayed.

If you are interested in switching from NodePhone to a service with ANI (unmasking blocked numbers), I have accounts with AnveoDirect and Voxbeam. (Prices below are in US dollars.)

AnveoDirect rates are pretty good; AU DID $3 setup + $1.50/month + $0.004/minute; Outbound to AU landline $0.008/min.; AU mobile $0.026/min. They offer a small credit at signup so you can make a few test calls without a payment. Unfortunately, the porting fee for AU is obscenely high at $110 (!) so it would only be practical if you didn’t need to keep your number, or if you just use them for outbound and/or an additional number.

Voxbeam charges $4 setup + $4/mo. for an AU DID, with no charge for incoming calls (there are some limits but a home user would be very unlikely to hit them). Outbound prices vary with destination but are less than $0.01/min. (landline) and $0.02/min. (mobile). They also offer a small test credit. Unfortunately, porting fees are not posted on their site; email them at dids@voxbeam.com .

Both of the above services use IP authentication so you need a static or de facto static IP address. If neither is suitable, you can probably find an Australian company that will do better, though I don’t know how to search for one that offers ANI.


#11

@Stewart1, Thanks so much for sharing your code. I am still trying to get my head around doing custom extensions but this certainly puts me in the right direction. It helps immensely when I can see actual coding example to work out the mechanics of Asterisks - thanks again.

With regards to AnveoDirect and Voxbeam, my issue is that for some very good reasons, I want to keep my number and if porting is going to cost an arm and a leg then it is not going to work out for me. However, the rates listed appear very attractive and I might look into the option of getting a separate number which I can use for dealing with external organizations and restrict the use of the existing number for calling friends and hopefully over a period of time reduce the junk calls coming in my existing number.


#12

@Stewart1, implemented your code snippet and works like a charm! Being a novice with Asterisk, I had a few battles with trying to work out how to forward the calls a ring group instead of a single extension - could not find the syntax anywhere. After a lot of trial and error changed

exten => s,n,Goto(from-did-direct,1001,1)

to

exten => s,n,Goto(ring-group,8878,1) and it all now works - 8878 is the ring group number.

This is just for the benefit of anyone else who might come across this issue.

Thanks Stewart - you are a champion!


(system) #13

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.