[asterisk-users] One server, multiple companies

Matthew Mackes matthewmackes at deltasoniccarwash.com
Mon Dec 10 15:22:18 CST 2007


Contexts.... Its all about Contexts.

You can place the three groups of extensions/ dial plans in different 
contexts.

The only dilemma you are going to encounter is that all three companies 
will need to share the same company directory, and the same parking lot 
(For ParK)

However, may orgs do the same thing-










Eric C. wrote:
> Eric C. wrote:
>   
>> Hello all, 
>>
>> Just starting to setup asterisk v 1.4.11 and need to run three distinct phone systems for three different companies.
>> So far, I have inbound lines going to the appropriate dial plan within the extensions.conf file. I'm using  
>>
>> exten => _X.,1,NoOp(FROM NUMBER:  ${SIP_HEADER(TO):5:10})
>>
>> to determine which number is being dialed by the caller and then using a gotoif to get to correct greeting (correct company).
>>
>> My question is... lets assume all three companies have extension numbers being 2000, 2001 & 2002, how does one separate them?
>> Or, lets say the extensions are:
>>
>> company A --> 2000, 2001,2002
>> company B --> 3000, 3001, 3002
>> company C --> 4000, 4001, 4002
>>
>> Since they're on one server with one asterisk process, how can I use context correctly so that the user at 4002 cannot get through to the user at company A whose extension is 2000 as currently, I can dial 2000 from phone 4002.
>>
>> That's my current problem, how should this be setup?  Is my architecture correct? Should I be running different processes for each company? Can context resolve what I need?
>>
>> Please advise.
>>
>> thanks,
>> Otto
>>   
>>     
>
> First off, *nuke* the default context in sip.conf, extensions.conf, and 
> voicemail.conf ... it will just get you into trouble!
>
> I do something like in my extensions.conf file:
>
> [incoming]
> exten => 2082292222,1,Goto(s,1,incoming-acme)
> exten => 2082293333,1,Goto(s,1,incoming-fido)
> exten => 2082294444,1,Goto(s,1,incoming-big-jims)
> ...
>
> [incoming-acme]
> exten => s,1,Answer()                                                          
> exten => s,n,Wait(0.75)
> exten => s,n(greeting),Playback(brief-directory-acme)               
> exten => s,n(exten),Background(vm-enter-num-to-call)                           
> exten => s,n,WaitExten(5)                                                      
> exten => s,n(goodbye),Playback(vm-goodbye)                                     
> exten => s,n(end),Hangup()                                                     
>
> ; these are the extensions that are exposed both to internal callers as
> ; well as to incoming calls... be careful what you put here.
> include => extens-acme     
>                                                                                
> exten => i,1,Playback(pbx-invalid)                                             
> exten => i,n,Goto(s,exten)                                                     
>                                                                                
> exten => t,1,Goto(s,goodbye)                  
>                                                                                
> [internal-acme]                                                                     
> exten => s,1,Answer()             
> exten => s,n(exten),Background(vm-enter-num-to-call)                           
> exten => s,n,WaitExten(5)                                                      
> exten => s,n(goodbye),Playback(vm-goodbye)                                     
> exten => s,n(end),Hangup()                                                     
>                                                                                
> include => outbound-toll                                                       
> include => outbound-local                                                      
> include => extens-acme
>
> ; for our SIP phones, we can program a non-numeric extension                    
> exten => voicemail,1,VoicemailMain(${CALLERIDNUM}@acme)
> exten => voicemail,n,Hangup()
>
> ; and for DTMF coming through an ATA...
> exten => 777,1,Goto(voicemail)
>
> [extens-acme]
> exten => 111,1,Macro(stdexten,111,${PHILIP})                                   
> exten => 111,n,Goto(s,exten)
> ...
>
> [outbound-local]                                                               
> exten => _NXXXXXX,1,Dial(${TRUNK}/${AREA}${EXTEN},,r)                          
> exten => _NXXXXXX,n,Congestion()                                               
> exten => _NXXXXXX,n,Hangup()                                                   
>                                                                                
> [outbound-toll]
> exten => _NXXXXXXXXX,1,Dial(${TRUNK}/${EXTEN},,r)                              
> exten => _NXXXXXXXXX,n,Congestion()                                            
> exten => _NXXXXXXXXX,n,Hangup()                                                
>                                                                                
> exten => _011.,1,Dial(${TRUNK}/${EXTEN:3},,r)                                  
> exten => _011.,n,Congestion()                                                  
> exten => _011.,n,Hangup()                                                      
>
>
>
> Note: we had to modify the stdexten macro to be:
>
> [macro-stdexten];                                                              
> ;                                                                              
> ; Standard extension macro:                                                    
> ;   ${ARG1} - Extension  (we could have used ${MACRO_EXTEN} here as well)      
> ;   ${ARG2} - Device(s) to ring                                                
> ;                                                                              
> exten => s,1,Dial(${ARG2},20)                                   ; Ring the inter
> exten => s,2,Goto(s-${DIALSTATUS},1)                            ; Jump based on
>                                                                                
> exten => s-NOANSWER,1,Voicemail(u${ARG1})               ; If unavailable, send t
> exten => s-NOANSWER,2,MacroExit()                       ; If they press #, retur
>                                                                                
> exten => s-BUSY,1,Voicemail(b${ARG1})                   ; If busy, send to voice
> exten => s-BUSY,2,MacroExit()           ; If they press #, return to start     
>                                                                                
> exten => _s-.,1,Goto(s-NOANSWER,1)                              ; Treat anything
>                                                                                
> exten => a,1,VoicemailMain(${ARG1})
>
>
>
> that is, we got rid of all instances of "Goto(s,1,default)".  The result 
> is that if the caller bails out of voicemail or completes his message, 
> the macro returns to the next priority.  Hence having:
>
> exten => 111,1,Macro(stdexten,111,${PHILIP})                                   
> exten => 111,n,Goto(s,exten)
>
>
> you could also "Hangup()" as the 2nd priority...  You would need to have 
> "exten" defined as a label for both the "incoming-acme" as well as 
> "internal-acme" contexts (and they will probably do different things).
>
> There are undoubtedly better ways to do this, but we find it's simple 
> and maintainable and works well enough for us.
>
> -Philip
>
>
>
>
> /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
>
> Thanks for the excellent model on how to set things up. That being said, if Company A and 
> company B both want their extension to go from 2000 .. 200X,  how best be that set up?
>
>
>
>
>
>
> _______________________________________________
> --Bandwidth and Colocation Provided by http://www.api-digital.com--
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-users
>
> Car washes make the perfect holiday gift! Shop now at www.deltasoniccarwash.com
>   


-- 
Matthew Mackes
Network Administrator
matthewmackes at deltasoniccarwash.com
Delta Sonic Car Wash Systems, Corporate Headquarters
Buffalo, New York


Car washes make the perfect holiday gift! Shop now at www.deltasoniccarwash.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20071210/ab1eab00/attachment.htm 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: matthewmackes.vcf
Type: text/x-vcard
Size: 297 bytes
Desc: not available
Url : http://lists.digium.com/pipermail/asterisk-users/attachments/20071210/ab1eab00/attachment.vcf 


More information about the asterisk-users mailing list