Call full external Number from Intern

Hi,

since this week I am playing around with FreePBX. I already configured a few Cisco 7911 and Cisco 7962 IP Phones via Endpoint Manager and it works very well.

Now I included an LDAP Directory on my IP Phones. The Problem is, in this directory the Numbers are written out complete, including area code and company number.

Example:
+49-543-5766-632
+49-areacode-CompanyNumber-extensionNumber

Is it possible to cut everything from the number and just call the extension and handle the call internal?

Greetings
Tobias

Hi,

You can use this small dial plan that I have wrote for you. Add it to the extensions_custom.conf file and then run this command from the linux console (not the Asterisk console): asterisk -rx'dialplan reload'

[from-internal-custom]
exten => _+49-X.,1,Set(LDAP_CONTACT=${CUT(EXTEN,,4)})
exten => _+49-X.,n,NoOp(LDAP_CONTACT is: ${LDAP_CONTACT})
exten => _+49-X.,n,Goto(from-internal,${LDAP_CONTACT},1)
exten => _+49-X.,n,Hangup

Please report back for your results.

Thank you,

Daniel Friedman
Trixton LTD.

Hi,

no it doesn’t work. I made a mistake. There are no “-” in the Number.
Is it Possible to use the Cut function without delimiter? Or is there an other function to cut just the beginning of the Number?

Greetings
Tobias

Hi,

Please provide an example of a number that is being sent to the PBX.

Thank you,

Daniel Friedman
Trixton LTD.

Hi,

For example:
+4978455488901

the last 3 Numbers are the internal Extensions, so I have to cut +4978455488 and just dial 901

Greetings
Tobias

Hi,

In that case you should change my dial plan to this:

[from-internal-custom] exten => _+49X.,1,Goto(from-internal,${EXTEN:11},1) exten => _+49X.,n,Hangup

Thank you,

Daniel Friedman
Trixton LTD.

Hi,

Thank you very much :slight_smile: that’s what I need !

Greetings
Tobias

Unfortunately it’s a little more complicated for Germany,

specifically “. . . It is not possible to determine unambiguously the end of a phone number from a prefix or the digits already dialed. . .”

You will have to write something area code specific.

Hi,

no, the solution works for me, because I only have to determine if the number is one of my Internal numbers. All our internal numbers have the same prefix (they look like that: +4978455488XXX) so I have to cut the first digits und just call the last 3.

I have to do that, because I use our company LDAP Directory on our Cisco phones and in that Directory we have the full telephone number of all employees from all Locations of the company and not just the extension number.

Other numbers are send out to via PSTN.

I think that what you really want is an ‘outbound’ route with a prefix of +4978455488
Either that or use the script from danielf, matching for +4978455488 rather than just +49

the custom script, from what I can see would match any number that comes from Germany, and peel off the first 10 digits (and the + for 11) – which I don’t think is what you actually want.

Hi!

I would have been tempted to go that way but if @danielf suggested the other way he probably saw a reason why this would not work…

(I am assuming all the formatting stuff but I could be wrong…)

Actually I am pretty sure this will do exactly what he wants…

When you call a Germany number from Germany do you prefix it with the country code?

I am not from there but I am pretty sure that you don’t so the only times he will attempt to call from Germany a German number prefixed with the country code is when the phone number comes from his LDAP server…

So it sounds to me that what @danielf provided him will work as he wants…

Have a nice day!

Nick

Hi,

it works for me because I only have to check if the Number starts with something like this:+4978455488 <== All numbers which are starting with +4978455488 are numbers of the location of my company. So if I dial a number which is starting with +4978455488 our Asterisk definitely can handle the call Internal.

So if I dial INTERNAL +4978455488389 I cut off the +4978455488 and dial only the 389 and ignore the +4978455488.

Hi!

@darkonc point was that the test is only for +49…

But unless you have to call any other number by prefixing them with +49 this will never ever cause any problem…

In North America long distance number are/were called by prefixing them with 1 which also happens to be the “country” *** code but it doesn’t look like the same situation could ever happen in Germany, you would never call another german number by prefixing it with +49…

Have a nice day!

Nick

*** A “country” code which is shared by many countries which use NANPA (North American Numbering Plan Administration…