[asterisk-users] Context
Rich Adamson
radamson at routers.com
Mon Sep 11 01:16:16 MST 2006
> I have two contexts how could I isolate context A from context B ,in
> other words I want to ban context A from calling context B
In sip.conf, define phones/extensions something like this:
[1000]
type=friend
<other parameters as needed>
context=cust-a
[1001]
type=friend
<other parameters as needed>
context=cust-a
[2000]
type=friend
<other parameters as needed>
context=cust-b
[2001]
type=friend
<other parameters as needed>
context=cust-b
In extensions.conf, define dialplans something like this:
[cust-a]
include=>local-extn-cust-a
include=>local-calls-a
include=>misc-extns
include=>no-match
[cust-b]
include=>local-extn-cust-b
include=>local-calls-b
include=>misc-extns
include=>no-match
[local-extn-cust-a]
exten => 1000,1,Dial(SIP/1000,15,r)
exten => 1000,2,Voicemail(1000|ug(6))
exten => 1000,102,Voicemail(1000|bg(6))
exten => 1000,103,Hangup
exten => 1001,1,Dial(SIP/1001,15,r)
exten => 1001,2,Voicemail(1001|ug(6))
exten => 1001,102,Voicemail(1001|bg(6))
exten => 1001,103,Hangup
[local-extn-cust-b]
exten => 2000,1,Dial(SIP/2000,15,r)
exten => 2000,2,Voicemail(2000|ug(6))
exten => 2000,102,Voicemail(2000|bg(6))
exten => 2000,103,Hangup
exten => 2001,1,Dial(SIP/2001,15,r)
exten => 2001,2,Voicemail(2001|ug(6))
exten => 2001,102,Voicemail(2001|bg(6))
exten => 2001,103,Hangup
[local-calls-a] ; outgoing pstn calls for cust-a
exten => _21XXXXX,1,Dial(Zap/g1/${EXTEN})
exten => _30XXXXX,1,Dial(Zap/g1/${EXTEN})
< etc >
[local-calls-b] ; outgoing pstn calls for cust-b
exten => _21XXXXX,1,Dial(Zap/g2/${EXTEN})
exten => _30XXXXX,1,Dial(Zap/g2/${EXTEN})
< etc >
[misc-extns]
exten => 3912,1,Wait(1)
exten => 3912,2,SayDigits(${CALLERID(num)})
exten => 3912,3,Hangup
[no-match]
exten => _X.,1,Answer
exten => _X.,2,GotoIF($[${EXTEN} != h]?10)
exten => _X.,10,Playback(invalid,skip)
exten => _X.,11,Hangup
In zapata.conf (assuming you have some zap pstn interfaces for each
customer), use something like this:
context=cust-a
<other needed parameters>
group=1
channel => 1,2
context=cust-b
<other needed parameters>
group=2
channel => 3,4
The above is a very simple example. Those extensions belonging to cust-a
cannot call those extension belonging to cust-b, and outgoing pstn calls
from each customer uses zap interfaces belonging to each customer.
If you're using Asterisk at Home, Trixbox, or some other pre-canned
implementation of asterisk, then pose your questions on their respective
support lists.
More information about the asterisk-users
mailing list