Dial rule to replace + with 00

Hi all!

My FreePBX 14 works well but there is a little issue…
When an extension is called and not available the phone does record the caller. The number is often an international number. So on calling back it will dial “+49…” but the + is stripped while dialing and so it dials “49…” which leads to a “not in service” message.
Therefore I need to replace the + with 00.

Is there a FreePBX-GUI way to do it?
There are several descriptions about modifying the “extensions_custom.conf” but I’m scared about this. I have no idea about the context to use…

TIA,

HS

You may be able to accomplish this without modifying extensions_custom.conf directly. Most likely, you’ll be setting up an Outbound Route, or setting a Dial Number Manipulation Rule in the trunk’s settings.

For an Outbound Route, you can try to create one with a Dial patter of:
prepend: 00 (this will get added to the beginning of the dialed number)
prefix: + (is used to match the dialed number from the phone, but will be removed before the system dials out)
match pattern: X. (you’ll want something more specific depending on how many digits those calls involve)

This will end up calling out with the 00 included. I’m not sure if you actually want that, but this will likely be the area for this setup.

1 Like

Or set your trunk to the correct e164 country listing

1 Like

match pattern: X. (you’ll want something more specific depending on how many digits those calls involve)

Well, how do I match for a “+” here? I tried this already in an outgoing trunk without success.

Or set your trunk to the correct e164 country listing

Can you please explain this? In my trunk I use the “from-pstn-toheader” context. I found the “from-pstn-e164-us” context but I cannot use it for Germany.

Based on “from-pstn-e164-us” I looked for “from-pstn-e164-de” and found something.
Now I entered in my extensions_custom.conf

[from-pstn-de]
exten => _.,1,ExecIf($[ “${CALLERID(name):0:3}” = “+49” ]?Set(CALLERID(name)=0${CALLERID(name):3}))
exten => _.,n,ExecIf($[ “${CALLERID(num):0:3}” = “+49” ]?Set(CALLERID(num)=0${CALLERID(num):3}))
exten => _.,n,ExecIf($[ “${CALLERID(name):0:5}” = “05131” ]?Set(CALLERID(name)=${CALLERID(name):5}))
exten => _.,n,ExecIf($[ “${CALLERID(num):0:5}” = “05131” ]?Set(CALLERID(num)=${CALLERID(num):5}))
exten => _.,n,goto(from-pstn-toheader,${EXTEN},1)

Ad I changed my trunc context from “from-pstn-toheader” to “from-pstn-de”.

This seems to work because the incoming numbers are no longer full numbers like “+49…” and the call back works fine.

Now I need just to add a rule for international calls to replace “+” with “00”.

Thanks for your help.

Hm… what’s wrong using

exten => _.,n,ExecIf($[ “${CALLERID(num):0:1}” = “+” ]?Set(CALLERID(num)=00${CALLERID(num):1}))

after the other replacements to replace + with 00?

Well, how do I match for a “+” here? I tried this already in an outgoing trunk without success.

In that example, the “+” will be matched from the prefix. As a prefix, it is still included in the match condition, but will not be included in the number for the outbound call. It’s possible that I’m misunderstanding something about what you’re looking to set up.

The scenario I had in mind for applying a rule like that would be for when my phone receives calls from “+491234567890”, and I want to be able to call that number from my phone’s call history without having to manually redial a modified version of that number. That rule would detect that a phone is trying to dial “+491234567890”, and end up sending “00491234567890” to the trunk.

1 Like

Based on my experience and the fact that this question comes up every few weeks, I’d like to offer the following “best practice”:

  1. Always convert inbound calls that use “+” to a common format that works in your location. For many people, that’s converting the “+” to “00”, but it could also means simply stripping the local country code off the number entirely. There is an inbound context specifically defined for doing this in the North American Numbering Plan area. Modify that context to match your locale’s requirements.

  2. Always convert numbers so that they match whatever your Caller ID process looks up. Some countries have different rules from others, so you have to gain some insight into your locale’s numbering rules and what your provider needs.

  3. You need to be aware of what your CRM system is going to use. You don’t want to have to jump through a lot of hoops to get your CRM system working with your phones. Plan ahead for CRM even if you aren’t using one.

2 Likes

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