Please, share your German Dial Pattern - Help

Hi! I have a FreePBX 13 up and running, trunks, outbound and incoming routes added and extensions working. However, I am having difficulties with the dial plan (pattern). I am based in Germany and have a local landline with a flat cost plan for domestic calls to other German landlines and mobiles. I have also a SIP provider for international outbound calls.

What I did: I created two trunks, (A) one uses the local land line with flat cost plan. The other (B) uses the SIP provider for international calls.

Number format for German landlines is XXXX XXXXXX, for instance 07568 787878. Number format for German mobiles is XXX XXXXXXXX, for instance 0876 78787878. To place international calls from Germany, we dial 00 + country code + local landline or mobile number.

Question: What would be the dial pattern that will route all the local (domestic) calls to landlines and mobiles automatically through the Trunk A and block them to go through Trunk B? Also what would be the dial pattern to route all international calls through Trunk B?

At present I have the X. dial pattern in Trunk B, and it will not block domestic calls.

I know this must be something easy, but I am not finding the two working dial patterns. Any advice is welcome! :slight_smile:

Assuming your SIP provider is also German and wants the numbers in the same format,
you’d need 2 outbound routes.

First one with match patterns 00Z.
This routes all 00 calls to trunk A

Second one with match pattern 0N.
This routes 0+[2-9] calls to trunk B

You don’t need to block anything in the trunks, and I am not sure you CAN block anything in the trunks because it is my understanding that a trunk will always process calls if routed to the trunk even if the match pattern does not fit. (please correct if I am wrong)

You could in theory prepend some nonsense number in the trunk to block the call
e.g. 999 + 00Z. in trunk B (no international calls)
that way even if a call is routed to “B” it would send nonsense to the carrier.

1 Like

Many thanks dcitelecom. Yes, both SIP providers are German. For Trunk A (International) is PeopleFone and for Trunk B it is KabelDeutschland (Vodafone).

Thank you, the Trunk A is routing all the international calls, using the dial plan 00Z. (zero-zero-z-point).

However, Trunk B is not working with 0N. (zero-n-point). The local calls are being routed to Trunk A (International) and wil obviously not complete because they lack the 00 and country code. This is happening when dialing out to German fixed lines (0xxxx xxxxxx) and also to German mobile lines (0151 XXXXXXX, 0176 XXXXXXX, etc.).

Please, any ideas on how to fix this issue for Trunk B (local calls)?

Your first post said German landlines don’t start with 01… Anyways, try this.

The FIRST trunk “A” must be your overseas trunk
so 0171 and 0876 will not match

The SECOND trunk “B” (local calls & mobile) should be
so 0171 and 089 will match

Many thank! I managed to get Tunk A (outbound overseas trunk) working well. However, the local calls continue being routed through Trunk A and not Trunk B (outbound local). Is there any settings inside FreePBX to link (and restrict) each outbound route to its respective trunk?

pls post a screen shot of your trunk A & B dial patterns
the corresponding trunk Sequence for Matched Routes


Trunk A (Overseas) works fine.

Trunk B (National): yesterday I had it fully configured including its Outbound Route and both were linked through the Trunk Sequence field at the Outbound Route dial pattern tab. The national call would go through Trunk A.

Today, I deleted Trunk B (National) and its related Outbound Route and created them again with the same configuration. Now, the national call goes through Trunk B (National) and not anymore through Trunk A. Issue partially solved.

However, the national call will not complete. Error message runs: “The number you have dialed is not in service”, while the phone numbers are indeed in service. I test them and they work.

I believe now it is only a matter of dial pattern for the National Outbound Route. The here you have the screenshots for Trunk B (National) and its Outbound Route:

Trunk B (National)

Outbound Route B (National)

The Dial Pattern in the Outbound Route B (National) is 0ZX. This is because we can have regional dialing numbers like 06133 XXXXXX, 030 XXXXXX and mobile phones 0176 XXXXXXXX, or other mobile prefixes as 0151 and other. For this reason I cannot set N after Z in the Dial Pattern you proposed.

Thank you

Sorry I made a mistake. I need the OUTBOUND routes not the trunks
and I do need both A & B.

pls post a screen shot of your outbound routes A & B dial patterns
the corresponding trunk Sequence for Matched Routes

Why is your trunk PJSIP??? I am pretty sure you use SIP not pjsip.
And why is there a password to access the trunk?
If the trunk is not configured correctly the calls would fail.

No problem, here you have the screenshots from the Outbound Routes.

Outbount Route A (Overseas) is working very well, no problems on that. Local cals are now being correctly directed to Outbound Route B (National), but they will not complete the call, error “The number you have dialed is not in service” (they are in service and I am using them).

Replying to your questions:

  1. PJSIP, why not? It is updated. It’s been used more and more and I find no difficulties with my Overseas calls. By setting up PJSIP from start, I avoid having to reconfigure FreePBX a couple of years from now, when SIP is discontinued.
  2. Trunk Password: a trunk userid and password is needed to login into the SIP provider I rent the trunks.

I am not an expert, but I believe that the issue on Trunk B (National) is with the Dial Pattern, not with the trunk password. But, any advice is welcome! :slight_smile:

It’s not 100% clear in the image you posted but I believe your ‘InOut trunk’ does not have a dial match pattern.

Your outbound route is ok so calls are routing to the trunk but then they fail because the match pattern is blank.

Of course it could also fail because of your SIP settings but I have no experience with PJSIP so I have to pass on this.

1 Like

Hi dcitelecom, many thanks. I added the same Outbound Route B diall pattern into Trunk B, but the call will not complete. I will re-check all the settings tomorrow, I believe solution is close by. Thank you for your help.

at this point I would suggest to check the log.
core set verbose = 5
make a call that fails
look at the log why it fails.
correct the mistake

Since this came up via google for “German freepbx dail pattern” and as of 1K views, ill put a real dail pattern here:

In Germany we have:

national land line 02… to 09… the dail pattern is for this:
prepend empty
prefix empty
match pattern “0N.” or “0[2-9].”

local area land line 2… to 9… the dail pattern is for this:

prepend: local area code (eg for Stuttgart Germany 0711) (if you dont want to dail it yourself for local numbers, and if your carrier require to dail local numbers also including local area code.
prefix: empty
match pattern: “Z.” incl. emergency “N.” w/o emergency (now you need an emergency route as well, its matchpattern is “1.” (german emergency numbers fier & ambulance 112 / police 110 / doctor 116 117)

national cellphone network: 015… to 017… the dail pattern is for this:

prepend empty
prefix empty
match pattern “01Z.” (or “01[5-7].”

And then there is CallByCall, this is a selection of PTSN Carrier via your original Carrier Telekom. Only the German Telekom is reuqired by law to offer CallByCall, so if you have a Telekom contract you need to pass the call by call metric also to the Telekom PTSN (maybe you have a AVM Fritzbox with the Telefonsparbuch running, then just pass it to the Truck of the Fritzbox and let the FritzBox handle the Call-By-Call on the database supplyed by Telefonsparbuch,… ah well, now I know why its name is FritzBox, Fritz=German lol.)

It is 010xx to 010xxx

if you want to rout all outgoing calls to one call by call carrier, put in the prepend field his CallByCall pre dail number

If you want to do it by hand, you need to have this dail pattern:

Prepend emty
Prefix empty
match pattern: “010.”

And for international calls, the allways start with 00 so its

prepend empty
Prefix empty
match pattern “00.”

and then there are service number like 0800 free call service or 0900 expensive call service.

Sof if you dont want to be able to dail them, you need to modifie the landline match patern

all Numbers where “0N.”

W/O service Numbers its “0NZ.”

(some carriers do charge big for freecall or service numbers, the price is only fixed if you use German Telekom, the other carriers are free to choose their own price for the service numbers. especially with cell phone it could get expensive)

correct me if I am somewhere on the wrong track.


I know this threat is 3 years old. But as it has never been answered correctly/completely and is currently number 2 in Google for “FreePBX DialPlan Germany”.

First of all, the number formats XXXX XXXXXX for land lines and XXX XXXXXXXX for mobile phones used by the original poster are both WRONG.

Secondly, the information contained in the pictures, screen shots and texts posted in the many answeres is stolen from Wikipedia and it is at least not complete, in parts even wrong.

Attached to my post you can find a COMPLETE dial plan for Germany. It contains ALL area codes, sorted not only by geographic area but by hotline and service types so you can decide which hotlines, and service numbers you want to allow and which you want to ban.

The whole thing very complex, so it CANNOT be simplified into a few lines. If you try to simply it, that meens loosing information and throwing numbers together that don’t belong together!

It’s on my Google Drive and will be changed as soon as something changes.