Удалось настроить входящие и исходящие звонки. Но при входящем звонке на номер 8(ххх)ххх-хх-46, при выполнении контекста, по какой-то причине Asterisk выбирает endpoint от номера 8(ххх)ххх-хх-47 и занимает его. Из-за этого нет возможности правильно определить, какая линия свободна для исходящего вызова. endpoint номера 8(ххх)ххх-хх-46 определяется как свободный, хотя сама линия занята.
Если удалить второй trunk (8(ххх)ххх-хх-47), то выбирается нужный endpoint.
pjsip.conf
Код: Выделить всё
[udp-transport]
type=transport
protocol=udp
bind=XXX.XXX.XXX.XXX
local_net=XXX.XXX.XXX.0/24
local_net=XXX.XXX.XXX.0/24
local_net=127.0.0.1/32
;—TRUNK DESCRIPTION—;
;—TRUNK 1—;
[trunk1_reg]
type=registration
transport=udp-transport
outbound_auth=trunk1_auth
server_uri=sip:voip.domru.ru:5060
client_uri=sip:7XXXXXXXX46@voip.domru.ru:5060
contact_user=7XXXXXXXX46
[trunk1_auth]
type=auth
auth_type=userpass
password=password
username=7XXXXXXXX46
[trunk1_aor]
type=aor
contact=sip:7XXXXXXXX46@voip.domru.ru:5060
[trunk1_ep]
type=endpoint
transport=udp-transport
context=incoming
disallow=all
allow=alaw
callerid = "7XXXXXXXX46"<7XXXXXXXX46>
from_user = 7XXXXXXXX46
language = ru
outbound_auth=trunk1_auth
aors=trunk1_aor
[trunk1_id]
type=identify
endpoint=trunk1_ep
match=188.234.136.49
;—TRUNK 2—;
[trunk2_reg]
type=registration
transport=udp-transport
outbound_auth=trunk2_auth
server_uri=sip:voip.domru.ru:5060
client_uri=sip:7XXXXXXXX47@voip.domru.ru:5060
contact_user=7XXXXXXXX47
[trunk2_auth]
type=auth
auth_type=userpass
password=password
username=7XXXXXXXX47
[trunk2_aor]
type=aor
contact=sip:7XXXXXXXX47@voip.domru.ru:5060
[trunk2_ep]
type=endpoint
transport=udp-transport
context=incoming
disallow=all
allow=alaw
callerid = "7XXXXXXXX47"<7XXXXXXXX47>
from_user = 7XXXXXXXX47
language = ru
outbound_auth=trunk2_auth
aors=trunk2_aor
[trunk2_id]
type=identify
endpoint=trunk2_ep
match=188.234.136.49
Код: Выделить всё
[incoming]
exten => 7XXXXXXXX46,1,Answer()
exten => 7XXXXXXXX46,2,Background(basic-pbx-ivr-main)
exten => 7XXXXXXXX46,3,WaitExten(5)
exten => 7XXXXXXXX46,4,Answer
exten => 7XXXXXXXX46,5,Background(/var/lib/asterisk/sounds/ru/beep)
exten => 7XXXXXXXX46,6,Queue(ring107)
exten => 7XXXXXXXX46,7,Hangup()
exten => 7XXXXXXXX47,1,Answer()
exten => 7XXXXXXXX47,2,Background(basic-pbx-ivr-main)
exten => 7XXXXXXXX47,3,WaitExten(5)
exten => 7XXXXXXXX47,4,Answer
exten => 7XXXXXXXX47,5,Background(/var/lib/asterisk/sounds/ru/beep)
exten => 7XXXXXXXX47,6,Queue(ring111)
exten => 7XXXXXXXX47,7,Hangup()
include => selected
...
[outgoing]
exten => _8xxxxxxxxxx,1,GoTo(7${EXTEN:1},1)
exten =>_7XXXXXXXXXX,1,ChanIsAvail(PJSIP/${EXTEN}@trunk1_ep&PJSIP/${EXTEN}@trunk2_ep)
exten =>_7XXXXXXXXXX,2,NoOp(${AVAILCHAN})
exten =>_7XXXXXXXXXX,3,NoOp(${AVAILORIGCHAN})
exten =>_7XXXXXXXXXX,4,NoOp(${AVAILSTATUS})
exten =>_7XXXXXXXXXX,5,Dial(${AVAILORIGCHAN})
exten =>_7XXXXXXXXXX,6,Hangup()
Код: Выделить всё
Connected to Asterisk 18.4.0 currently running on asterisk (pid = 12235)
-- Executing [7XXXXXXXX46@incoming:1] Answer("trunk2_ep-0000000a", "") in new stack
> 0x7f3c00335d60 -- Strict RTP learning after remote address set to: 188.234.136.49:23586
-- Executing [7XXXXXXXX46@incoming:2] BackGround("PJSIP/trunk2_ep-0000000a", "basic-pbx-ivr-main") in new stack
-- <PJSIP/trunk2_ep-0000000a> Playing 'basic-pbx-ivr-main.alaw' (language 'ru')
> 0x7f3c00335d60 -- Strict RTP switching to RTP target address 188.234.136.49:23586 as source
> 0x7f3c00335d60 -- Strict RTP learning complete - Locking on source address 188.234.136.49:23586
Executing [7XXXXXXXX46@incoming:1] Answer("trunk2_ep-0000000a", "") in new stack
и
Executing [7XXXXXXXX46@incoming:2] BackGround("PJSIP/trunk2_ep-0000000a", "basic-pbx-ivr-main") in new stack
Прошу помощи в понимании причин этого феномена.