本帖最後由 角色 於 2010-9-4 10:40 編輯
The following case shows the way to inter-connect two Asterisk servers such that users in different location can not only call internal extension numbers but also other person's extension numbers in other location directly.
Server 1:
Location: TW
Hostanme: tw.asterisk.org
Network segment: 192.168.1.0
Extension 2001: John
Extension 2002: Susan
Server 2:
Location: SZ
Hostname: sz.asterisk.org
Network segment: 192.168.2.0
Extension 3001: Peter
Extension 3002: Mary
Server 1: TW Settings:
sip.conf- [general]
- srvlookup=yes
- nat=yes
- realm=tw.asterisk.org
- externhost=tw.asterisk.org
- fromdomain=tw.asterisk.org
- localnet=192.168.1.0/255.255.255.0
- externrefresh = 1
- defaultexpirey=120
- bindport=5060
- qualify=yes
- disallow=all
- allow=alaw
- allow=ulaw
- allow=gsm
- context=front-desk
- [2001]
- type=friend
- username=2001
- secret=2001_password
- callerid="John" <2001>
- quality=yes
- nat=yes
- host=dynamic
- canreinvite=no
- disallow=all
- allow=alaw
- context=internal
- [2002]
- type=friend
- username=2002
- secret=2002_password
- callerid="Susan" <2002>
- quality=yes
- nat=yes
- host=dynamic
- canreinvite=no
- disallow=all
- allow=alaw
- context=internal
- ;from SZ users call 2xxxx
- [tw-gw]
- type=user
- username=tw-gw
- secret=tw-gw_password
- qualify=yes
- nat=yes
- host=dynamic
- canreinvite=no
- disallow=all
- allow=ulaw,alaw,gsm
- context=internal
- ;to SZ telephone 3xxx
- [sz-gw]
- type=peer
- username=sz-gw
- secret=sz-gw_password
- host=sz.asterisk.org
- insecure=port,invite
- context=internal
複製代碼 extensions.conf- [trunk_sz-gw]
- exten => _3XXX,1,Dial(SIP/${EXTEN}@sz-gw,,)
- exten => _3XXX,2,Hangup()
- [internal]
- include => trunk_sz-gw
- exten => 2001,1,Dial(SIP/2001,,r)
- exten => 2002,1,Dial(SIP/2002,,r)
複製代碼 Server 2: SZ Settings:
sip.conf- [general]
- bindport=5060
- srvlookup=yes
- realm=sz.asterisk.org
- externhost=sz.asterisk.org
- fromdomain=sz.asterisk.org
- localnet=192.168.2.0/255.255.255.0
- defaultexpirey=120
- externrefresh = 1
- disallow=all
- allow=alaw,ulaw,gsm,g729,iLBC,speex
- nat=yes
- canreinvite=no
- insecure=port,invite
- qualify=yes
- dtmfmode=rfc2833
- context=fron-desk
- [3001]
- type=friend
- username=3001
- callerid="John" <3001>
- secret=3001_password
- host=dynamic
- context=internal
- [3002]
- type=friend
- username=3002
- callerid="Mary" <3002>
- secret=3002_password
- host=dynamic
- context=internal
- ;from TW users call 3xxx
- [sz-gw]
- type=user
- username=sz-gw
- secret=sz-gw_password
- qualify=yes
- nat=yes
- host=dynamic
- canreinvite=no
- disallow=all
- allow=alaw,ulaw,gsm
- context=internal
- ;to TW telephone 2xxx
- [tw-gw]
- type=peer
- username=tw-gw
- secret=tw-gw_password
- host=tw.asterisk.org
- insecure=port,invite
- context=internal
複製代碼 extensions.conf- [trunk_tw-gw]
- exten => _2XXX,1,Dial(SIP/tw-gw/${EXTEN},,)
- exten => _2XXX,n,Hangup()
- [internal]
- include => trunk_tw-gw
- exten => 3001,1,Dial(SIP/3001,,r)
- exten => 3002,1,Dial(SIP/3002,,r)
複製代碼 |