I
I
Ivan Tishchenko2016-02-23 17:54:31
Asterisk
Ivan Tishchenko, 2016-02-23 17:54:31

How to make asterisk make calls with different transports?

sip:[email protected] - user for which tls and dtls-srtp transport is specified
sip:[email protected] - user with udp transport
pjsip.conf configuration

[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:[email protected]:5061 SIP/2.0
Via: SIP/2.0/TLS 192.168.0.162:56454;branch=z9hG4bK1744364789;rport;alias
From: <sip:[email protected]:5061>;tag=1630163948
To: <sip:[email protected]:5061>
Call-ID: [email protected]
CSeq: 40 INVITE
Contact: <sip:[email protected]:56454;transport=tls>
Max-Forwards: 70
User-Agent: GrandStream Wave/Android 1.0.1.26
Privacy: none
P-Preferred-Identity: <sip:[email protected]: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: [email protected]
From: <sip:[email protected]>;tag=1630163948
To: <sip:[email protected]>;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:[email protected]:5061 SIP/2.0
Via: SIP/2.0/TLS 192.168.0.162:56454;branch=z9hG4bK1744364789;rport;alias
From: <sip:[email protected]>;tag=1630163948
To: <sip:[email protected]>;tag=z9hG4bK1744364789
Call-ID: [email protected]
CSeq: 40 ACK
Content-Length: 0


<--- Received SIP request (1649 bytes) from TLS:88.88.88.77:56454 --->
INVITE sip:[email protected]:5061 SIP/2.0
Via: SIP/2.0/TLS 192.168.0.162:56454;branch=z9hG4bK1984560350;rport;alias
From: <sip:[email protected]:5061>;tag=1630163948
To: <sip:[email protected]:5061>
Call-ID: [email protected]
CSeq: 41 INVITE
Contact: <sip:[email protected]:56454;transport=tls>
Authorization: Digest username="ivan", realm="asterisk", nonce="1456237587/dd08c43166cafd3bad4108c272ff7d3d", uri="sip:[email protected]: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:[email protected]: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: [email protected]
From: <sip:[email protected]>;tag=1630163948
To: <sip:[email protected]>;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:[email protected]:5061 SIP/2.0
Via: SIP/2.0/TLS 192.168.0.162:56454;branch=z9hG4bK1984560350;rport;alias
From: <sip:[email protected]>;tag=1630163948
To: <sip:[email protected]>;tag=e75a3a71-4b7e-4375-bd91-d4dae165c102
Call-ID: [email protected]
CSeq: 41 ACK
Content-Length: 0

When making calls, it consistently gives SIP / 2.0 488
Why does the call go to sip:[email protected]:5061 when 111 is available only via udp?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ivan Tishchenko, 2016-02-23
@Tihon_V

You need to add "media_encryption_optimistic=yes" to the endpoint.
This option is available starting with asterisk 13.x.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question