<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=us-ascii" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Contexts.... Its all about Contexts.<br>
<br>
You can place the three groups of extensions/ dial plans in different
contexts. <br>
<br>
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)<br>
<br>
However, may orgs do the same thing- <br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
Eric C. wrote:
<blockquote cite="mid:BAY130-W77154300E2DCDC03B988EC26B0@phx.gbl"
 type="cite">
  <pre wrap="">Eric C. wrote:
  </pre>
  <blockquote type="cite">
    <pre wrap="">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 =&gt; _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 &amp; 2002, how does one separate them?
Or, lets say the extensions are:

company A --&gt; 2000, 2001,2002
company B --&gt; 3000, 3001, 3002
company C --&gt; 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
  
    </pre>
  </blockquote>
  <pre wrap=""><!---->
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 =&gt; 2082292222,1,Goto(s,1,incoming-acme)
exten =&gt; 2082293333,1,Goto(s,1,incoming-fido)
exten =&gt; 2082294444,1,Goto(s,1,incoming-big-jims)
...

[incoming-acme]
exten =&gt; s,1,Answer()                                                          
exten =&gt; s,n,Wait(0.75)
exten =&gt; s,n(greeting),Playback(brief-directory-acme)               
exten =&gt; s,n(exten),Background(vm-enter-num-to-call)                           
exten =&gt; s,n,WaitExten(5)                                                      
exten =&gt; s,n(goodbye),Playback(vm-goodbye)                                     
exten =&gt; 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 =&gt; extens-acme     
                                                                               
exten =&gt; i,1,Playback(pbx-invalid)                                             
exten =&gt; i,n,Goto(s,exten)                                                     
                                                                               
exten =&gt; t,1,Goto(s,goodbye)                  
                                                                               
[internal-acme]                                                                     
exten =&gt; s,1,Answer()             
exten =&gt; s,n(exten),Background(vm-enter-num-to-call)                           
exten =&gt; s,n,WaitExten(5)                                                      
exten =&gt; s,n(goodbye),Playback(vm-goodbye)                                     
exten =&gt; s,n(end),Hangup()                                                     
                                                                               
include =&gt; outbound-toll                                                       
include =&gt; outbound-local                                                      
include =&gt; extens-acme

; for our SIP phones, we can program a non-numeric extension                    
exten =&gt; voicemail,1,VoicemailMain(${CALLERIDNUM}@acme)
exten =&gt; voicemail,n,Hangup()

; and for DTMF coming through an ATA...
exten =&gt; 777,1,Goto(voicemail)

[extens-acme]
exten =&gt; 111,1,Macro(stdexten,111,${PHILIP})                                   
exten =&gt; 111,n,Goto(s,exten)
...

[outbound-local]                                                               
exten =&gt; _NXXXXXX,1,Dial(${TRUNK}/${AREA}${EXTEN},,r)                          
exten =&gt; _NXXXXXX,n,Congestion()                                               
exten =&gt; _NXXXXXX,n,Hangup()                                                   
                                                                               
[outbound-toll]
exten =&gt; _NXXXXXXXXX,1,Dial(${TRUNK}/${EXTEN},,r)                              
exten =&gt; _NXXXXXXXXX,n,Congestion()                                            
exten =&gt; _NXXXXXXXXX,n,Hangup()                                                
                                                                               
exten =&gt; _011.,1,Dial(${TRUNK}/${EXTEN:3},,r)                                  
exten =&gt; _011.,n,Congestion()                                                  
exten =&gt; _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 =&gt; s,1,Dial(${ARG2},20)                                   ; Ring the inter
exten =&gt; s,2,Goto(s-${DIALSTATUS},1)                            ; Jump based on
                                                                               
exten =&gt; s-NOANSWER,1,Voicemail(u${ARG1})               ; If unavailable, send t
exten =&gt; s-NOANSWER,2,MacroExit()                       ; If they press #, retur
                                                                               
exten =&gt; s-BUSY,1,Voicemail(b${ARG1})                   ; If busy, send to voice
exten =&gt; s-BUSY,2,MacroExit()           ; If they press #, return to start     
                                                                               
exten =&gt; _s-.,1,Goto(s-NOANSWER,1)                              ; Treat anything
                                                                               
exten =&gt; 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 =&gt; 111,1,Macro(stdexten,111,${PHILIP})                                   
exten =&gt; 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 <a class="moz-txt-link-freetext" href="http://www.api-digital.com">http://www.api-digital.com</a>--

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   <a class="moz-txt-link-freetext" href="http://lists.digium.com/mailman/listinfo/asterisk-users">http://lists.digium.com/mailman/listinfo/asterisk-users</a>

Car washes make the perfect holiday gift! Shop now at <a class="moz-txt-link-abbreviated" href="http://www.deltasoniccarwash.com">www.deltasoniccarwash.com</a>
  </pre>
</blockquote>
<br>
<br>
<pre class="moz-signature" cols="72">-- 
Matthew Mackes
Network Administrator
<a class="moz-txt-link-abbreviated" href="mailto:matthewmackes@deltasoniccarwash.com">matthewmackes@deltasoniccarwash.com</a>
Delta Sonic Car Wash Systems, Corporate Headquarters
Buffalo, New York
</pre>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
        <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8">
        <TITLE></TITLE>
        <META NAME="GENERATOR" CONTENT="OpenOffice.org 2.3  (Linux)">
        <META NAME="CREATED" CONTENT="20071130;11193400">
        <META NAME="CHANGED" CONTENT="20071130;11214500">
        <STYLE TYPE="text/css">
        <!--
                @page { size: 8.5in 11in; margin: 0.79in }
                P { margin-bottom: 0.08in }
        -->
        </STYLE>
</HEAD>
<BODY LANG="en-US" DIR="LTR">
<P STYLE="margin-bottom: 0in"><B>Car washes make the perfect holiday
gift! Shop now at </B><A HREF="http://www.deltasoniccarwash.com/" NAME="http://www.deltasoniccarwash.com/">www.deltasoniccarwash.com</A></P>
</BODY>
</HTML>
</body>
</html>