How to do direct SIP calls with PJSIP

Hi,

with chan_sip, I can simply directly call another server with
Dial(SIP/user@domain.tld)

With PJSIP, I created a dummy endpoint and tried with
Dial(PJSIP/dummy/sip:user@domain.tld)
with no luck:

res_pjsip_outbound_authenticator_digest.c:178 digest_create_request_with_auth: 
Endpoint: 'dummy': Unable to create request with auth. 
No auth credentials for realm(s) 'domain.tld' in challenge.

Well, yes… I don’t want any auth…

In my pjsip.conf I just added:

[dummy]
type=endpoint

Do I have to configure anything else for this to work?

Thanks!

The remote side challenged for authentication but your endpoint has no “outbound_auth” configured, so chan_pjsip has no idea of how to authenticate.

https://asteriskfaqs.org/2018/04/16/asterisk-users/pjsip-error-no-auth-credentials-for-realms-asterisk-in-challenge.html

configure the AUTH SECTION for that dummy endpoint

The other side does though, and that can only be changed from the other side (although note that there are reports that flowroute can have authentication requests suppressed by using a modified outbound URI).

Thanks - finally I did a SIP trace and found out weird behaviour of the called target.
The target normally does not enforce authentication, but it does somehow in my case, because of a problem with the SDP. The log debug log of the called device states, that it’s rejecting an unauthenticated call with missing mandatory SDP information.
It’s odd behaviour, but it’s definetely caused by an invalid SDP sent from my Asterisk:

My SDP contains:

v=0
o=- 1389380194 1389380194 IN IP4 (null)
s=Asterisk
c=IN IP4 (null)
t=0 0

That (null) instead of the IP address is causing the problem.
When calling another server (an Asterisk server with chan_sip), that call gets rejected with SIP/488 because of incomplete SDP information.

.

In pjsip.conf I configured a transport with:

[transport-udp](!)
type = transport
protocol = udp

[transport-udp-ipv4-1](transport-udp)
bind = 192.168.0.166
local_net = 192.168.0.0/16
external_media_address = 93.209.xxxx
external_signaling_address = 93.209.xxxx

Do I have to add something to the Endpoint?

You need to configure codecs to allow on the endpoint.

Hi,

I had those defined. This is the relevant part of my pjsip.conf:

[transport-udp](!)
type = transport
protocol = udp

[transport-udp-ipv4-1](transport-udp)
bind = 192.168.0.166
local_net = 192.168.0.0/16
external_media_address = 93.209.xxx
external_signaling_address = 93.209.xxx

[dummy]
type=endpoint
allow=!all,opus,g722,alaw
direct_media=no
force_rport=yes
transport=transport-udp-ipv4-1

Resulting INVITE SDP:

v=0
o=- 1945721650 1945721650 IN IP4 (null)
s=Asterisk
c=IN IP4 (null)
t=0 0
m=audio 50404 RTP/AVP 107 9 8 101
a=rtpmap:107 opus/48000/2
a=rtpmap:9 G722/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:20
a=sendrecv

It think I’ve hit a bug, or at least, an unexpected behaviour:
If I don’t set “stunaddr=mystunserver:3478” in rtp.conf, the Media IP field is “(null)”.
As soon as I add the STUN server configuration, it gets populated with the IP address determined by STUN.

Where is the packet going? Within local_net or external? Is that your actual configuration? What’s the full SIP request? Are you selectively loading modules?

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