[Asterisk-Users] Complicated Dialing plan routing

Jan Saell jan at irial.com
Tue Dec 6 16:39:39 MST 2005


This is similarly to what you need to do when you have a real international 
dialing system.

What you should do is, regardless of what the customer does dial, you 
should expand this number to a full 10 digits dial string (in the US) or 
the ITU standard in non us countries with 00+country.. and 0+area_code, and 
the use that as the phonenumber to dial. Put the different areas customer's 
in one context for each prefix and use a macro to expand it.

Then put all outgoing calls in another context and there you can use 
whildcards or full number for dialing numbers.

Best regards
jan

; ----------------------------------------------------------------------
[macro-fixnum]
exten => s,1,SetVar(DNUM=${arg1})
exten => s,2,GotoIf($["${DNUM:0:2}" = "00"]?8)
exten => s,3,GotoIf($["${DNUM:0:1}" = "0"]?4:6)
exten => s,4,SetVar(DNUM=${arg2}${DNUM:1})
exten => s,5,Goto(9)
exten => s,6,SetVar(DNUM=${arg2}${arg3}${DNUM})
exten => s,7,Goto(9)
exten => s,8,SetVar(DNUM=${DNUM:2})
exten => s,9,noop(klar)

; ----------------------------------------------------------------------
; 08 Extensions
[incomming_08]
exten => _X.,1,macro(fixnum,${EXTEN},"46","08")
exten => _X.,2,Goto(outgoing_call,${DNUM},1)

; ----------------------------------------------------------------------
; 018 Extensions
[incomming_018]
exten => _X.,1,macro(fixnum,${EXTEN},"46","018")
exten => _X.,2,Goto(outgoing_call,${DNUM},1)

[outgoing_call]
exten => 46890510,1,Dial(....

Best regards
jan

--On 06 December 2005 17:40 +0100 Kristian Larsson <kristian at netatonce.se> 
wrote:

> Hey everyone,
>
> I'm having a slight problem with my dialplan which
> I was hoping you could help me with.
>
> First let me explain the scenario;
> I have a few hundred different customers split
> into a few different area codes. What I want to
> allow them to do is to call each other normally,
> ie with area code and if the called party is
> within their own area code they should be able to
> call them without first typing in the area code.
> If the number dialed does not exist in my dialing
> plan it should go out through a PRI extension to
> the PSTN.
>
> Ie.
> 0470-112233 should be able to call 0470-445566 by
> calling either "0470445566" or "445566" and if the
> extension 0470445566 doesn't exist it should try
> the PRI.
>
> I have tried using the Goto command to jump
> between different contexts for the different area
> code, but if I use Goto(0470,445566,1) and 445566
> doesn't exist it doesn't go out the PRI which it
> should.
>
> I've also experimented with using include and
> different contexts which doesn't seem to work
> either.
>
> So far the only way I've made it work is to
> have two extensions one for 0470445566 and one for
> 445566 and a lot of different contexts... I would
> like to avoid this and just have the extension in
> one place and instead use some smart dialing plan
> to compensate for area codes and the alike.
>
> I presume someone else is already doing what I
> want to do and perhaps could share their
> knowledge. Let me also mentioned I've searched the
> list archive but came up empty handed.
>
> Please CC me as I'm not currently on the list and
> thank you.
>
> Regards,
> Kristian Larsson
> _______________________________________________
> --Bandwidth and Colocation provided by Easynews.com --
>
> Asterisk-Users mailing list
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-users



-- 
+-------------------------------------------------------------------
! Irial / YASK AB
! Att: Jan Saell
! Box 59, S-692 21 KUMLA, SWEDEN
! Tel: 019-58 25 15     Int +46-19 58 25 15     Fax +46-19 58 38 05
! E-mail: jan at irial.com
! PGP Fingerprint: E957 23C8 9F51 0958 B9AD  7F18 404A 5DA1 F944 A08B
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.digium.com/pipermail/asterisk-users/attachments/20051206/47d0f8f2/attachment.pgp


More information about the asterisk-users mailing list