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
[email protected]
[email protected]
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:[email protected]>;tag=as3a625f1c
To: <sip:[email protected]>
Call-ID: 59fbc0e25c141a603114ce2214c9d208@[::1]
CSeq: 180 REGISTER
Contact: <sip:[email protected]: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:[email protected] SIP/2.0
Via: SIP/2.0/UDP 192.168.16.50:5061;branch=z9hG4bK61ad8aec;rport
Max-Forwards: 70
From: <sip:[email protected]:5061>;tag=as23ae8214
To: <sip:[email protected]>
Contact: <sip:[email protected]:5061>
Call-ID: [email protected]
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:[email protected]:5061>;tag=as23ae8214
To: <sip:[email protected]>
Call-ID: [email protected]
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:[email protected]:5061>;tag=as23ae8214
To: <sip:[email protected]>;tag=b72e12N2654e5f93c-504b
Call-ID: [email protected]
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:[email protected] SIP/2.0
Via: SIP/2.0/UDP 192.168.16.50:5061;branch=z9hG4bK61ad8aec;rport
Max-Forwards: 70
From: <sip:[email protected]:5061>;tag=as23ae8214
To: <sip:[email protected]>;tag=b72e12N2654e5f93c-504b
Contact: <sip:[email protected]:5061>
Call-ID: [email protected]
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).
My guess is that your Caller ID is offending them. Are you setting to anything other than your actual assigned DID?
Based on:
This is a know bug from Asterisk when you use the non standard sip port 5060 for your server. The bug is discussed here https://issues.asterisk.org/jira/browse/ASTERISK-24767 .
You should be able to correct this using fromdomain=prepago.com.py:5060 but Asterisk ignores the directive port and rewrite the from as From: "sip:[email protected]:5061". You can patch Asterisk code and recompile it or use the standard sip port in your server.