[Asterisk-Users] limit the length of extensions

Deon Rodden drodden at webunited.net
Tue Aug 31 11:39:29 MST 2004


All of my phones use sip, their accounts are in the sip.conf file and 
they have the context of 'company' or whatever. These phones need to be 
able to call each others extension, as well as dial outside to the real 
world. So in that context I put the outbound rules so that the phones 
can call out to the pstn, and I put the extensions of all the other 
phones in that context so that the phones can call each other.

Different companies wanted it different. ie some wanted just local, or 
local and national, or local national and international. Some wanted to 
dial 9 to get an outside line, others wanted to be able to dial without 
the 9. So with the variance, I chose to put customized "outbound" 
extensions per context.

Chris Shaw wrote:

>Why are you including your outbound context into your incoming context in
>the first place? That doesn't make any sense?
>
>I'm guessing that because you're using a number in your exten => you're
>using an IP channel like SIP or H323? Is this correct? If you're using a
>T1/PRI or POTS lines you need to use 's'.
>
>Using your example, your dialplan should look something like this...
>
>[incoming]
>
>exten => 9543340726,1,GotoIf($[${CALLERIDNAME} = anonymous]?2:4)
>exten => 9543340726,2,setcidname(Blocked)
>exten => 9543340726,3,setcidnum(0000000000)
>exten => 9543340726,4,Goto(companyname,beginmenu,1)
>
>[companyname]
>
>exten => beginmenu,1,SetVar(CALLEDNAME=CompanyName)
>exten => beginmenu,2,Wait,1
>exten => beginmenu,3,Answer() ; Answer the channel!
>exten => beginmenu,4,Background(company-main)
>exten => beginmenu,5,Background(ifyouknow)
>exten => beginmenu,6,Goto(company_mainmenu,s,1)
>exten => 502,1,Dial(SIP/whoever1&SIP/whoever2&sip/whoever3,30,m)
>exten => 507,1,Dial(SIP/dave&SIP/jim&SIP/lisa,30,m)
>...
>
>[company_mainmenu]
>
>exten => s,1,Background(company-nav1)
>exten => 1,1,Goto(company_sales,s,1) ; Sales
>exten => 2,1,Goto(companyname,502,1) ; Accounting
>exten => 3,1,Goto(companyname,508,1) ; Customer Care
>exten => 4,1,Goto(companyname,507,1) ; Technical Support
>exten => 5,1,Goto(companyname,202,1) ; Human Resources
>exten => 6,1,Goto(companyname,202,1) ; Provisioning
>exten => 7,1,Goto(companyname,214,1) ; Marketing
>exten => 0,1,Goto(companyname,210,1) ; Operator
>...
>
>Instead of jumping back and forth like this, I'd use macros to try and
>condense the dialplan a bit...
>I can help you more with this if you'd like...
>
>Then for people inside the company there's this...
>
>[outbound-local]
>exten => _9NXXNXXXXXX,1,Dial(SIP/${EXTEN:1}@sipprovider-out-context,60,T)
>exten => _9NXXXXXX,1,Dial(SIP/${EXTEN:1}@sipprovider-out-context,60,t) ; for
>7-digit dialing
>exten => _91800NXXXXXX,1,Dial(SIP/${EXTEN:1}@sipprovider-out-context,60,T)
>exten => _91888NXXXXXX,1,Dial(SIP/${EXTEN:1}@sipprovider-out-context,60,T)
>exten => _91877NXXXXXX,1,Dial(SIP/${EXTEN:1}@sipprovider-out-context,60,T)
>exten => _91866NXXXXXX,1,Dial(SIP/${EXTEN:1}@sipprovider-out-context,60,T)
>
>[outbound-ld]
>exten => _91NXXNXXXXXX,1,Dial(SIP/${EXTEN:1}@sipprovider-out-context,60,T)
>
>[outbound-international]
>exten => _9011.,Dial(SIP${EXTEN:1}@sipprovider-out-context,60,T)
>
>[office]
>include = outbound-local
>include = outbound-ld
>include = outbound-international
>
>exten => _[1-5]XX,1,Dial(SIP/${EXTEN},25,tT) ; This is assuming they're all
>SIP, you can use $DIALSTATUS to continue checking ZAP,MGCP,ETC...
>
>and so on...
>
>-Chris
>
>_______________________________________________
>Asterisk-Users mailing list
>Asterisk-Users at lists.digium.com
>http://lists.digium.com/mailman/listinfo/asterisk-users
>To UNSUBSCRIBE or update options visit:
>   http://lists.digium.com/mailman/listinfo/asterisk-users
>
>.
>
>  
>



More information about the asterisk-users mailing list