Couldn't negotiate stream + audio:sendrecv

I am getting the below error:
Couldn't negotiate stream 0:audio-0:audio:sendrecv (nothing)
Can someone help me to resolve this

here is the logs

[2020-12-02 16:45:23] ERROR[32384]: res_pjsip_session.c:934 handle_incoming_sdp:  101: Couldn't negotiate stream 0:audio-0:audio:sendrecv (nothing)
<--- Transmitting SIP response (371 bytes) to WSS:45.126.171.190:60029 --->
SIP/2.0 488 Not Acceptable Here
Via: SIP/2.0/WSS 9p5m6df5f0qk.invalid;rport=60029;received=45.126.171.190;branch=z9hG4bK2700983
Call-ID: h0h2a2je2oi5n7qv184j
From: "101" <sip:777@DOMAIN.com>;tag=vqs1lqfqmt
To: <sip:+123456789@DOMAIN.com>;tag=47478f71-cb8b-4ae2-8bf5-e551fbf3f3fc
CSeq: 252 INVITE
Server: Asterisk PBX 16.15.0
Content-Length:  0

You would need to provide the complete SIP trace and configuration. If using WebRTC, then this will occur if you have not configured the endpoint for WebRTC.

Hey, Thanks for the quick response.

Yes, I am using WebRTC thank you for correcting in my configuration.

Earlier the configuration looks like this:

[101]
type=endpoint
transport=udp-transport
context=twilio-out
disallow=all
allow=alaw
allow=ulaw
auth=101
aors=101

After I made the changes it look like this, but now it doesnt find the “context=twilio-out”

[101]
type=endpoint

use_avpf=yes
media_encryption=dtls
dtls_ca_file=/etc/asterisk/keys/ca.crt
dtls_cert_file=/etc/asterisk/keys/asterisk.pem
dtls_verify=fingerprint
dtls_setup=actpass
ice_support=yes
media_use_received_transport=yes
rtcp_mux=yes

transport=udp-transport
context=twilio-out
disallow=all
allow=alaw
allow=ulaw
auth=101
aors=101

You’d need to specify what “it doesn’t find the context=twilio-out” actually means. What happens? What do you see?

1 Like

on the console it shows

res_pjsip_outbound_authenticator_digest.c:178 digest_create_request_with_auth: Endpoint: 'twilio': Unable to create request with auth. No auth credentials for realm(s) 'sip.twilio.com' in challenge.
  == Everyone is busy/congested at this time (1:0/0/1)

That means an outgoing call was placed using the endpoint named “twilio”. Twilio challenged for authentication credentials, but you don’t have any configured so Asterisk could not authenticate.

1 Like

Okay…

This is how my dialer looks, do I have to add something on pjsip.conf file for this?

[twilio-out]
exten => _+91X,1,Dial(PJSIP/${EXTEN})
exten => _+91X.,1,Set(CALLERID(num)=+123456789)
same => n,Dial(PJSIP/${EXTEN}@twilio)

If Twilio requires you to authenticate your outbound calls, then you would need to configure outbound authentication in pjsip.conf for the twilio endpoint[1].

[1] https://wiki.asterisk.org/wiki/display/AST/res_pjsip+Configuration+Examples

1 Like

Hey,
Thanks for the example.

Now I have added this configuration based on the given example link, but the error is still the same:

[twilio]
type=registration
outbound_auth=twilio
server_uri=sip:SUBDOMAIN.pstn.twilio.com
client_uri=sip:+123456789@SUBDOMAIN.pstn.twilio.com
retry_interval=60
 
[twilio]
type=auth
auth_type=userpass
password=ABCD123456789
username=USERNAME

That is for outbound registration. The “type=endpoint” defines the configuration to use for calls. If that doesn’t have an outbound_auth specified, then there would be no authentication credentials.

1 Like

Hi,

I dont know what wrong I am doing, can you help me to understand from my configuration

[wss-transport]
type=transport
protocol=wss
bind=0.0.0.0

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


[tls-transport]
type=transport
protocol=tls
bind=0.0.0.0
cert_file=/etc/asterisk/keys/sip.DOMAIN.com.crt
priv_key_file=/etc/asterisk/keys/sip.DOMAIN.com.key

; =========== ;


[twilio]
type=aor
contact=sip:+123456789@SUBDOMAIN.pstn.twilio.com


[twilio]
type=registration
outbound_auth=twilio
server_uri=sip:SUBDOMAIN.pstn.twilio.com
client_uri=sip:+123456789@SUBDOMAIN.pstn.twilio.com
retry_interval=60

[twilio]
type=auth
auth_type=userpass
password=PASSWORD
username=ABCD123456789


[twilio]
type=endpoint
transport=udp-transport
context=twilio-in
disallow=all
allow=alaw
allow=ulaw
aors=twilio
from_domain=SUBDOMAIN.pstn.twilio.com
direct_media=no

[twilio]
type=identify
endpoint=twilio
match=SUBDOMAIN.pstn.twilio.com
match=sip.twilio.com


[101]
type=endpoint
outbound_auth=twilio

use_avpf=yes
media_encryption=dtls
dtls_cert_file=/etc/asterisk/keys/sip.DOMAIN.com.pem
dtls_private_key=/etc/asterisk/keys/sip.DOMAIN.com.key
dtls_ca_file=/etc/asterisk/keys/sip.DOMAIN.com.crt
dtls_verify=fingerprint
dtls_setup=actpass
ice_support=yes
media_use_received_transport=yes
rtcp_mux=yes

transport=udp-transport
context=twilio-out
disallow=all
allow=alaw
allow=ulaw
auth=101
aors=101

[101]
type=auth
auth_type=userpass
password=101
username=101

[101]
type=aor
max_contacts=10

The following endpoint:

[twilio]
type=endpoint
transport=udp-transport
context=twilio-in
disallow=all
allow=alaw
allow=ulaw
aors=twilio
from_domain=SUBDOMAIN.pstn.twilio.com
direct_media=no

Does not have:

outbound_auth=twilio

Without it, any outgoing calls placed using it will not know how to authenticate.

2 Likes

Hey,
Thanks for pointing it out.
I have added this on the wrong place.

Thanks a ton :slight_smile:
You really helped me a lot.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.