PJSIP второй INVITE после 200

Основной форум.
Для опытных

Модераторы: Admins, Модераторы

Ответить
UserAd
Сообщения: 7
Зарегистрирован: 15 ноя 2012, 14:12

PJSIP второй INVITE после 200

Сообщение UserAd » 10 сен 2018, 14:01

После получения 200 через прокси с заголовком Record-route Asterisk делает еще один инвайт.

Первый INVITE выглядит так:

Код: Выделить всё

INVITE sip:1-5001@192.168.0.17:5060 SIP/2.0
Via: SIP/2.0/UDP 192.168.0.20:5081;rport;branch=z9hG4bKPj81ccd332-4eca-4ab5-92da-669439f4bec9
From: "KT" <sip:1234567890@192.168.0.20;user=phone>;tag=0172bfd7-dd88-4cc4-8f69-3e5016276679
To: <sip:1-5001@192.168.0.17>
Contact: <sip:asterisk@192.168.0.20:5081>
Call-ID: 34c066eb-494a-4093-95a5-6f114a9a168d
CSeq: 17612 INVITE
Allow: OPTIONS, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, REGISTER, REFER, MESSAGE
Supported: 100rel, replaces, norefersub
Max-Forwards: 70
User-Agent: Asterisk PBX 15.5.0~dfsg-1.1ubuntu4.8
Content-Type: application/sdp
Content-Length:   235

SPD
Второй:

Код: Выделить всё

INVITE sip:5001@XXX.XXX.XXX.XXX:5060;transport=TCP SIP/2.0
Via: SIP/2.0/UDP 192.168.0.20:5081;rport;branch=z9hG4bKPj77526e3f-9937-4f57-a789-32c487096d2d
From: "KT" <sip:1234567890@192.168.0.20;user=phone>;tag=0172bfd7-dd88-4cc4-8f69-3e5016276679
To: <sip:1-5001@192.168.0.17>;tag=as1ad55bf6
Contact: <sip:asterisk@192.168.0.20:5081>
Call-ID: 34c066eb-494a-4093-95a5-6f114a9a168d
CSeq: 17613 INVITE
Route: <sip:192.168.0.17;lr;r2=on;ftag=0172bfd7-dd88-4cc4-8f69-3e5016276679>
Route: <sip:192.168.0.17;transport=tcp;lr;r2=on;ftag=0172bfd7-dd88-4cc4-8f69-3e5016276679>
Allow: OPTIONS, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, REGISTER, REFER, MESSAGE
Supported: 100rel, replaces, norefersub
Max-Forwards: 70
User-Agent: Asterisk PBX 15.5.0~dfsg-1.1ubuntu4.8
Content-Type: application/sdp
Content-Length:   235

SDP
SDP секции идентичны, т.е. codec locking нет.

Есть ли какой способ отключить такое поведение, так как на другой стороне софт это очень не любит и просто рвет звонок.

xelas
admin
Сообщения: 1155
Зарегистрирован: 05 мар 2007, 11:21

Re: PJSIP второй INVITE после 200

Сообщение xelas » 10 сен 2018, 15:35

А можно увидеть весь диалог? И конфигурацию эндпоинта.

UserAd
Сообщения: 7
Зарегистрирован: 15 ноя 2012, 14:12

Re: PJSIP второй INVITE после 200

Сообщение UserAd » 10 сен 2018, 15:48

Код: Выделить всё

INVITE sip:1-5001@192.168.0.17:5060 SIP/2.0
Via: SIP/2.0/UDP 192.168.0.20:5081;rport;branch=z9hG4bKPja988d426-4e4d-4fe5-8c9a-094802c9a132
From: "KT" <sip:1234567890@192.168.0.20;user=phone>;tag=3928f329-a2b0-4c29-9418-f2917ed3c3fc
To: <sip:1-5001@192.168.0.17>
Contact: <sip:asterisk@192.168.0.20:5081>
Call-ID: 5ede6425-55ad-471d-834e-79a35b1d8724
CSeq: 10693 INVITE
Allow: OPTIONS, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, REGISTER, REFER, MESSAGE
Supported: 100rel, replaces, norefersub
Max-Forwards: 70
User-Agent: Asterisk PBX 15.5.0~dfsg-1.1ubuntu4.8
Content-Type: application/sdp
Content-Length:   235

v=0
o=- 670689145 670689145 IN IP4 192.168.0.20
s=Asterisk
c=IN IP4 192.168.0.20
t=0 0
m=audio 13056 RTP/AVP 0 101
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:150
a=sendrecv

====================================================================

SIP/2.0 100 trying -- your call is important to us
Via: SIP/2.0/UDP 192.168.0.20:5081;rport=5081;branch=z9hG4bKPja988d426-4e4d-4fe5-8c9a-094802c9a132;received=192.168.0.20
From: "KT" <sip:1234567890@192.168.0.20;user=phone>;tag=3928f329-a2b0-4c29-9418-f2917ed3c3fc
To: <sip:1-5001@192.168.0.17>
Call-ID: 5ede6425-55ad-471d-834e-79a35b1d8724
CSeq: 10693 INVITE
Content-Length: 0

====================================================================

SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.0.20:5081;received=192.168.0.20;rport=5081;branch=z9hG4bKPja988d426-4e4d-4fe5-8c9a-094802c9a132
Record-Route: <sip:192.168.0.17;transport=tcp;r2=on;lr=on;ftag=3928f329-a2b0-4c29-9418-f2917ed3c3fc>
Record-Route: <sip:192.168.0.17;r2=on;lr=on;ftag=3928f329-a2b0-4c29-9418-f2917ed3c3fc>
From: 1234567890 <sip:1234567890@192.168.0.20;user=phone>;tag=3928f329-a2b0-4c29-9418-f2917ed3c3fc
To: <sip:1-5001@192.168.0.17>;tag=as0e5c4579
Call-ID: 5ede6425-55ad-471d-834e-79a35b1d8724
CSeq: 10693 INVITE
Server: Asterisk PBX 13.1.0~dfsg-1.1ubuntu4.1
Contact: <sip:5001@XXX.XXX.XXX.XXX:5060;transport=TCP>
Content-Type: application/sdp
Content-Length: 310
Allow: ACK, CANCEL, OPTIONS, BYE
Supported: replaces, timer

v=0
o=root 1070199426 1070199426 IN IP4 XXX.XXX.XXX.XXX
s=Asterisk PBX 13.1.0~dfsg-1.1ubuntu4.1
c=IN IP4 XXX.XXX.XXX.XXX
t=0 0
m=audio 13538 RTP/AVP 0 8 3 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:3 GSM/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=maxptime:150
a=sendrecv

====================================================================

ACK sip:5001@XXX.XXX.XXX.XXX:5060;transport=TCP SIP/2.0
Via: SIP/2.0/UDP 192.168.0.20:5081;rport;branch=z9hG4bKPj07cd9aac-061c-4318-b3c5-6d257b69641b
From: "KT" <sip:1234567890@192.168.0.20;user=phone>;tag=3928f329-a2b0-4c29-9418-f2917ed3c3fc
To: <sip:1-5001@192.168.0.17>;tag=as0e5c4579
Call-ID: 5ede6425-55ad-471d-834e-79a35b1d8724
CSeq: 10693 ACK
Route: <sip:192.168.0.17;lr;r2=on;ftag=3928f329-a2b0-4c29-9418-f2917ed3c3fc>
Route: <sip:192.168.0.17;transport=tcp;lr;r2=on;ftag=3928f329-a2b0-4c29-9418-f2917ed3c3fc>
Max-Forwards: 70
User-Agent: Asterisk PBX 15.5.0~dfsg-1.1ubuntu4.8
Content-Length:  0

====================================================================

INVITE sip:5001@XXX.XXX.XXX.XXX:5060;transport=TCP SIP/2.0
Via: SIP/2.0/UDP 192.168.0.20:5081;rport;branch=z9hG4bKPjb5308fff-0ad7-40b4-92ed-44d541c9d7dc
From: "KT" <sip:1234567890@192.168.0.20;user=phone>;tag=3928f329-a2b0-4c29-9418-f2917ed3c3fc
To: <sip:1-5001@192.168.0.17>;tag=as0e5c4579
Contact: <sip:asterisk@192.168.0.20:5081>
Call-ID: 5ede6425-55ad-471d-834e-79a35b1d8724
CSeq: 10694 INVITE
Route: <sip:192.168.0.17;lr;r2=on;ftag=3928f329-a2b0-4c29-9418-f2917ed3c3fc>
Route: <sip:192.168.0.17;transport=tcp;lr;r2=on;ftag=3928f329-a2b0-4c29-9418-f2917ed3c3fc>
Allow: OPTIONS, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, REGISTER, REFER, MESSAGE
Supported: 100rel, replaces, norefersub
Max-Forwards: 70
User-Agent: Asterisk PBX 15.5.0~dfsg-1.1ubuntu4.8
Content-Type: application/sdp
Content-Length:   235

v=0
o=- 670689145 670689146 IN IP4 192.168.0.20
s=Asterisk
c=IN IP4 192.168.0.20
t=0 0
m=audio 13056 RTP/AVP 0 101
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:150
a=sendrecv

Эндпоинт сконфигурирован как:

Код: Выделить всё

[transport-udp]
type = transport
protocol = udp
bind = 0.0.0.0:5081

[in]
type = aor
contact = sip:192.168.0.17:5060

[in]
type = identify
endpoint = in
match = 192.168.0.17

[in]
type = endpoint
context = pjsip-queue
disallow = all
allow = ulaw
rtp_symmetric = no
force_rport = no
rewrite_contact = no
connected_line_method=update
direct_media = no
aors = in
disable_direct_media_on_nat=yes
direct_media_method=update
allow_overlap=no
allow_transfer=no
allow_subscribe=no
user_eq_phone=yes
direct_media=no
timers=no

В качестве эндпоинта использован Asterisk, но то-же самое происходит и с провайдером, так что можно опираться на эти данные

xelas
admin
Сообщения: 1155
Зарегистрирован: 05 мар 2007, 11:21

Re: PJSIP второй INVITE после 200

Сообщение xelas » 10 сен 2018, 16:26

Меня смущает то, что диалог у вас начиется в UDP, а потом происходит переключение на TCP. А транспорт у вас сконфигурирован только на UDP.
Вероятно, проблема вовсе не в Route-Record.

UserAd
Сообщения: 7
Зарегистрирован: 15 ноя 2012, 14:12

Re: PJSIP второй INVITE после 200

Сообщение UserAd » 10 сен 2018, 16:40

Вообще непонятно почему asterisk интересует что происходит после proxy.

Если транспорт на proxy не переключается, то диалог выглядит так-же:

Код: Выделить всё

INVITE sip:1-5001@192.168.0.17:5060 SIP/2.0
Via: SIP/2.0/UDP 192.168.0.20:5081;rport;branch=z9hG4bKPjc4dc927a-f974-4f2c-b0d5-f45f18af12d4
From: "KT" <sip:1234567890@192.168.0.20;user=phone>;tag=802ef779-db95-4ec7-bed5-bb8dc4bf4edb
To: <sip:1-5001@192.168.0.17>
Contact: <sip:asterisk@192.168.0.20:5081>
Call-ID: 0764993a-ed6f-4ff6-9e0c-24c580f45456
CSeq: 12539 INVITE
Allow: OPTIONS, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, REGISTER, REFER, MESSAGE
Supported: 100rel, replaces, norefersub
Max-Forwards: 70
User-Agent: Asterisk PBX 15.5.0~dfsg-1.1ubuntu4.8
Content-Type: application/sdp
Content-Length:   235

v=0
o=- 871558414 871558414 IN IP4 192.168.0.20
s=Asterisk
c=IN IP4 192.168.0.20
t=0 0
m=audio 13904 RTP/AVP 0 101
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:150
a=sendrecv


===================================

SIP/2.0 100 trying -- your call is important to us
Via: SIP/2.0/UDP 192.168.0.20:5081;rport=5081;branch=z9hG4bKPjc4dc927a-f974-4f2c-b0d5-f45f18af12d4;received=192.168.0.20
From: "KT" <sip:1234567890@192.168.0.20;user=phone>;tag=802ef779-db95-4ec7-bed5-bb8dc4bf4edb
To: <sip:1-5001@192.168.0.17>
Call-ID: 0764993a-ed6f-4ff6-9e0c-24c580f45456
CSeq: 12539 INVITE
Content-Length: 0

===================================

SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.0.20:5081;received=192.168.0.20;rport=5081;branch=z9hG4bKPjc4dc927a-f974-4f2c-b0d5-f45f18af12d4
Record-Route: <sip:192.168.0.17;lr=on;ftag=802ef779-db95-4ec7-bed5-bb8dc4bf4edb>
From: 1234567890 <sip:1234567890@192.168.0.20;user=phone>;tag=802ef779-db95-4ec7-bed5-bb8dc4bf4edb
To: <sip:1-5001@192.168.0.17:5060>;tag=as050d89d3
Call-ID: 0764993a-ed6f-4ff6-9e0c-24c580f45456
CSeq: 12539 INVITE
Server: Asterisk PBX 13.1.0~dfsg-1.1ubuntu4.1
Contact: <sip:5001@XXX.XXX.XXX.XXX:5060>
Content-Type: application/sdp
Content-Length: 310
Allow: ACK, CANCEL, OPTIONS, BYE
Supported: replaces, timer

v=0
o=root 1693610465 1693610465 IN IP4 XXX.XXX.XXX.XXX
s=Asterisk PBX 13.1.0~dfsg-1.1ubuntu4.1
c=IN IP4 XXX.XXX.XXX.XXX
t=0 0
m=audio 18850 RTP/AVP 0 8 3 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:3 GSM/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=maxptime:150
a=sendrecv

===================================


ACK sip:5001@XXX.XXX.XXX.XXX:5060 SIP/2.0
Via: SIP/2.0/UDP 192.168.0.20:5081;rport;branch=z9hG4bKPj159c1807-acf4-4290-a1a5-bd5c452a2e6c
From: "KT" <sip:1234567890@192.168.0.20;user=phone>;tag=802ef779-db95-4ec7-bed5-bb8dc4bf4edb
To: <sip:1-5001@192.168.0.17>;tag=as050d89d3
Call-ID: 0764993a-ed6f-4ff6-9e0c-24c580f45456
CSeq: 12539 ACK
Route: <sip:192.168.0.17;lr;ftag=802ef779-db95-4ec7-bed5-bb8dc4bf4edb>
Max-Forwards: 70
User-Agent: Asterisk PBX 15.5.0~dfsg-1.1ubuntu4.8
Content-Length:  0

===================================


INVITE sip:5001@XXX.XXX.XXX.XXX:5060 SIP/2.0
Via: SIP/2.0/UDP 192.168.0.20:5081;rport;branch=z9hG4bKPjdef70972-15cf-46f8-b8e5-b93d650ce577
From: "KT" <sip:1234567890@192.168.0.20;user=phone>;tag=802ef779-db95-4ec7-bed5-bb8dc4bf4edb
To: <sip:1-5001@192.168.0.17>;tag=as050d89d3
Contact: <sip:asterisk@192.168.0.20:5081>
Call-ID: 0764993a-ed6f-4ff6-9e0c-24c580f45456
CSeq: 12540 INVITE
Route: <sip:192.168.0.17;lr;ftag=802ef779-db95-4ec7-bed5-bb8dc4bf4edb>
Allow: OPTIONS, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, REGISTER, REFER, MESSAGE
Supported: 100rel, replaces, norefersub
Max-Forwards: 70
User-Agent: Asterisk PBX 15.5.0~dfsg-1.1ubuntu4.8
Content-Type: application/sdp
Content-Length:   235

v=0
o=- 871558414 871558415 IN IP4 192.168.0.20
s=Asterisk
c=IN IP4 192.168.0.20
t=0 0
m=audio 13904 RTP/AVP 0 101
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:150
a=sendrecv

Ответить