使用PJSIP在两个Asterisk服务器之间构建通道/中继

时间:2016-05-24 19:48:21

标签: asterisk pjsip

新的星号版本(> 13)使用PJSIP模块而不是chan_sip。 到目前为止,我所缺少的是如何正确使用PJSIP lib和星号的实际例子。

我想做的是以下内容:

  • 我在不同的网站上有两个,三个或更多的星号服务器 都是通过IP连接
  • IP电话等终端设备连接到侧面的星号服务器,并使用PJSIP(Asterisk< ==> IP-Phone到目前为止工作)
  • 现在我想要将所有星号服务器相互连接,以便建立一个具有正确拨号方案的通信网络,其中每个终端设备都可以与其他站点上的另一部电话通信

是这样的:[终端设备< ==> Asterisk1< ========> Asterisk2< ==>终端设备]

到目前为止,我只找到了如何使用chan_sip或IAX2进行教程的教程,但没有使用PJSIP。还有一些教程可以将星号服务器绑定到外部提供程序,但这不是我想要做的。

请帮助我,至少有关于该主题的丰富教程或信息网站的链接!

谢谢

1 个答案:

答案 0 :(得分:0)

与之抗争两天后,这是一个有效的配置(至少在一个方向上(serverB上的电话是远程的,所以我不容易测试)。

我希望它可以帮助其他人避免我经历过的痛苦:-)

;
; ServerA - pjsip.conf
;

[siptrunk-auth]
type = auth
auth_type = userpass
username = <USER>
password = <ASTRONGPASSWORD>

[siptrunk-aor]
type = aor
contact = sip:serverB.domain.tld

[siptrunk]
type = endpoint
context = from-serverB
allow = !all,g722,ulaw
outbound_auth = siptrunk-auth
aors = siptrunk-aor
direct_media = no

[siptrunk-registration]
type = registration
outbound_auth = siptrunk-auth
server_uri = sip:serverB.domain.tld
client_uri = sip:<USER>@serverB.domain.tld
retry_interval = 60

[siptrunk-identify]
type = identify
match = serverB.domain.tld
endpoint = siptrunk

;
; ServerB - pjsip.conf
;
; <USER> is the same  <USER> as on Server A
;

[<USER>] ;
type = auth
auth_type = userpass
username = <USER>
password = <ASTRONGPASSWORD>

[<USER>]
type = aor
max_contacts = 1

[<USER>]
type = endpoint
context = from-ServerA
allow = !all,ulaw
direct_media = no
auth = <USER>
aors = <USER>

[<USER>]
type = identity
match = ServerA.domain.tld ; sometimes you might need to use the actual IP Address
endpoint = <USER>

;
; ServerA - extensions.conf
;

[to-serverB]
; route extensions starting with 6XXX to Server B
exten => _6XXX,1,Dial(PJSIP/${EXTEN}@siptrunk,,25)
  same => n,Hangup()

;
; ServerB - extensions.conf
;

[to-serverA]
; route extensions starting with 7XXX to Server A
exten => _7XXX,1,Dial(PJSIP/${EXTEN}@<USER>,,25)
  same => n,Hangup()
相关问题