SIP Trunk Connection issue

Hello, i am able to connect x-lite softphone with my sip provider, but while trying to connect the same sip provider from asterisk using the same credentials, i am getting status as UNREACHABLE in sip show peers.
X-lite setup:

Can someone suggest me what configuration should i use in sip.conf to reflect this same configuration.

Thanks.

Please provide the Asterisk configuratoin

Hi David,

Thanks for the response. I have tried many configurations on asterisk and none seems to work. This is my latest configuration file:

[general]
;defaultexpiry=600
;progressinband=yes
port=5060
disallow=all
allow=alaw,ulaw,gsm,g729
;bindport=5060
sendrpid=yes
trustrpid=yes
context=default
alwaysauthreject=yes
qualify=yes
allowguest=no

[mycon]
type=friend
;callerid=01205080601
defaultuser=01205080601
outboundproxy=10.224.229.68
;outboundproxyport=5060
;fromuser=01205080601
secret=
disallow=all
allow=alaw
allow=ulaw
allow=gsm
allow=g729
host=10.224.229.68
canreinvite=no
context=mycontext
insecure=port,invite
directrtpsetup=no
directmedia=no
nat=no

You don’t have an outbound proxy.

canreinvite and directmedia conflict; they both set the same internal parameter. Remoe canreinvite.

For best practice, replace friend by peer, and secret=???; insecure=port,invite by remotesecret=??? (unless you have a valid reason to need insecure=port).

Then use sip set debug on, to get a log of session setup attempt, if it is still failing.

Hi David,

I have used outboundproxy in the peer section. Also made the changes you suggested, still no luck. New sip.conf looks like this:

[general]
defaultexpiry=600
progressinband=yes
port=5060
disallow=all
allow=alaw,ulaw,gsm,g729
sendrpid=yes
trustrpid=yes
context=default
alwaysauthreject=yes
qualify=yes
allowguest=no

[mycon]
type=peer
defaultuser=01205080601
outboundproxy=10.224.229.68
secret=
disallow=all
allow=alaw
allow=ulaw
allow=gsm
allow=g729
host=10.224.229.68
context=vodafone
insecure=invite
directrtpsetup=no
directmedia=no
nat=no

Secret field is blank because sip provider does not need a password. Even on my x-lite setup, the password field was blank.

This is the console output from sip set debug on:

Retransmitting #1 (no NAT) to 10.224.229.68:5060:
OPTIONS sip:10.224.229.68 SIP/2.0
Via: SIP/2.0/UDP 10.224.227.57:5060;branch=z9hG4bK4c0f993a
Max-Forwards: 70
From: “asterisk” sip:asterisk@10.224.227.57;tag=as356f1826
To: sip:10.224.229.68
Contact: sip:asterisk@10.224.227.57:5060
Call-ID: 358bceae3a7de3d96c2b32e708a07234@10.224.227.57:5060
CSeq: 102 OPTIONS
User-Agent: Asterisk PBX 15.6.2
Date: Tue, 04 Dec 2018 09:50:42 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Length: 0

Set qualify to no.

If you need to provide more logging, please note that we expect a lot more than just a single retransmission.

Thank you for your precious time David.
Have now set qualify to no.
Also find the sip logs below:

digivolgs-netmagic-1CLI> sip set debug on
SIP Debugging enabled
digivolgs-netmagic-1
CLI>
digivolgs-netmagic-1CLI>
digivolgs-netmagic-1
CLI>
digivolgs-netmagic-1*CLI> originate SIP/9999077283@mycon application playback hello-world
Audio is at 17656
Adding codec alaw to SDP
Adding codec ulaw to SDP
Adding codec gsm to SDP
Adding codec g729 to SDP
Adding non-codec 0x1 (telephone-event) to SDP
Reliably Transmitting (no NAT) to 10.224.229.68:5060:
INVITE sip:9999077283@10.224.229.68 SIP/2.0
Via: SIP/2.0/UDP 10.224.227.57:5060;branch=z9hG4bK31a320f5
Max-Forwards: 70
From: “Anonymous” sip:anonymous@anonymous.invalid;tag=as0ef986f2
To: sip:9999077283@10.224.229.68
Contact: sip:anonymous@10.224.227.57:5060
Call-ID: 6207bdbb10822bcc27f39aa558b1761c@10.224.227.57:5060
CSeq: 102 INVITE
User-Agent: Asterisk PBX 15.6.2
Date: Tue, 04 Dec 2018 10:36:46 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Type: application/sdp
Content-Length: 347

v=0
o=root 1316566321 1316566321 IN IP4 10.224.227.57
s=Asterisk PBX 15.6.2
c=IN IP4 10.224.227.57
t=0 0
m=audio 17656 RTP/AVP 8 0 3 18 101
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:3 GSM/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


Retransmitting #1 (no NAT) to 10.224.229.68:5060:
INVITE sip:9999077283@10.224.229.68 SIP/2.0
Via: SIP/2.0/UDP 10.224.227.57:5060;branch=z9hG4bK31a320f5
Max-Forwards: 70
From: “Anonymous” sip:anonymous@anonymous.invalid;tag=as0ef986f2
To: sip:9999077283@10.224.229.68
Contact: sip:anonymous@10.224.227.57:5060
Call-ID: 6207bdbb10822bcc27f39aa558b1761c@10.224.227.57:5060
CSeq: 102 INVITE
User-Agent: Asterisk PBX 15.6.2
Date: Tue, 04 Dec 2018 10:36:46 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Type: application/sdp
Content-Length: 347

v=0
o=root 1316566321 1316566321 IN IP4 10.224.227.57
s=Asterisk PBX 15.6.2
c=IN IP4 10.224.227.57
t=0 0
m=audio 17656 RTP/AVP 8 0 3 18 101
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:3 GSM/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


Retransmitting #2 (no NAT) to 10.224.229.68:5060:
INVITE sip:9999077283@10.224.229.68 SIP/2.0
Via: SIP/2.0/UDP 10.224.227.57:5060;branch=z9hG4bK31a320f5
Max-Forwards: 70
From: “Anonymous” sip:anonymous@anonymous.invalid;tag=as0ef986f2
To: sip:9999077283@10.224.229.68
Contact: sip:anonymous@10.224.227.57:5060
Call-ID: 6207bdbb10822bcc27f39aa558b1761c@10.224.227.57:5060
CSeq: 102 INVITE
User-Agent: Asterisk PBX 15.6.2
Date: Tue, 04 Dec 2018 10:36:46 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Type: application/sdp
Content-Length: 347

v=0
o=root 1316566321 1316566321 IN IP4 10.224.227.57
s=Asterisk PBX 15.6.2
c=IN IP4 10.224.227.57
t=0 0
m=audio 17656 RTP/AVP 8 0 3 18 101
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:3 GSM/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


Retransmitting #5 (no NAT) to 10.224.229.68:5060:
INVITE sip:9999077283@10.224.229.68 SIP/2.0
Via: SIP/2.0/UDP 10.224.227.57:5060;branch=z9hG4bK10a28a58
Max-Forwards: 70
From: “Anonymous” sip:anonymous@anonymous.invalid;tag=as6d2b6721
To: sip:9999077283@10.224.229.68
Contact: sip:anonymous@10.224.227.57:5060
Call-ID: 4309f34b6ef7b4864479db78395626ab@10.224.227.57:5060
CSeq: 102 INVITE
User-Agent: Asterisk PBX 15.6.2
Date: Tue, 04 Dec 2018 10:36:33 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Type: application/sdp
Content-Length: 347

v=0
o=root 1704643263 1704643263 IN IP4 10.224.227.57
s=Asterisk PBX 15.6.2
c=IN IP4 10.224.227.57
t=0 0
m=audio 19334 RTP/AVP 8 0 3 18 101
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:3 GSM/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


Retransmitting #3 (no NAT) to 10.224.229.68:5060:
INVITE sip:9999077283@10.224.229.68 SIP/2.0
Via: SIP/2.0/UDP 10.224.227.57:5060;branch=z9hG4bK31a320f5
Max-Forwards: 70
From: “Anonymous” sip:anonymous@anonymous.invalid;tag=as0ef986f2
To: sip:9999077283@10.224.229.68
Contact: sip:anonymous@10.224.227.57:5060
Call-ID: 6207bdbb10822bcc27f39aa558b1761c@10.224.227.57:5060
CSeq: 102 INVITE
User-Agent: Asterisk PBX 15.6.2
Date: Tue, 04 Dec 2018 10:36:46 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Type: application/sdp
Content-Length: 347

v=0
o=root 1316566321 1316566321 IN IP4 10.224.227.57
s=Asterisk PBX 15.6.2
c=IN IP4 10.224.227.57
t=0 0
m=audio 17656 RTP/AVP 8 0 3 18 101
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:3 GSM/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


Retransmitting #4 (no NAT) to 10.224.229.68:5060:
INVITE sip:9999077283@10.224.229.68 SIP/2.0
Via: SIP/2.0/UDP 10.224.227.57:5060;branch=z9hG4bK31a320f5
Max-Forwards: 70
From: “Anonymous” sip:anonymous@anonymous.invalid;tag=as0ef986f2
To: sip:9999077283@10.224.229.68
Contact: sip:anonymous@10.224.227.57:5060
Call-ID: 6207bdbb10822bcc27f39aa558b1761c@10.224.227.57:5060
CSeq: 102 INVITE
User-Agent: Asterisk PBX 15.6.2
Date: Tue, 04 Dec 2018 10:36:46 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Type: application/sdp
Content-Length: 347

v=0
o=root 1316566321 1316566321 IN IP4 10.224.227.57
s=Asterisk PBX 15.6.2
c=IN IP4 10.224.227.57
t=0 0
m=audio 17656 RTP/AVP 8 0 3 18 101
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:3 GSM/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

The invite isn’t reaching the other side, or the response isn’t getting back to you.

Is 10.224.229.68 reachable from 10.224.227.57?

Does the firewall on 10…224.227.57 permit incoming traffic to 5060/UDP?

i am able to telnet 10.224.229.68 on port 5060 from 10.224.227.57. Also the ufw service is disabled on 10.224.227.57, so it should be allowing incoming traffic from 10.224.229.68. Any ideas how to test this?

telnet does not use UDP.

Please set qualify=no on the peer section and re try

They’ve already changed qualify. Before that they weren’t getting beyond retransmitted OPTIONS.

They may want to re-enable qualify, once they have found the real problem.

Yes I see it now , you have requested it before.

okay the problem is because my sip provider has given us a ethernet cable only for their sip connections and the server has another ethernet cable for all other internet connections. We are unable to set this in ubuntu’s network/interfaces as both the ethernets have different gateways. Too much confused now.