# [Asterisk-Users] Grandstream Early Dial

Peter Corlett abuse at cabal.org.uk
Tue Jun 8 01:56:32 MST 2004

```Aaron Martin <listasterisk at comtek.co.nz> wrote:
> Has anyone managed to get Early-Dial working with the grandstream
> phones?

Yes, but it doesn't play nicely once calls are being gated to the
PSTN.

Early Dial works by attempting a call for each digit that is dialled.
Asterisk will try each such call across the dialplan and will give a
484 response if there's no matching extension but there might be a
matching extension if more digits are dialled.

Unfortunately, this algorithm doesn't work if you have any
variable-length extensions. For example:

# Internal extensions are 300-399
exten => 3XX,1,Macro(dial-exten,\${EXTEN})
# Numbers starting 0 are PSTN calls
exten => _0.,1,Macro(dial-pstn,\${EXTEN})

If I dial 333, Asterisk will return 484 after the first and second
"3". On the third "3", the extension matches, and the call will be

Now suppose I want to call 01234 567890. Asterisk will return 484 for
"0". However, when the "1" is dialled, the extension matches, and a
call will immediately be attempted to "01" (and fail), without me
having had opportunity to dial the rest of the number.

Unfortunately, the UK does not have fixed-length numbering. While it
is *mostly* 10 digits (excluding the initial zero), there's some 9 and
7 digit numbers in the mix too.

No problem, I thought. It's just a case of converting the Oftel
codelist.zip into a large exception list of 7 and 9 digit numbers for
the dialplan, and assume 10 digits for everything else. The end result
of this was to discover just how lousy the data was. The number range
containing 0800 800 150 was listed as having ten digit numbers
(remembering that the initial zero doesn't count) as was the somewhat
famous 0800 1111.

Attempting to kludge round the problem just caused a number of other
issues elsewhere that weren't really Asterisk or the Grandstream's
problem, but made the whole idea of Early Dial impractical for our
setup.

--
PGP key ID E85DC776 - finger abuse at mooli.org.uk for full key

```