Leading 0 on incoming calls

Hello everyone,

since a few days I have a FreePBX 13 Beta installation for testing a sipgate trunk.

At the moment I’m able to receive incoming calls. Unfortunately a incoming call from my mobile phone is displayed as 0175160xxxx instead of 00175160xxxx. I’m missing the leading 0.
How can I add this?

What I’ve tried:

  1. Add a context “context=add-null” in connectivity → trunks → sip settings → outgoing (for my understandign it should be placed at “incoming” but it does not get recogniced there)
  2. Added to the (empty) extensions_custom.conf:
[add-null]
exten => X.,1,NOOP("Entered fixedcid")
exten => X.,2,Set(CALLERID(num)=0${CALLERID(num)})
exten => X.,3,Set(CALLERID(name)=${CALLERID(num)})
exten => X.,Goto(from-trunk,${EXTEN},1)
include => from-pstn
  1. Results - nothing!
    The called extension rings
    The Number is displayed without the leading “0”

  2. Log after a reload:
    After a reload I found a warning which I don’t understand

WARNING[4639] pbx_config.c: Label missing trailing ‘)’ at line 6 of /etc/asterisk/extensions_custom.conf

  1. Log after a call:

    http://cloud.comparion.de/owncloud/index.php/s/b8liI6jMtOXkl8Y

any idea is welcome - quite hopeless
regards
Robert

Bunch of issues…

  1. To change the context of inbound calls for a specific trunk, the context needs to be defined in ‘Peer Details’ for the trunk in question.

  2. Lots of errors in your dialplan. The extension is missing the leading underscore to indicate pattern matching, the goto line is missing the priority, the variable CALLERID(num) should be CALLERID(number), you are including a non-existent context, it should be from-pstn. Try this:

    [add-null]
    exten => _X.,1,NOOP(“Entered [add-null]”)
    exten => _X.,n,Set(CALLERID(number)=0${CALLERID(number)})
    exten => _X.,n,Set(CALLERID(name)=${CALLERID(number)})
    exten => _X.,n,Goto(from-trunk,${EXTEN},1)
    include => from-pstn

I also question the wisdom of prepending all CID numbers and overwriting the incoming CID Name, but I presume that is intentional.

Also, you’re not checking if no Caller ID is provided at all, so you’ll get calls with just the CID of ‘0’.

Hi,

thank you very much for the great help.
First of all - your script works perfect (as I can see now, no side effects).

For other users with the same problem:

  1. Yes, the “Peer Details” are located under Trunk-> sip settings ->outgoing at the new beta version.
  2. The “include => from-pst” was a typo (I’ve corrected this in my original post)
  3. I’ve closed the download-link, because there is no helpful information in to solve the issue.

best regards
Robert

1 Like

Hello @lgaetz @xrobau

I’m sorry for reopening this thread.

We are using FreePBX 15.0.17.17 in Germany, in Germany every Telephone Number has a leading 0, for example 0244XXXX.

In order of the change from our old ISDN phone system, my family wanted to keep an implementation with double 0 to make calls. So if they want to make a call they have to dial 00XXX.

Now our problem is that we can’t redial from the incoming calls because they only have one leading 0, now I’m trying to manipulate all incoming calls to add one 0, but I had no success with it even with Igatez example. Do you maybe had some idea? I would appreciate every hint

See

However, unless you have a strong reason to keep it, I recommend removing the requirement for the extra zero, as it causes many problems.

If you don’t make or receive many international calls, you could set up your system so the extra zero is permitted but not required for domestic calls (but would be still needed for international). That would make displayed domestic numbers easier to read, and would allow for passing the proper caller ID on forwarded calls.

What city are you in? (There are area codes begin with 0244 but have an additional digit.)

Hello Stewart

Thanks for the help, I already saw this post and tried to implement it without success. If I include the code the Operator is not able to forward calls to my Number. Something like the Trunk is not able to receive calls I must add include => from-pstn to be able to receive calls again. But it has no effect on the incoming caller number.

I know it would be a lot easier without the extra 0, and I tried to explain this and move my Family to accept this, but they don’t want it because of the way the old system worked, and they feel safer to not call accidentally an emergency number, I don’t really understand it.

Our initial number is 04408……. The other number was only an Example without any relation to us.

I’m guessing that the user part of SIP URI does not begin with a digit, either because the operator sends the called number as +494408xxxxxx, or because they put the user name there (and send the called number in the To header).

Try changing the custom dialplan in extensions_custom.conf like this:

[prepend-zero]
exten => _.,1,GotoIf($[ "${CALLERID(number)}" = "anonymous" ]?nochange)
exten => _.,n,Set(CALLERID(all)=0${CALLERID(num)})
exten => _.,n(nochange),Goto(from-trunk,${EXTEN},1)

If you still have trouble, paste the Asterisk log for a failed call at pastebin.freepbx.org and post the link here. Also, please post: who is the operator? What was the Context for your trunk, before changing it to prepend-zero?

In Hude, from a normal landline phone, you can call local numbers by dialing 4 to 6 digits, without an area code. Do you permit that on your system, either with or without an extra 0? If not, you can add an Outbound Route that permits dialing domestic numbers without the extra 0, while not affecting any of the formats you have now.

Someone visiting or working in your home (babysitter, plumber, etc.) might have an emergency but not be familiar with your system, so you should make sure that 112 and 0112 both work (and similarly for 110 and other emergency numbers). You should teach your family that if they accidentally do call an emergency number, they should not hang up and should explain to the dispatcher that they do not have an emergency and dialed the number by mistake. Once confirmed, they can hang up and be confident that the police or ambulance will not be sent.

Thank you Stewart it worked really well how I see it was only a little change in the code, sorry I’m not really familiarized with PBX systems I’m a lot better in Networking, and builded the FeePBX up with a lot of tutorials, it is a really complicated topic, I was able to solve every other Problem with google and I learned a lot in the Process. This was the only point I was not able to solve by myself so thank you again for the help.

Yes I’m allowing to make local calls without 04408…, they wanted me to implement it that they have to call here also with a 0 for example 05678 so Freepbx would call 044085678.

We implemented this system in the Family company, only persons with knowledge about it are present, most of our employees are with us for a lot of years and are familiarized with this from our old Phone system. They are really resistant against changes, my first implementation was without the leading 0 they make me change it after hours of discussion.

I don’t really know why this is a common way to implement systems here, I work for an company in Hamburg Germany, they opened an Store here 4 years ago, and installed an “Innova phone” phone system who also an extra 0 is needed and the emergency numbers are only reachable over 0112 or 0110. We have to train every new employee in that, and we receive a lot every Sommer for short periods.

Hi me again

I used the Code you give me, and it worked well for something like one day, now there a change in the way the incoming Phone numbers are displayed.
Before i implemented the code the caller Number was displayed like 0175… after implementation the Numbers was displayed like 00175… it was that what i wanted.
But now the caller id are Displayed like +49175… with the Code it was something like 0+49… it is normal i know because i`m adding a 0.
But i have no idea why the formatting of the caller id just changed.

and thanks again for your help.

There is a general trend for VoIP providers to use E.164 format, because it is unambiguous.

I don’t know why your trunking provider made the change. Possibly, they implemented a newer software package, merged with another company, or the Bundesnetzagentur required it.

If it’s not a problem for you to see numbers starting +49, you could take out the code to prefix a 0 and modify your outbound routes to accept numbers starting with +, in addition to the formats accepted now.

Alternatively, if you want to see numbers formatted the old way, you could modify the code to replace +49 with 00 and then + with 000.

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