Пожалуйста, войдите здесь. Часто задаваемые вопросы О нас
Задайте Ваш вопрос

проблема с контекстами

0

Доброго времени суток! Имеется asterisk 13.1.0 на ubuntu. Есть три номера от одного и того же провайдера, которые по ТЗ нужно разнести в два контекста, вот листинги конфигурации:

sip.conf:

[general]
register => 442221111:password@195.128.182.62/442221111
register => 442222222:password@195.128.182.62/442222222
register => 442223333:password@195.128.182.62/442233333
allowguest=no
canreinvite = no
localnet=192.168.0.201/255.255.255.0
externaddr=111.222.333.444

[442221111]
qualify=yes
host=195.128.182.62
defaultuser=442221111
secret=password
fromuser=442221111
fromdomain=195.128.182.62
type=peer
disallow=all
allow=alaw
allow=ulaw
allow=g729
nat=force_rport,comedia
directmedia=nonat
insecure=port,invite
context=cont-442221111

[442222222]
qualify=yes
host=195.128.182.62
defaultuser=442222222
secret=password
fromuser=442222222
fromdomain=195.128.182.62
type=peer
disallow=all
allow=alaw
allow=ulaw
allow=g729
nat=force_rport,comedia
directmedia=nonat
insecure=port,invite
context=cont-442222222

[442233333]
qualify=yes
host=195.128.182.62
defaultuser=442233333
secret=password
fromuser=442233333
fromdomain=195.128.182.62
type=peer
disallow=all
allow=alaw
allow=ulaw
allow=g729
nat=force_rport,comedia
;directmedia=nonat
insecure=port,invite
context=cont-442222222


[900901]
callgroup=1
pickupgroup=1
host=dynamic
qualify=yes
defaultuser=900901
secret=password
fromuser=900901
type=friend
disallow=all
allow=alaw
allow=ulaw
allow=g729
nat=force_rport,comedia
directmedia=no
insecure=port,invite
dtmfmode=auto
context=cont-442222222

[900902]
callgroup=1
pickupgroup=1
host=dynamic
qualify=yes
defaultuser=900902
secret=password
fromuser=900902
type=friend
disallow=all
allow=alaw
allow=ulaw
allow=g729
nat=force_rport,comedia
directmedia=no
insecure=port,invite
dtmfmode=auto
context=cont-442222222

[900903]
callgroup=2
pickupgroup=2
host=dynamic
qualify=yes
defaultuser=900903
secret=password
fromuser=900903
type=friend
disallow=all
allow=alaw
allow=ulaw
allow=g729
nat=force_rport,comedia
directmedia=no
insecure=port,invite
dtmfmode=auto
context=cont-442221111

[900904]
callgroup=2
pickupgroup=2
host=dynamic
qualify=yes
defaultuser=900904
secret=password
fromuser=900904
type=friend
disallow=all
allow=alaw
allow=ulaw
allow=g729
nat=force_rport,comedia
directmedia=no
insecure=port,invite
dtmfmode=auto
context=cont-442221111

extension.conf:

[cont-442221111]

exten => 442233333,1,NoOp()
same  => n,Dial(Sip/900901)
same  => n,HangUp()

exten => 442222222,1,NoOp()
same  => n,Dial(Sip/900902)
same  => n,HangUp()

[cont-442221111]
exten => 442222222,1,NoOp()
same  => n,Dial(Sip/900903,20,tT)
same  => n,Dial(Sip/900904,20,tT)
same  => n,HangUp()

И вот в чем проблема при звонке на 442221111 всё хорошо и маршрутизация нормально работает, а вот при звонке на 442222222 и 44223333 астериск начинает искать эти экстеншены не в том контексте - конкретно в cont-442221111

Вот дебаг нормально проходящего звонка:

<--- SIP read from UDP:195.128.182.62:5060 --->
INVITE sip:442221111@111.222.333.444:5060 SIP/2.0
Call-ID: 136c4c08242f7db7fa59b28e8097c9
Via: SIP/2.0/UDP 195.128.182.62:5060;branch=z9hG4bK99d4d0971d8ed1ee
From: "0442333333" <sip:0442333333@195.128.182.62>;tag=1a722258
To: "442221111" <sip:442221111@195.128.182.62>
CSeq: 18507 INVITE
Max-Forwards: 70
User-Agent: Smile CTI Server
X-Redirecting-Number: 442221111
Contact: <sip:0442333333@195.128.182.62>
Allow: INVITE, ACK, OPTIONS, CANCEL, BYE, UPDATE, REFER, NOTIFY, INFO, SUBSCRIBE, MESSAGE
Content-Type: application/sdp
Content-Length: 330

v=0
o=0442333333 1528582898 1 IN IP4 195.128.182.62
s=SIP Call
c=IN IP4 195.128.182.62
t=0 0
m=audio 64118 RTP/AVP 8 0 18 4 110 101
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:18 G729/8000
a=rtpmap:4 G723/8000
a=rtpmap:110 opus/48000/2
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=ptime:20
a=sendrecv
<------------->
--- (13 headers 15 lines) ---
Sending to 195.128.182.62:5060 (no NAT)
Sending to 195.128.182.62:5060 (no NAT)
Using INVITE request as basis request - 136c4c08242f7db7fa59b28e8097c9
Found peer '442221111' for '0442333333' from 195.128.182.62:5060
  == Using SIP RTP CoS mark 5
Found RTP audio format 8
Found RTP audio format 0
Found RTP audio format 18
Found RTP audio format 4
Found RTP audio format 110
Found RTP audio format 101
Found audio description format PCMA for ID 8
Found audio description format PCMU for ID 0
Found audio description format G729 for ID 18
Found audio description format G723 for ID 4
Found audio description format opus for ID 110
Found audio description format telephone-event for ID 101
Capabilities: us - (alaw|ulaw|g729), peer - audio=(ulaw|g723|alaw|g729|opus)/video=(nothing)/text=(nothing), combined - (alaw|ulaw|g729)
Non-codec capabilities (dtmf): us - 0x1 (telephone-event|), peer - 0x1 (telephone-event|), combined - 0x1 (telephone-event|)
Peer audio RTP is at port 195.128.182.62:64118
Looking for 442221111 in cont-442221111 (domain 111.222.333.444)
sip_route_dump: route/path hop: <sip:0442333333@195.128.182.62>

<--- Transmitting (NAT) to 195.128.182.62:5060 --->
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 195.128.182.62:5060;branch=z9hG4bK99d4d0971d8ed1ee;received=195.128.182.62;rport=5060
From: "0442333333" <sip:0442333333@195.128.182.62>;tag=1a722258
To: "442221111" <sip:442221111@195.128.182.62>
Call-ID: 136c4c08242f7db7fa59b28e8097c9
CSeq: 18507 INVITE
Server: Asterisk PBX 13.1.0~dfsg-1.1ubuntu4.1
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Contact: <sip:442221111@111.222.333.444:5060>
Content-Length: 0


<------------>
    -- Executing [442221111@cont-442221111:1] NoOp("SIP/WT-3617309-00000002", "") in new stack
    -- Executing [442221111@cont-442221111:2] Dial("SIP/WT-3617309-00000002", "Sip/900903,20,tT") in new stack
  == Using SIP RTP CoS mark 5
    -- Called Sip/90093
    -- SIP/900903-00000003 is ringing

<--- Transmitting (NAT) to 195.128.182.62:5060 --->
SIP/2.0 180 Ringing
Via: SIP/2.0/UDP 195.128.182.62:5060;branch=z9hG4bK99d4d0971d8ed1ee;received=195.128.182.62;rport=5060
From: "0442333333" <sip:0442333333@195.128.182.62>;tag=1a722258
To: "442221111" <sip:442221111@195.128.182.62>;tag=as373c0b5c
Call-ID: 136c4c08242f7db7fa59b28e8097c9
CSeq: 18507 INVITE
Server: Asterisk PBX 13.1.0~dfsg-1.1ubuntu4.1
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Contact: <sip:442221111@213.108.78.144:5060>
Content-Length: 0

А вот проблемный:

<--- SIP read from UDP:195.128.182.62:5060 --->
INVITE sip:442222222@111.222.333.444:5060 SIP/2.0
Call-ID: 136c5e364397ffbbbee39b0711b983
Via: SIP/2.0/UDP 195.128.182.62:5060;branch=z9hG4bK8b44b6e4a6577a01
From: "0442333333" <sip:0442333333@195.128.182.62>;tag=52051a1c
To: "442222222" <sip:442222222@195.128.182.62>
CSeq: 14129 INVITE
Max-Forwards: 70
User-Agent: Smile CTI Server
X-Redirecting-Number: 442222222
Contact: <sip:0442333333@195.128.182.62>
Allow: INVITE, ACK, OPTIONS, CANCEL, BYE, UPDATE, REFER, NOTIFY, INFO, SUBSCRIBE, MESSAGE
Content-Type: application/sdp
Content-Length: 330

v=0
o=0442333333 1528582976 1 IN IP4 195.128.182.62
s=SIP Call
c=IN IP4 195.128.182.62
t=0 0
m=audio 64212 RTP/AVP 8 0 18 4 110 101
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:18 G729/8000
a=rtpmap:4 G723/8000
a=rtpmap:110 opus/48000/2
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=ptime:20
a=sendrecv
<------------->
--- (13 headers 15 lines) ---
Sending to 195.128.182.62:5060 (no NAT)
Sending to 195.128.182.62:5060 (no NAT)
Using INVITE request as basis request - 136c5e364397ffbbbee39b0711b983
**Found peer '442221111' for '0442333333' from 195.128.182.62:5060**
  == Using SIP RTP CoS mark 5
Found RTP audio format 8
Found RTP audio format 0
Found RTP audio format 18
Found RTP audio format 4
Found RTP audio format 110
Found RTP audio format 101
Found audio description format PCMA for ID 8
Found audio description format PCMU for ID 0
Found audio description format G729 for ID 18
Found audio description format G723 for ID 4
Found audio description format opus for ID 110
Found audio description format telephone-event for ID 101
Capabilities: us - (alaw|ulaw|g729), peer - audio=(ulaw|g723|alaw|g729|opus)/video=(nothing)/text=(nothing), combined - (alaw|ulaw|g729)
Non-codec capabilities (dtmf): us - 0x1 (telephone-event|), peer - 0x1 (telephone-event|), combined - 0x1 (telephone-event|)
Peer audio RTP is at port 195.128.182.62:64212
****Looking for 442222222 in cont-442221111** (domain 213.108.78.144)**

<--- Reliably Transmitting (NAT) to 195.128.182.62:5060 --->
SIP/2.0 484 Address Incomplete
Via: SIP/2.0/UDP 195.128.182.62:5060;branch=z9hG4bK8b44b6e4a6577a01;received=195.128.182.62;rport=5060
From: "0442333333" <sip:0442333333@195.128.182.62>;tag=52051a1c
To: "442222222 " <sip:442222222 @195.128.182.62>;tag=as0b3b0fba
Call-ID: 136c5e364397ffbbbee39b0711b983
CSeq: 14129 INVITE
Server: Asterisk PBX 13.1.0~dfsg-1.1ubuntu4.1
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Length: 0


<------------>
Scheduling destruction of SIP dialog '136c5e364397ffbbbee39b0711b983' in 6400 ms (Method: INVITE)

<--- SIP read from UDP:195.128.182.62:5060 --->
ACK sip:442222222@111.222.333.444:5060 SIP/2.0
Call-ID: 136c5e364397ffbbbee39b0711b983
Via: SIP/2.0/UDP 195.128.182.62:5060;branch=z9hG4bK8b44b6e4a6577a01
From: "0442333333" <sip:0442333333@195.128.182.62>;tag=52051a1c
To: "442222222" <sip:442222222@195.128.182.62>;tag=as0b3b0fba
CSeq: 14129 ACK
Max-Forwards: 70
User-Agent: Smile CTI Server
X-Redirecting-Number: 442215471
Allow: INVITE, ACK, OPTIONS, CANCEL, BYE, UPDATE, REFER, NOTIFY, INFO, SUBSCRIBE, MESSAGE
Content-Length: 0

В чем может быть трабл, подскажите пожалуйста?

удалить закрыть спам изменить тег редактировать

спросил 2018-06-10 02:39:38 +0400

ramadan Gravatar ramadan
1 8 1 5

обновил 2018-06-10 02:43:25 +0400

Comments

Если номера будут в одном контексте, то как я разделю их при исходящих? Добавочные номера не очень хочется

ramadan ( 2018-06-11 10:45:30 +0400 )редактировать

1 Ответ

0

Asterisk ищет контекст по адресу. Адрес совпадает. Нахождение происходит по первой в памяти(не обязательно в конфиге) секции с нужным адресом, что мы и видим.

**Found peer '442221111' for '0442333333' from 195.128.182.62:5060**

Разделить номера в вашем случае можно тривиально по самим номерам.

ссылка удалить спам редактировать

ответил 2018-06-10 20:40:10 +0400

meral Gravatar meral flag of Ukraine
23347 24 20 177
http://pro-sip.net/

Ваш ответ

Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!
[скрыть предварительный просмотр]

Закладки и информация

Добавить закладку

подписаться на rss ленту новостей

Статистика

Задан: 2018-06-10 02:39:38 +0400

Просмотрен: 386 раз

Обновлен: Jun 10 '18

Проект компании "АТС Дизайн"
Asterisk® и Digium® являются зарегистрированными торговыми марками компании Digium, Inc., США.
IP АТС Asterisk распространяется под лицензией GNU GPL.