Caller ID number prefix weirdness

Hello everyone, I’m not sure if this is a freepbx and/or asterisk configuration problem but I’d appreciate your thoughts.

Local incoming calls look like: 441203123456 (44 country code, the rest is phone number)

International incoming calls look like: 004953161234 (49 country code, rest is phone number)

So here is the fun, the Grandstream phonebook over bluetooth contains numbers like (as transmitted by my mobile phone): +441203123456

As you can see, none of the above three numbers match, which breaks incoming call caller ID phonebook matching :frowning:

Any suggestions on how to fix this issue would be appreciated. Preferably something that would make all incoming caller id’s look like the fully prefixed like the numbers in my mobile phone.

Thank you!

Use a modified for UK version of the [from-pstn-e164-us] you will find in extensions.conf add it to extensions_custom.conf and send your inbound calls there.

dicko, first of all, thank you for your quick reply.

I looked at the [from-pstn-e164-us] section, which does some extra things that I don’t need or aren’t correct for my country, so I need to do some modifications.

Unfortunately, I’ve never done this before (the freepbx web interface has always been enough), so I don’t know what these scripting commands mean. Is there a “how to” guide which explains these commands, so I can learn the basics?

Thank you.

http://www.asteriskdocs.org/en/3rd_Edition/asterisk-book-html-chunk/asterisk-DP-Basics-SECT-1.html

for the basics, perhaps

http://www.voip-info.org/wiki/view/Asterisk+variables

for the string manipulation you are looking for in your newly minted [from-pstn-e164-uk]

The second link provided the needed information, here is what I’ve come up with:

; my custom pstn
;
;  +44xxx ->    xxx
; 0044xxx ->    xxx
;   44xxx ->    xxx
; 00xxxxx -> +xxxxx
;
[from-pstn-custom]
exten => s/_+44N.,1,Set(CALLERID(number)=${CALLERID(number):3})
exten => s/_0044N.,1,Set(CALLERID(number)=${CALLERID(number):4})
exten => s/_44N.,1,Set(CALLERID(number)=${CALLERID(number):2})
exten => s/_00N.,1,Set(CALLERID(number)=+${CALLERID(number):2})

the above removes country code “44” so all local calls appear… well local. All international calls (not 44) will switch from 00 prefix to + prefix, so they will match my phone book.

now all I have to do is… test :slight_smile:

PS:
the above should be copy-pasted in extensions_custom.conf and it will be automatically included by “from-pstn”.

2 Likes

Very good!!, for completeness In the UK you might want to add a 0 at the beginning of “national numbers” after the e164 “normalization” , just like you are used to dialling. many phones don’t have a + key, so you could also think of replacing the + with 00 , again for normalization of uk dialing. thus

+442072345678 becomes 02072345678

and

+493034565432 becomes 00493034565432

1 Like