Can’t dial through SIP trunk: FreePBX/Asterisk

asteriskfreepbxtrunkvoip

I set up a SIP TRUNK in FreePBX/Asterisk that works perfectly for incoming calls. Here' s the relevant configuration:

type=friend
host=201.217.31.10
callerid=mynumber
username=595XXYYZZZZZZ@prepago.com.py
authuser=595XXYYZZZZZZ@prepago.com.py
fromuser=595XXYYZZZZZZ
fromdomain=prepago.com.py
secret=******
dtmfmode=auto
trunkname=covoip
context=from-trunk
hasexten=no
hasiax=no
hassip=yes
registeriax=no
registersip=yes
trunkstyle=voip
nat=force_rport,comedia
insecure=port,invite
disallow=all
allow=alaw,ulaw,gsm
qualify=yes

However, whenever I try to place an outgoing call (through the same trunk) I have a "all lines busy" signal from asterisk. If I enable SIP DEBUG this is what I get (apparently my call is being rejected due to an invalid alias at the other side, which I can't control since it's my VOIP provider):

<--- SIP read from UDP:201.217.31.10:5060 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.16.50:5061;received=190.128.230.22;branch=z9hG4bK6a440fdb;rport=5061
From: <sip:595212376741@prepago.com.py>;tag=as3a625f1c
To: <sip:595212376741@prepago.com.py>
Call-ID: 59fbc0e25c141a603114ce2214c9d208@[::1]
CSeq: 180 REGISTER
Contact: <sip:595212376741@192.168.16.50:5061>;expires=30
Expires: 30
User-Agent: FPBX-AsteriskNOW-12.0.33(13.0.1)
Content-Length: 0

<------------->
--- (10 headers 0 lines) ---
[2015-02-19 15:48:50] NOTICE[2015]: chan_sip.c:23725 handle_response_register: Outbound Registration: Expiry for 201.217.31.10 is 30 sec (Scheduling reregistration in 24 s)
Really destroying SIP dialog '59fbc0e25c141a603114ce2214c9d208@[::1]' Method: REGISTER
[2015-02-19 15:48:52] WARNING[1833]: func_cdr.c:349 cdr_write_callback: CDR requires a value (CDR(variable)=value)
Audio is at 16688
Adding codec ulaw to SDP
Adding codec alaw to SDP
Adding codec gsm to SDP
Adding non-codec 0x1 (telephone-event) to SDP
Reliably Transmitting (NAT) to 201.217.31.10:5060:
INVITE sip:0972994988@201.217.31.10 SIP/2.0
Via: SIP/2.0/UDP 192.168.16.50:5061;branch=z9hG4bK61ad8aec;rport
Max-Forwards: 70
From: <sip:595212376741@prepago.com.py:5061>;tag=as23ae8214
To: <sip:0972994988@201.217.31.10>
Contact: <sip:595212376741@192.168.16.50:5061>
Call-ID: 0aa8c50927d37dd15217172e240499c2@prepago.com.py
CSeq: 102 INVITE
User-Agent: FPBX-AsteriskNOW-12.0.33(13.0.1)
Date: Thu, 19 Feb 2015 18:48:52 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Type: application/sdp
Content-Length: 300

v=0
o=root 1709304421 1709304421 IN IP4 192.168.16.50
s=Asterisk PBX 13.0.1
c=IN IP4 192.168.16.50
t=0 0
m=audio 16688 RTP/AVP 0 8 3 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:3 GSM/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=maxptime:150
a=sendrecv

---

<--- SIP read from UDP:201.217.31.10:5060 --->
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 192.168.16.50:5061;received=190.128.230.22;branch=z9hG4bK61ad8aec;rport=5061
From: <sip:595212376741@prepago.com.py:5061>;tag=as23ae8214
To: <sip:0972994988@201.217.31.10>
Call-ID: 0aa8c50927d37dd15217172e240499c2@prepago.com.py
CSeq: 102 INVITE

<------------->
--- (6 headers 0 lines) ---

<--- SIP read from UDP:201.217.31.10:5060 --->
SIP/2.0 404 Not Found
Via: SIP/2.0/UDP 192.168.16.50:5061;received=190.128.230.22;branch=z9hG4bK61ad8aec;rport=5061
From: <sip:595212376741@prepago.com.py:5061>;tag=as23ae8214
To: <sip:0972994988@201.217.31.10>;tag=b72e12N2654e5f93c-504b
Call-ID: 0aa8c50927d37dd15217172e240499c2@prepago.com.py
CSeq: 102 INVITE
Reason: Q.850 ;cause=38 ;text="11017 - Invalid alias"
Content-Length: 0

<------------->
--- (8 headers 0 lines) ---
Transmitting (NAT) to 201.217.31.10:5060:
ACK sip:0972994988@201.217.31.10 SIP/2.0
Via: SIP/2.0/UDP 192.168.16.50:5061;branch=z9hG4bK61ad8aec;rport
Max-Forwards: 70
From: <sip:595212376741@prepago.com.py:5061>;tag=as23ae8214
To: <sip:0972994988@201.217.31.10>;tag=b72e12N2654e5f93c-504b
Contact: <sip:595212376741@192.168.16.50:5061>
Call-ID: 0aa8c50927d37dd15217172e240499c2@prepago.com.py
CSeq: 102 ACK
User-Agent: FPBX-AsteriskNOW-12.0.33(13.0.1)
Content-Length: 0

Any ideas of what might be wrong on my side of things?

If I connect a simple softphone to my VOIP provider, it works flawlessly (incoming and outgoing calls).

Best Answer

38  503 NETWORK_OUT_OF_ORDER    network out of order [Q.850]    This cause indicates that the network is not functioning correctly and that the condition is likely to last a relatively long period of time e.g. immediately re-attempting the call is not likely to be successful.

My guess is that your Caller ID is offending them. Are you setting to anything other than your actual assigned DID?

Based on: