Asteriskとソフトフォンの間の通信をchan_sipからPJSIPに変更したのだが、
AsteriskとFusion IP-Phone SMART 2回線分の通信はchan_sipのままだった。
これもPJSIPにして問題ないはずなので、変更してみた。
まずは、sip.conf
に相当する内容をpjsip.conf
に移植する。
現在のsip.conf
の内容は以下のようになっている。
[general]
match_auth_username=yes ; 同じsmart.0038.netに複数のアカウントを持っているので。
; 外線着信のため
register => 5XXXXXXX:password1@fusion1/5XXXXXXX
register => 5YYYYYYY:password2@fusion2/5YYYYYYY
; 外線
[fusion1]
type=friend
username=5XXXXXXX
fromuser=5XXXXXXX
secret=password1
host=smart.0038.net
fromdomain=smart.0038.net
context=default
insecure=port,invite
canreinvite=no
dtmfmode=inband
qualify=yes
allow=!all,ilbc,g729,gsm,g723,ulaw,alaw
allowguest=no
host=dynamic
[fusion2]
type=friend
username=5YYYYYYY
fromuser=5YYYYYYY
secret=password2
host=smart.0038.net
fromdomain=smart.0038.net
context=default
insecure=port,invite
canreinvite=no
dtmfmode=inband
qualify=yes
allow=!all,ilbc,g729,gsm,g723,ulaw,alaw
allowguest=no
host=dynamic
これをpjsip.conf
に移植して行く。
まずは変更点を示す。
@@ -1,8 +1,16 @@
+[general]
+match_auth_username = yes
+
+[system]
+type = system
+disable_rport = yes
+
[transport-udp]
type = transport
protocol = udp
-bind = 0.0.0.0:5070 ; 5060 portはchan_sipと競合する。
+bind = 0.0.0.0
+; 外線: ひかり電話
[hikari-denwa]
type = registration
transport = transport-udp
@@ -19,7 +27,7 @@ password = 0003_password
[hikari-trunk]
type = aor
-contact = sip:10.81.0.1
+contact = sip:3@10.81.0.1
[hikari-trunk]
type = endpoint
@@ -38,3 +46,81 @@ dtmf_mode = inband
type = identify
endpoint = hikari-trunk
match = 10.81.0.1
+
+
+
+; 外線: Fusion SMART IP 1
+[fusion1]
+type = registration
+transport = transport-udp
+outbound_auth = fusion1
+server_uri = sip:smart.0038.net
+client_uri = sip:5XXXXXXX@smart.0038.net
+retry_interval = 0
+auth_rejection_permanent = no
+
+[fusion1]
+type = auth
+auth_type = userpass
+username = 5XXXXXXX
+password = password1
+
+[fusion1]
+type = aor
+contact = sip:5XXXXXXX@smart.0038.net
+qualify_frequency = 5
+
+[fusion1]
+type = endpoint
+transport = transport-udp
+context = default
+from_user = 5XXXXXXX
+from_domain = smart.0038.net
+outbound_auth = fusion1
+disallow = all
+allow = ilbc,g729,gsm,g723,ulaw,alaw
+aors = fusion1
+
+[fusion1]
+type = identify
+match = 61.213.230.153 ; IPアドレス
+endpoint = fusion1
+
+
+
+; 外線: Fusion SMART IP 2
+[fusion2]
+type = registration
+transport = transport-udp
+outbound_auth = fusion2
+server_uri = sip:smart.0038.net
+client_uri = sip:5YYYYYYY@smart.0038.net
+retry_interval = 0
+auth_rejection_permanent = no
+
+[fusion2]
+type = auth
+auth_type = userpass
+username = 5YYYYYYY
+password = password2
+
+[fusion2]
+type = aor
+contact = sip:5YYYYYYY@smart.0038.net
+qualify_frequency = 5
+
+[fusion2]
+type = endpoint
+transport = transport-udp
+context = default
+from_user = 5YYYYYYY
+from_domain = smart.0038.net
+outbound_auth = fusion2
+disallow = all
+allow = ilbc,g729,gsm,g723,ulaw,alaw
+aors = fusion2
+
+[fusion2]
+type = identify
+match = 61.213.230.153 ; IPアドレス
+endpoint = fusion2
全体としては、以下のようになる。
[general]
match_auth_username = yes
[system]
type = system
disable_rport = yes
[transport-udp]
type = transport
protocol = udp
bind = 0.0.0.0
; 外線: ひかり電話
[hikari-denwa]
type = registration
transport = transport-udp
outbound_auth = hikari-trunk
server_uri = sip:10.81.0.1
client_uri = sip:3@10.81.0.1
retry_interval = 60
[hikari-trunk]
type = auth
auth_type = userpass
username = 0003
password = 0003_password
[hikari-trunk]
type = aor
contact = sip:3@10.81.0.1
[hikari-trunk]
type = endpoint
transport = transport-udp
context = default
disallow = all
allow = ulaw
outbound_auth = hikari-trunk
aors = hikari-trunk
direct_media = no
from_user = 3
from_domain = 10.81.0.1
dtmf_mode = inband
[hikari-trunk]
type = identify
endpoint = hikari-trunk
match = 10.81.0.1
; 外線: Fusion SMART IP 1
[fusion1]
type = registration
transport = transport-udp
outbound_auth = fusion1
server_uri = sip:smart.0038.net
client_uri = sip:5XXXXXXX@smart.0038.net
retry_interval = 0
auth_rejection_permanent = no
[fusion1]
type = auth
auth_type = userpass
username = 5XXXXXXX
password = password1
[fusion1]
type = aor
contact = sip:5XXXXXXX@smart.0038.net
qualify_frequency = 5
[fusion1]
type = endpoint
transport = transport-udp
context = default
from_user = 5XXXXXXX
from_domain = smart.0038.net
outbound_auth = fusion1
disallow = all
allow = ilbc,g729,gsm,g723,ulaw,alaw
aors = fusion1
[fusion1]
type = identify
match = 61.213.230.153 ; IPアドレス
endpoint = fusion1
; 外線: Fusion SMART IP 2
[fusion2]
type = registration
transport = transport-udp
outbound_auth = fusion2
server_uri = sip:smart.0038.net
client_uri = sip:5YYYYYYY@smart.0038.net
retry_interval = 0
auth_rejection_permanent = no
[fusion2]
type = auth
auth_type = userpass
username = 5YYYYYYY
password = password2
[fusion2]
type = aor
contact = sip:5YYYYYYY@smart.0038.net
qualify_frequency = 5
[fusion2]
type = endpoint
transport = transport-udp
context = default
from_user = 5YYYYYYY
from_domain = smart.0038.net
outbound_auth = fusion2
disallow = all
allow = ilbc,g729,gsm,g723,ulaw,alaw
aors = fusion2
[fusion2]
type = identify
match = 61.213.230.153 ; IPアドレス
endpoint = fusion2
extensions.conf
では、以下の抜粋のように変更すれば良い。
ここではログも出力するようにしている。
; 発信
;; Fusion SMARTalk 1の場合には9で発信する。
-exten => _9.,1,Set(CALLERID(num)=${MYNUMBER})
+exten => _9.,1,NoOp(Fusion1で発信9)
+exten => _9.,n,Set(CALLERID(num)=${MYNUMBER})
exten => _9.,n,Set(CALLERID(name)=${MYNUMBER})
-exten => _9.,n,Dial(SIP/${EXTEN:1}@fusion1,120,T)
+exten => _9.,n,Dial(PJSIP/${EXTEN:1}@fusion1,120,T)
+exten => _9.,n,Hangup()
;; Fusion SMARTalk 2の場合には8で発信する。
-exten => _8.,1,Set(CALLERID(num)=${MYNUMBER})
+exten => _8.,1,NoOp(Fusion2で発信8)
+exten => _8.,n,Set(CALLERID(num)=${MYNUMBER})
exten => _8.,n,Set(CALLERID(name)=${MYNUMBER})
-exten => _8.,n,Dial(SIP/${EXTEN:1}@fusion2,120,T)
+exten => _8.,n,Dial(PJSIP/${EXTEN:1}@fusion2,120,T)
+exten => _9.,n,Hangup()
;; ひかり電話の場合には7で発信する。
-exten => _7.,1,Set(CALLERID(num)=${MYNUMBER})
+exten => _7.,1,NoOp(ひかり電話で発信7)
+exten => _7.,n,Set(CALLERID(num)=${MYNUMBER})
exten => _7.,n,Set(CALLERID(name)=${MYNUMBER})
exten => _7.,n,Dial(PJSIP/${EXTEN:1}@hikari-trunk)
+exten => _7.,n,Hangup()