Troubleshooting Outbound Call - VOIP Provider via PJSIP

Hi,

I am new to the community and Asterisk - I just installed Asterisk 18 and have been following the online guides. I got as far as a clean installation with two endpoints 6001 and 6002 that are two sip phones that register successfully and can make calls between each other. I then moved to registering with my VOIP provider, by registering it. I was able to successfully register with my VOIP provider, however, I got stuck at making outbound calls (have not attempted fully to handle inbound calls yet, that will be next).

The error I see is when making an outbound call:

[Jan 15 12:56:38] ERROR[1326] res_pjsip.c: Endpoint 'mytrunk': Could not create dialog to invalid URI '155'. Is endpoint registered and reachable?

[Jan 15 12:56:38] ERROR[1326] chan_pjsip.c: Failed to create outgoing session to endpoint 'mytrunk'

[Jan 15 12:56:38] NOTICE[1337][C-00000001] app_dial.c: Unable to create channel of type 'PJSIP' (cause 3 - No route to destination)

[Jan 15 12:56:38] VERBOSE[1337][C-00000001] app_dial.c: Everyone is busy/congested at this time (1:0/0/1)

[Jan 15 12:56:38] VERBOSE[1337][C-00000001] pbx.c: Auto fallthrough, channel 'PJSIP/6001-00000000' status is 'CHANUNAVAIL'

I have confirmed, with my voip provide, 155 is a valid number to dial out with. I see this message with this configuration (i replaced and for my username/password and sip.net is my voip provider’s registration address.

pjsip.conf

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

[mytrunk]
type=registration
transport=transport-udp
outbound_auth=mytrunk_auth
server_uri=sip:isp.net
client_uri=sip:<un>@isp.net
contact_user=<un>
retry_interval=60

[mytrunk_auth]
type=auth
auth_type=userpass
password=<pw>
username=<un>

[mytrunk_aors]
type=aor
contact=sip:isp.net:5060

[mytrunk]
type=endpoint
context=from-external
disallow=all
allow=g722
allow=ulaw
allow=g729
outbound_auth=mytrunk_auth
aors=mytrunk_aors

[mytrunk]
type=identify
match=isp.net
endpoint=mytrunk

extensions.conf

exten => _X.,1,Dial(PJSIP/mytrunk/${EXTEN})

interestingly if I change the above to this in my dialplan:

exten => _X.,1,Dial(PJSIP/${EXTEN}@mytrunk)

then I get this error at the Asterisk CLI:

   -- Executing [155@from-internal:1] Dial("PJSIP/6001-00000000", "PJSIP/155@mytrunk") in new stack
    -- Called PJSIP/155@mytrunk
  == Everyone is busy/congested at this time (1:0/0/1)
    -- Auto fallthrough, channel 'PJSIP/6001-00000000' status is 'CHANUNAVAIL'

I hoped to post as much useful information as possible - any help would be appreciated to help identify the problem and help continue to troubleshoot :slight_smile:

In the scenario that you have described, that is the correct method of dialing, as it uses a contact(and its domain) set in the AOR associated with the mytrunk endpoint,

take a lookt at Home - Asterisk Documentation

And related to the dialstatus response CHANUNAVAIL, run sip set logger on for more information and debug

1 Like

He meant pjsip set logger on !

:rofl: Damn I still have chan_sip pieces on my mind, more than 15 years using it.

Hi ambiorixg12!

Thanks for the reply – turned on the logger and got this in the SIP handsake with my provider:

-- Executing [155@from-internal:1] Dial("PJSIP/6001-0000000e", "PJSIP/155@mytrunk") in new stack
-- Called PJSIP/155@mytrunk
<--- Transmitting SIP request (984 bytes) to UDP:<IP_Address>:5060 --->
INVITE sip:155@isp.net:5060 SIP/2.0
Via: SIP/2.0/UDP 192.168.4.106:5060;rport;branch=z9hG4bKPj9baf6ab8-2610-4d38-8179-b14721a8a4c3
From: "6001" <sip:6001@192.168.4.106>;tag=75b18eb8-d8f2-494b-8e2e-3134bf5f6826
To: <sip:155@isp.net>
Contact: <sip:asterisk@192.168.4.106:5060>
Call-ID: 4493d8bc-813e-428b-bae1-82be239444dc
CSeq: 5811 INVITE
Allow: OPTIONS, REGISTER, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, MESSAGE, REFER
Supported: 100rel, timer, replaces, norefersub, histinfo
Session-Expires: 1800
Min-SE: 90
Max-Forwards: 70
User-Agent: Asterisk PBX 18.16.0
Content-Type: application/sdp
Content-Length:   308

v=0
o=- 416680753 416680753 IN IP4 192.168.4.106
s=Asterisk
c=IN IP4 192.168.4.106
t=0 0
m=audio 16214 RTP/AVP 0 9 18 101
a=rtpmap:0 PCMU/8000
a=rtpmap:9 G722/8000
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:150
a=sendrecv

<--- Received SIP response (475 bytes) from UDP:<IP_Address>:5060 --->
SIP/2.0 488 Not Acceptable Here
Via: SIP/2.0/UDP 192.168.4.106:5060;branch=z9hG4bKPj9baf6ab8-2610-4d38-8179-b14721a8a4c3;received=<my_ip>;rport=5060
From: "6001" <sip:6001@192.168.4.106>;tag=75b18eb8-d8f2-494b-8e2e-3134bf5f6826
To: <sip:155@isp.net>;tag=VF248f4ab4806c1d6e5de367d358bc
Call-ID: 4493d8bc-813e-428b-bae1-82be239444dc
CSeq: 5811 INVITE
User-Agent: ISP Sip Network
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER
Content-Length: 0

With my limited knowledge, it looks like this might be the issue – following the INVITE request in the handshake, the reply from my Voip Provider is:

SIP/2.0 488 Not Acceptable Here

I assume for some reason my Voip Provider’s server didn’t accept the request? Should I reach out to them - what questions would you recommend asking them :)) assuming there is nothing I can do my end to change the way in which the request is send to my provider?

Thanks again

What codecs do you support?

Do you require encryption, if so what options?

Do you generate 488 for an unrouteable media address?

I’d guess the last one, as you don’t seem to have configured your public media and signalling addresses correctly.

Make sure your provider support the codecs you’re advertising on your INVITE request

1 Like

Thank you both – appreciate the help. I am going to contact them now to see if they can help more troubleshoot.

@david551 - i’ll look into public media and signaling addresses - is this defined in the pjsip file within the [mytrunk] context normally?

They are defined for the transport, not the endpoint.

Thanks @david551 - will look into this more. Therefore it looks like I would add this into the [transport-udp] if needed and it looks like there are two I can define - like below?

local_net=192.168.4.0/24 to define my local network IP range
external_media_address=x.x.x.x <to define my external public IP address of my router although I do not have a static public IP address :expressionless:

Would you recommend adding these as best practice generally?

I am still troubleshooting with the voip provider – they mentioned in the middle of it they prefer the PCMA codec which after some research looks also to be known as G.177 with a ulaw flavor (used widely in North America) and alaw flavor (used widely in Europe) - my voip provider is based in Europe so I’ll try to enable this (or actually both for now) – would this be the best way to ensure that is the case in my myTrunk context with the pjsip.conf file - looking at examples I can just add this in place of what I have above? They have not yet confirmed if having the wrong codec results in a SIP/2.0 488 Not Acceptable Here - yet.

disallow=all
allow=alaw
allow=ulaw

There is also one for the signalling address.

You should always add them if you are behind NAT. (I believe it is possible to use STUN to automate this, but that doesn’t seem to be something people do to any significant extent… It is also possible to compensate at other side, which is what force_rport, symmetric_rtp, and rewrite_contact do, when Asterisk is the other side. However it is always best to send the addresses that the other side can use directly.)

Servers, like SIP ones, work best with static addresses, but can cope with stable dynamic ones. If you ISP vicariously changes IP addresses whilst your connection is up, you are going to have difficulties.

If you DO indeed send an extension and not your public phonenumber as the from and display name, that MIGHT cause them to reject the call. Many providers will only allow you to set caller ID’s that are registered to your user.

Hi everyone, I managed to troubleshoot this with the VOIP provider and there were two issues we identified as below:

Incorrect Codec
As @david551 and @ambiorixg12 recommended to check, I didn’t have the right codec - that was actually the cause of the original issue where I was seeing the SIP/2.0 488 Not Acceptable Here, error in the logs. I needed alaw codec (i.e. a=rtpmap:0 PCMA/8000), presumably as my voip provider for this trunk is based in Europe.

Authentication
The next issue I had was the issue of not authenticating correctly with my voip provider - we were able to identify I needed these two values under the [mytrunk_aors] context in my pjsip.conf

from_user= - e.g., 841698
from_domain= - e.g., sip.provider.com

Thanks for everyones help, appreciate the inputs and support to help resolve this and hope the above helps anyone else in the future!

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