Как заставить asterisk совершать звонки с различными транспортами?

sip:ivan@example.com - пользователь для которого указан транспорт tls и dtls-srtp
sip:111@example.com - пользователь с транспортом udp

конфигурация pjsip.conf
[udp]
type=transport
protocol=udp
bind=0.0.0.0

[tls]
type=transport
protocol=tls
bind=0.0.0.0
require_client_cert=yes
cert_file=/etc/asterisk/keys/asterisk.crt
priv_key_file=/etc/asterisk/keys/asterisk.key
method=tlsv1

[ivan]
type=aor
[ivan]
type=endpoint
transport=tls
allow=!all,alaw
context=default
media_encryption=dtls
dtls_ca_file=/etc/asterisk/keys/ca.crt
dtls_ca_path=/etc/asterisk/keys/
dtls_private_key=/etc/asterisk/keys/asterisk.key
dtls_cert_file=/etc/asterisk/keys/asterisk.crt
dtls_verify=yes
aors=ivan
auth=ivan
dtls_chiper=ALL
direct_media=no

[ivan]
type=auth
auth_type=userpass
username=ivan
password=secret

[111]
type=aor
[111]
type=endpoint
transport=udp
allow=!all,alaw
context=default
direct_media=no

[111]
type=auth
auth_type=userpass
username=111
password=secret


INVITE sip:111@sip.example.com:5061 SIP/2.0
Via: SIP/2.0/TLS 192.168.0.162:56454;branch=z9hG4bK1744364789;rport;alias
From: <sip:ivan@sip.example.com:5061>;tag=1630163948
To: <sip:111@sip.example.com:5061>
Call-ID: 634333749-32456-5@BJC.BGI.A.BGC
CSeq: 40 INVITE
Contact: <sip:ivan@192.168.0.162:56454;transport=tls>
Max-Forwards: 70
User-Agent: GrandStream Wave/Android 1.0.1.26
Privacy: none
P-Preferred-Identity: <sip:ivan@sip.example.com:5061>
Supported: replaces, path, timer, eventlist
Allow: INVITE, ACK, OPTIONS, CANCEL, BYE, SUBSCRIBE, NOTIFY, INFO, REFER, UPDATE, MESSAGE
Content-Type: application/sdp
Accept: application/sdp, application/dtmf-relay
Content-Length:   630

v=0
o=ivan 8000 8000 IN IP4 192.168.0.162
s=SIP Call
c=IN IP4 192.168.0.162
t=0 0
m=audio 38894 RTP/SAVP 8 101
a=sendrecv
a=rtpmap:8 PCMA/8000
a=ptime:20
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=crypto:1 AES_CM_256_HMAC_SHA1_80 inline:QA+t07031ninKLTcIY4Vq4vpHAng5TI8r8iJZrQFTm8T7WsBMIX2rS1yOSsBEQ==|2^31
a=crypto:2 AES_CM_256_HMAC_SHA1_32 inline:Xr4yo7e2L6aoD0w/Mjda0hzt4rS/Rf74b8jVZoK4sYr+cL/o4+piTRFbNEDX+Q==|2^31
a=crypto:3 AES_CM_128_HMAC_SHA1_80 inline:mpga3AInHwK8lPVtckaCZ0V8KOaGehMKDt4iwjsR|2^31
a=crypto:4 AES_CM_128_HMAC_SHA1_32 inline:b4+H2X1hxgr9nfxdPUDYWS0d0W0QQtwfvHnHX43q|2^31

<--- Transmitting SIP response (501 bytes) to TLS:88.88.88.77:56454 --->
SIP/2.0 401 Unauthorized
Via: SIP/2.0/TLS 192.168.0.162:56454;rport=56454;received=88.88.88.77;branch=z9hG4bK1744364789;alias
Call-ID: 634333749-32456-5@BJC.BGI.A.BGC
From: <sip:ivan@sip.example.com>;tag=1630163948
To: <sip:111@sip.example.com>;tag=z9hG4bK1744364789
CSeq: 40 INVITE
WWW-Authenticate: Digest  realm="asterisk",nonce="1456237587/dd08c43166cafd3bad4108c272ff7d3d",opaque="2af9c3a44045cad2",algorithm=md5,qop="auth"
Server: Asterisk PBX 13.7.0
Content-Length:  0


<--- Received SIP request (307 bytes) from TLS:88.88.88.77:56454 --->
ACK sip:111@sip.example.com:5061 SIP/2.0
Via: SIP/2.0/TLS 192.168.0.162:56454;branch=z9hG4bK1744364789;rport;alias
From: <sip:ivan@sip.example.com>;tag=1630163948
To: <sip:111@sip.example.com>;tag=z9hG4bK1744364789
Call-ID: 634333749-32456-5@BJC.BGI.A.BGC
CSeq: 40 ACK
Content-Length: 0


<--- Received SIP request (1649 bytes) from TLS:88.88.88.77:56454 --->
INVITE sip:111@sip.example.com:5061 SIP/2.0
Via: SIP/2.0/TLS 192.168.0.162:56454;branch=z9hG4bK1984560350;rport;alias
From: <sip:ivan@sip.example.com:5061>;tag=1630163948
To: <sip:111@sip.example.com:5061>
Call-ID: 634333749-32456-5@BJC.BGI.A.BGC
CSeq: 41 INVITE
Contact: <sip:ivan@192.168.0.162:56454;transport=tls>
Authorization: Digest username="ivan", realm="asterisk", nonce="1456237587/dd08c43166cafd3bad4108c272ff7d3d", uri="sip:111@sip.example.com:5061", response="e08c1ccd09945f312ad60c0284ffe205", algorithm=md5, cnonce="08170644", opaque="2af9c3a44045cad2", qop=auth, nc=00000005
Max-Forwards: 70
User-Agent: GrandStream Wave/Android 1.0.1.26
Privacy: none
P-Preferred-Identity: <sip:ivan@sip.example.com:5061>
Supported: replaces, path, timer, eventlist
Allow: INVITE, ACK, OPTIONS, CANCEL, BYE, SUBSCRIBE, NOTIFY, INFO, REFER, UPDATE, MESSAGE
Content-Type: application/sdp
Accept: application/sdp, application/dtmf-relay
Content-Length:   630

v=0
o=ivan 8000 8000 IN IP4 192.168.0.162
s=SIP Call
c=IN IP4 192.168.0.162
t=0 0
m=audio 38894 RTP/SAVP 8 101
a=sendrecv
a=rtpmap:8 PCMA/8000
a=ptime:20
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=crypto:1 AES_CM_256_HMAC_SHA1_80 inline:QA+t07031ninKLTcIY4Vq4vpHAng5TI8r8iJZrQFTm8T7WsBMIX2rS1yOSsBEQ==|2^31
a=crypto:2 AES_CM_256_HMAC_SHA1_32 inline:Xr4yo7e2L6aoD0w/Mjda0hzt4rS/Rf74b8jVZoK4sYr+cL/o4+piTRFbNEDX+Q==|2^31
a=crypto:3 AES_CM_128_HMAC_SHA1_80 inline:mpga3AInHwK8lPVtckaCZ0V8KOaGehMKDt4iwjsR|2^31
a=crypto:4 AES_CM_128_HMAC_SHA1_32 inline:b4+H2X1hxgr9nfxdPUDYWS0d0W0QQtwfvHnHX43q|2^31

<--- Transmitting SIP response (380 bytes) to TLS:88.88.88.77:56454 --->
SIP/2.0 488 Not Acceptable Here
Via: SIP/2.0/TLS 192.168.0.162:56454;rport=56454;received=88.88.88.77;branch=z9hG4bK1984560350;alias
Call-ID: 634333749-32456-5@BJC.BGI.A.BGC
From: <sip:ivan@sip.example.com>;tag=1630163948
To: <sip:111@sip.example.com>;tag=e75a3a71-4b7e-4375-bd91-d4dae165c102
CSeq: 41 INVITE
Server: Asterisk PBX 13.7.0
Content-Length:  0


<--- Received SIP request (326 bytes) from TLS:88.88.88.77:56454 --->
ACK sip:111@sip.example.com:5061 SIP/2.0
Via: SIP/2.0/TLS 192.168.0.162:56454;branch=z9hG4bK1984560350;rport;alias
From: <sip:ivan@sip.example.com>;tag=1630163948
To: <sip:111@sip.example.com>;tag=e75a3a71-4b7e-4375-bd91-d4dae165c102
Call-ID: 634333749-32456-5@BJC.BGI.A.BGC
CSeq: 41 ACK
Content-Length: 0


При звонках стабильно отдает SIP/2.0 488
Почему звонок уходит на sip:111@example.com:5061, когда 111 доступен лишь по udp?
  • Вопрос задан
  • 1637 просмотров
Решения вопроса 1
@Tihon_V Автор вопроса
Нужно добавить "media_encryption_optimistic=yes" в endpoint.
Данная опция есть начиная с asterisk 13.x.
Ответ написан
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы