天天看點

利用sip将兩台asterisk伺服器進行相連

如有兩台asterisk 伺服器,ip位址為:192.168.2.96及192.168.2.97.

先分别在兩台伺服器的sip.conf配置檔案中建立用于兩台asterisk 進行通訊的sip賬号,及siptrunk賬号.

如下:

1.在96機子建立666帳号,如下:

[666]

type=friend

secret=kentop123456

host=dynamic

username=666

context=MGConfig

disallow=all

incominglimit=360

outgoinglimit=1

allow=gsm

allow=alaw

allow=ulaw

再在96下建立用于通訊的97trunk,如下:

[97TRUNK]

type=friend

username=888

secret=kentop123456

host=192.168.2.97

dtmfmode=rfc2833

context=MGConfig

fromuser=888

insecure=very

disallow=all

allow=gsm

allow=alaw

allow=ulaw

2 同樣,我們在97下也建立888的sip帳戶

[888]

type=friend

secret=kentop123456

host=dynamic

username=888

context=MGConfig

disallow=all

allow=gsm

allow=ulaw

allow=alaw

建立96trunk

[96TRUNK]

type=friend

username=666

secret=kentop123456

host=192.168.2.96

fromuser=666

dtmfmode=rfc2833

context=MGConfig

insecure=very

disallow=all

allow=gsm

allow=ulaw

allow=alaw

3.在96的sip.conf中注冊97的888

   在 97的sip.conf中注冊96的666

如下:

96機子:register => 888:[email protected]

97機子:register => 666:[email protected]

4.在兩台機子extension.conf中寫入同樣的撥号方案

exten=>_96.,1,dial(SIP/97${EXTEN:2}@97TRUNK,40,r)

exten=>_97.,1,Dial(SIP/${EXTEN:2},40,r)

這樣reload之後,隻要在任意一台機子,呼96XXXX然後在另一台的機子的exten=>_97.,就會收到從呼收方發來的呼叫,這樣,隻要在這個exten去接收呼叫就可以了.