利用sip将两台asterisk服务器进行相连

dantesite 2010-06-12

如有两台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=ulawallow=alaw

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

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

如下:

96机子:register => 888:kentop123456@192.168.2.9797机子:register => 666:kentop123456@192.168.2.96

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去接收呼叫就可以了.

相关推荐