Конфиг сервера 1:
PRIME_BBCODE_SPOILER_SHOW PRIME_BBCODE_SPOILER: sip.conf
[general]
nat=force_rport,comedia
directmedia=no
register => serverA:пароль@0.0.0.74/serverB
register => serverX:пароль@0.0.0.74/serverY
[clients](!)
type=friend
secret=abc
host=dynamic
qualify=yes
[1000](clients)
context=phones
[1001](clients)
context=phone-Y
[servers](!)
type=friend
host=dynamic
insecure=invite
secret=пароль
[serverB](servers)
context=remote-in
[serverY](servers)
context=remote-in-Y
nat=force_rport,comedia
directmedia=no
register => serverA:пароль@0.0.0.74/serverB
register => serverX:пароль@0.0.0.74/serverY
[clients](!)
type=friend
secret=abc
host=dynamic
qualify=yes
[1000](clients)
context=phones
[1001](clients)
context=phone-Y
[servers](!)
type=friend
host=dynamic
insecure=invite
secret=пароль
[serverB](servers)
context=remote-in
[serverY](servers)
context=remote-in-Y
PRIME_BBCODE_SPOILER_SHOW PRIME_BBCODE_SPOILER: extensions.conf
[globals]
[general]
[internal]
exten => _1XXX,1,Dial(SIP/${EXTEN},30}
exten => _1XXX,n,Hangup()
[remote-out]
exten => _2XXX,1,Dial(SIP/serverB/${DB(phones/${EXTEN})},30)
exten => _2XXX,n,Hangup()
exten => _XXXX.,1,Dial(SIP/serverB/${EXTEN},30)
exten => _XXXX.,n,Hangup()
[remote-out-Y]
exten => _2XXX,1,Dial(SIP/serverY/${DB(phones/${EXTEN})},30)
exten => _2XXX,n,Hangup()
exten => _XXXX.,1,Dial(SIP/serverY/${EXTEN},30)
exten => _XXXX.,n,Hangup()
[remote-in]
exten => _!,1,Set(CALLERID(all)=${DB(phonebook/${CALLERID(num):1})} <000> )
exten => _!,n,Dial(SIP/1000,30)
exten => _!,n,Hangup()
[remote-in-Y]
exten => _!,1,Set(CALLERID(all)=${DB(phonebook/${CALLERID(num):1})} <000> )
exten => _!,n,Dial(SIP/1001,30)
exten => _!,n,Hangup()
[phones]
include => internal
include => remote-out
[phone-Y]
include => internal
include => remote-out-Y
[general]
[internal]
exten => _1XXX,1,Dial(SIP/${EXTEN},30}
exten => _1XXX,n,Hangup()
[remote-out]
exten => _2XXX,1,Dial(SIP/serverB/${DB(phones/${EXTEN})},30)
exten => _2XXX,n,Hangup()
exten => _XXXX.,1,Dial(SIP/serverB/${EXTEN},30)
exten => _XXXX.,n,Hangup()
[remote-out-Y]
exten => _2XXX,1,Dial(SIP/serverY/${DB(phones/${EXTEN})},30)
exten => _2XXX,n,Hangup()
exten => _XXXX.,1,Dial(SIP/serverY/${EXTEN},30)
exten => _XXXX.,n,Hangup()
[remote-in]
exten => _!,1,Set(CALLERID(all)=${DB(phonebook/${CALLERID(num):1})} <000> )
exten => _!,n,Dial(SIP/1000,30)
exten => _!,n,Hangup()
[remote-in-Y]
exten => _!,1,Set(CALLERID(all)=${DB(phonebook/${CALLERID(num):1})} <000> )
exten => _!,n,Dial(SIP/1001,30)
exten => _!,n,Hangup()
[phones]
include => internal
include => remote-out
[phone-Y]
include => internal
include => remote-out-Y
PRIME_BBCODE_SPOILER_SHOW PRIME_BBCODE_SPOILER: sip.conf
[general]
nat=force_rport,comedia
directmedia=no
register => 851591:пароль2@sip.zadarma.com/851591
register => serverB:пароль@185.189.13.31/serverA
register => serverY:пароль@185.189.13.31/serverX
register => 908776:пароль3@sip.zadarma.com/908776
[servers](!)
type=friend
host=dynamic
secret=Gbplf111
insecure=invite
[serverA](servers)
context=out
[serverX](servers)
context=out-Y
[zadarma](!)
type=friend
insecure=invite
host=sip.zadarma.com
fromdomain=sip.zadarma.com
qualify=no
[851591](zadarma)
username=851591
secret=пароль2
fromuser=851591
context=in
[908776](zadarma)
username=908776
secret=пароль3
fromuser=908776
context=in-Y
nat=force_rport,comedia
directmedia=no
register => 851591:пароль2@sip.zadarma.com/851591
register => serverB:пароль@185.189.13.31/serverA
register => serverY:пароль@185.189.13.31/serverX
register => 908776:пароль3@sip.zadarma.com/908776
[servers](!)
type=friend
host=dynamic
secret=Gbplf111
insecure=invite
[serverA](servers)
context=out
[serverX](servers)
context=out-Y
[zadarma](!)
type=friend
insecure=invite
host=sip.zadarma.com
fromdomain=sip.zadarma.com
qualify=no
[851591](zadarma)
username=851591
secret=пароль2
fromuser=851591
context=in
[908776](zadarma)
username=908776
secret=пароль3
fromuser=908776
context=in-Y
PRIME_BBCODE_SPOILER_SHOW PRIME_BBCODE_SPOILER: extensions.conf
[globals]
[general]
[in]
exten => _!,1,Dial(SIP/serverA/1000,30,tT)
exten => _!,n,Hangup()
[in-Y]
exten => _!,1,Dial(SIP/serverX/1001,30,tT)
exten => _!,n,Hangup()
[out]
exten => _X.,1,Dial(SIP/851591/${EXTEN},30)
exten => _X.,n,Hangup()
[out-Y]
exten => _X.,1,Dial(SIP/908776/${EXTEN},30)
exten => _X.,n,Hangup()
[general]
[in]
exten => _!,1,Dial(SIP/serverA/1000,30,tT)
exten => _!,n,Hangup()
[in-Y]
exten => _!,1,Dial(SIP/serverX/1001,30,tT)
exten => _!,n,Hangup()
[out]
exten => _X.,1,Dial(SIP/851591/${EXTEN},30)
exten => _X.,n,Hangup()
[out-Y]
exten => _X.,1,Dial(SIP/908776/${EXTEN},30)
exten => _X.,n,Hangup()
Задача: Абонент 1000 должен звонить через связку serverA-serverB и далее через аккаунт 851591 - с виртуального номера, привязанного к данному аккаунту. Абонент 1001 - всё то же самое, только через связку serverX-serverY и, соответственно через номер, привязанный к аккаунту 908776. Входящие звонки на виртуальные номера должны обрабатываться аналогично, через разные каналы.
Иными словами связь должна идти по цепочкам: 1000-serverA-serverB-851591-телефон1 и 1001-serverX-serverY-908776-телефон2.
Проблема: Сейчас звонок в любом случае приходит на номер 1001 (если из города), на какой бы номер не звонили, а если звонить с любого из SIP-клиентов, то "выходит" он с всегда SIP-аккаунта 851591.
После согласования стоимости решения данной проблемы, готов выслать реальные реквизиты доступа на сервера и к SIP-провайдеру.