Outbound Calls & Sipgate Trunks

I have a 30 day trial with Sipgate trunking : https://www.sipgatetrunking.co.uk/

I have set it up as per their instructions on page : https://teamhelp.sipgate.co.uk/hc/en-gb/articles/207414635-Asterisk-How-Do-I-Configure-Asterisk-for-sipgate-trunking-

Inbound calls work great but outbound doesn’t work. At the Asterisk console it fails saying “Everyone is busy/congested at this time (1:0/0/1)

In sip.conf I have sipgate configurations as follows…

register => SIP-UID:PASSWORD@sipconnect.sipgate.co.uk/SIP-UID

[sipgate-trunk]
type=peer
host=sipconnect.sipgate.co.uk
outboundproxy=sipconnect.sipgate.co.uk
port=5060
defaultuser=SIP-UID
fromuser=SIP-UID
fromdomain=sipconnect.sipgate.co.uk
secret=PASSWORD
dtmfmode=rfc2833
insecure=port,invite
canreinvite=no
registertimeout=600
disallow=all
allow=alaw
allow=ulaw
qualify=yes
context=inbound

And in extensions.conf I have outdialling like this…

[outbound]
exten => _9X.,1, Set(CDR(customCallTypeId)=6)
        same => n, SIPAddHeader(P-Preferred-Identity:sip:44-NUMBER@sipconnect.sipgate.co.uk)
        same => n, Dial(SIP/sipgate-trunk/44${EXTEN:2})
        same => n, Hangup()

If it helps I have a sip debug for one call which I can attach (not done right now as didn’t want the initial post to be too massive without need).

Based on the above, this should work right?

What’s the reply if you set “core set verbose 3” for an outbound call?

sip set debug peer sipgate-trunk

and then make a test call and post the reply after sip trying 100

Hi. I have captured a new sip debug but unfortunately as a “new user” this forum won’t let me attach it so will have so copy/paste as it below…

====

cbwapbx*CLI> 
Reliably Transmitting (NAT) to 217.10.68.151:5060:
OPTIONS sip:sipconnect.sipgate.co.uk SIP/2.0

Via: SIP/2.0/UDP MY-IP:5060;branch=z9hG4bK531d340d;rport

Max-Forwards: 70

From: "Unknown" <sip:MY-SIPGATE-UID@MY-IP>;tag=as0dcdf032

To: <sip:sipconnect.sipgate.co.uk>

Contact: <sip:MY-SIPGATE-UID@MY-IP:5060>

Call-ID: 4202dd22681deff4207be4c5148ecdfa@MY-IP:5060

CSeq: 102 OPTIONS

User-Agent: CBWA PBX

Date: Fri, 10 Jan 2020 12:10:51 GMT

Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE

Supported: replaces, timer

Content-Length: 0




---

cbwapbx*CLI> 

<--- SIP read from UDP:217.10.68.151:5060 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP MY-IP:5060;branch=z9hG4bK531d340d;rport=5060;received=MY-IP
From: "Unknown" <sip:MY-SIPGATE-UID@MY-IP>;tag=as0dcdf032
To: <sip:sipconnect.sipgate.co.uk>;tag=eec45cbf192f96e819f13ffd30910074.a889
Call-ID: 4202dd22681deff4207be4c5148ecdfa@MY-IP:5060
CSeq: 102 OPTIONS
Accept: */*
Accept-Encoding: 
Accept-Language: en
Supported: 
Content-Length: 0

<------------->

cbwapbx*CLI> 
--- (11 headers 0 lines) ---

cbwapbx*CLI> 
Really destroying SIP dialog '4202dd22681deff4207be4c5148ecdfa@MY-IP:5060' Method: OPTIONS

cbwapbx*CLI> 
       > 0x804c49000 -- Strict RTP learning after remote address set to: 192.168.1.180:13956

cbwapbx*CLI> 
    -- Executing [9444@internal-friend:1] Set("SIP/100-00000009", "CDR(customCallTypeId)=6") in new stack

cbwapbx*CLI> 
    -- Executing [9444@internal-friend:2] Dial("SIP/100-00000009", "SIP/sipgate-trunk/442033933909") in new stack

cbwapbx*CLI> 
Audio is at 16598

cbwapbx*CLI> 
Adding codec alaw to SDP
Adding codec ulaw to SDP
Adding non-codec 0x1 (telephone-event) to SDP

cbwapbx*CLI> 
Reliably Transmitting (NAT) to 217.10.68.151:5060:
INVITE sip:442033933909@sipconnect.sipgate.co.uk:5060 SIP/2.0

Via: SIP/2.0/UDP MY-IP:5060;branch=z9hG4bK26bb6d99;rport

Max-Forwards: 70

From: "Office 01" <sip:MY-SIPGATE-UID@sipconnect.sipgate.co.uk>;tag=as61e2717c

To: <sip:442033933909@sipconnect.sipgate.co.uk:5060>

Contact: <sip:MY-SIPGATE-UID@MY-IP:5060>

Call-ID: 2ab9bff74a0d46fc0999530951b52668@sipconnect.sipgate.co.uk

CSeq: 102 INVITE

User-Agent: CBWA PBX

Date: Fri, 10 Jan 2020 12:11:40 GMT

Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE

Supported: replaces, timer

Content-Type: application/sdp

Content-Length: 275



v=0

o=root 1861610138 1861610138 IN IP4 MY-IP

s=Asterisk PBX 16.1.1

c=IN IP4 MY-IP

t=0 0

m=audio 16598 RTP/AVP 8 0 101

a=rtpmap:8 PCMA/8000

a=rtpmap:0 PCMU/8000

a=rtpmap:101 telephone-event/8000

a=fmtp:101 0-16

a=ptime:20

a=maxptime:150

a=sendrecv


---
    -- Called SIP/sipgate-trunk/442033933909

cbwapbx*CLI> 

<--- SIP read from UDP:217.10.68.151:5060 --->
SIP/2.0 404 Not found (no match)
Via: SIP/2.0/UDP MY-IP:5060;received=MY-IP;branch=z9hG4bK26bb6d99;rport=5060
From: "Office 01" <sip:MY-SIPGATE-UID@sipconnect.sipgate.co.uk>;tag=as61e2717c
To: <sip:442033933909@sipconnect.sipgate.co.uk:5060>;tag=ca40b14695a455acdff6b4fb6f6d0a8e.9478
Call-ID: 2ab9bff74a0d46fc0999530951b52668@sipconnect.sipgate.co.uk
CSeq: 102 INVITE
Content-Length: 0

<------------->

cbwapbx*CLI> 
--- (7 headers 0 lines) ---

cbwapbx*CLI> 
Transmitting (NAT) to 217.10.68.151:5060:
ACK sip:442033933909@sipconnect.sipgate.co.uk:5060 SIP/2.0

Via: SIP/2.0/UDP MY-IP:5060;branch=z9hG4bK26bb6d99;rport

Max-Forwards: 70

From: "Office 01" <sip:MY-SIPGATE-UID@sipconnect.sipgate.co.uk>;tag=as61e2717c

To: <sip:442033933909@sipconnect.sipgate.co.uk:5060>;tag=ca40b14695a455acdff6b4fb6f6d0a8e.9478

Contact: <sip:MY-SIPGATE-UID@MY-IP:5060>

Call-ID: 2ab9bff74a0d46fc0999530951b52668@sipconnect.sipgate.co.uk

CSeq: 102 ACK

User-Agent: CBWA PBX

Content-Length: 0




---

cbwapbx*CLI> 
Scheduling destruction of SIP dialog '2ab9bff74a0d46fc0999530951b52668@sipconnect.sipgate.co.uk' in 6400 ms (Method: INVITE)

cbwapbx*CLI> 
  == Everyone is busy/congested at this time (1:0/0/1)

cbwapbx*CLI> 
    -- Executing [9444@internal-friend:3] Hangup("SIP/100-00000009", "") in new stack
  == Spawn extension (internal-friend, 9444, 3) exited non-zero on 'SIP/100-00000009'
    -- Executing [h@internal-friend:1] Hangup("SIP/100-00000009", "") in new stack
  == Spawn extension (internal-friend, h, 1) exited non-zero on 'SIP/100-00000009'

cbwapbx*CLI> 
       > 0x804cc9000 -- Strict RTP learning after remote address set to: 192.168.1.180:63162

cbwapbx*CLI> 
    -- Executing [9444@internal-friend:1] Set("SIP/100-0000000b", "CDR(customCallTypeId)=6") in new stack

cbwapbx*CLI> 
    -- Executing [9444@internal-friend:2] Dial("SIP/100-0000000b", "SIP/sipgate-trunk/442033933909") in new stack

cbwapbx*CLI> 
Audio is at 24518

cbwapbx*CLI> 
Adding codec alaw to SDP
Adding codec ulaw to SDP
Adding non-codec 0x1 (telephone-event) to SDP

cbwapbx*CLI> 
Reliably Transmitting (NAT) to 217.10.68.151:5060:
INVITE sip:442033933909@sipconnect.sipgate.co.uk:5060 SIP/2.0

Via: SIP/2.0/UDP MY-IP:5060;branch=z9hG4bK2561ded4;rport

Max-Forwards: 70

From: "Office 01" <sip:MY-SIPGATE-UID@sipconnect.sipgate.co.uk>;tag=as3d532cc9

To: <sip:442033933909@sipconnect.sipgate.co.uk:5060>

Contact: <sip:MY-SIPGATE-UID@MY-IP:5060>

Call-ID: 0483eba914ce37412520bf1223938030@sipconnect.sipgate.co.uk

CSeq: 102 INVITE

User-Agent: CBWA PBX

Date: Fri, 10 Jan 2020 12:11:46 GMT

Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE

Supported: replaces, timer

Content-Type: application/sdp

Content-Length: 275



v=0

o=root 1399759291 1399759291 IN IP4 MY-IP

s=Asterisk PBX 16.1.1

c=IN IP4 MY-IP

t=0 0

m=audio 24518 RTP/AVP 8 0 101

a=rtpmap:8 PCMA/8000

a=rtpmap:0 PCMU/8000

a=rtpmap:101 telephone-event/8000

a=fmtp:101 0-16

a=ptime:20

a=maxptime:150

a=sendrecv


---
    -- Called SIP/sipgate-trunk/442033933909

cbwapbx*CLI> 

<--- SIP read from UDP:217.10.68.151:5060 --->
SIP/2.0 404 Not found (no match)
Via: SIP/2.0/UDP MY-IP:5060;received=MY-IP;branch=z9hG4bK2561ded4;rport=5060
From: "Office 01" <sip:MY-SIPGATE-UID@sipconnect.sipgate.co.uk>;tag=as3d532cc9
To: <sip:442033933909@sipconnect.sipgate.co.uk:5060>;tag=ca40b14695a455acdff6b4fb6f6d0a8e.9478
Call-ID: 0483eba914ce37412520bf1223938030@sipconnect.sipgate.co.uk
CSeq: 102 INVITE
Content-Length: 0

<------------->

cbwapbx*CLI> 
--- (7 headers 0 lines) ---

cbwapbx*CLI> 
Transmitting (NAT) to 217.10.68.151:5060:
ACK sip:442033933909@sipconnect.sipgate.co.uk:5060 SIP/2.0

Via: SIP/2.0/UDP MY-IP:5060;branch=z9hG4bK2561ded4;rport

Max-Forwards: 70

From: "Office 01" <sip:MY-SIPGATE-UID@sipconnect.sipgate.co.uk>;tag=as3d532cc9

To: <sip:442033933909@sipconnect.sipgate.co.uk:5060>;tag=ca40b14695a455acdff6b4fb6f6d0a8e.9478

Contact: <sip:MY-SIPGATE-UID@MY-IP:5060>

Call-ID: 0483eba914ce37412520bf1223938030@sipconnect.sipgate.co.uk

CSeq: 102 ACK

User-Agent: CBWA PBX

Content-Length: 0




---

cbwapbx*CLI> 
Scheduling destruction of SIP dialog '0483eba914ce37412520bf1223938030@sipconnect.sipgate.co.uk' in 6400 ms (Method: INVITE)

cbwapbx*CLI> 
  == Everyone is busy/congested at this time (1:0/0/1)

cbwapbx*CLI> 
    -- Executing [9444@internal-friend:3] Hangup("SIP/100-0000000b", "") in new stack
  == Spawn extension (internal-friend, 9444, 3) exited non-zero on 'SIP/100-0000000b'

cbwapbx*CLI> 
    -- Executing [h@internal-friend:1] Hangup("SIP/100-0000000b", "") in new stack

cbwapbx*CLI> 
  == Spawn extension (internal-friend, h, 1) exited non-zero on 'SIP/100-0000000b'

cbwapbx*CLI> 
Really destroying SIP dialog '2ab9bff74a0d46fc0999530951b52668@sipconnect.sipgate.co.uk' Method: INVITE

cbwapbx*CLI> 
[2020-01-10 12:11:51] NOTICE[100404]: chan_sip.c:15821 int sip_reregister(const void *):    -- Re-registration for  MY-SIPGATE-UID@sipconnect.sipgate.co.uk

cbwapbx*CLI> 
REGISTER 12 headers, 0 lines
Reliably Transmitting (no NAT) to 217.10.68.151:5060:
REGISTER sip:sipconnect.sipgate.co.uk SIP/2.0

Via: SIP/2.0/UDP MY-IP:5060;branch=z9hG4bK372fd202

Max-Forwards: 70

From: <sip:MY-SIPGATE-UID@sipconnect.sipgate.co.uk>;tag=as01072e6b

To: <sip:MY-SIPGATE-UID@sipconnect.sipgate.co.uk>

Call-ID: 1c99fab6263696637c81c46630d7bfd0@127.0.0.1

CSeq: 2126 REGISTER

Supported: replaces, timer

User-Agent: CBWA PBX

Authorization: Digest username="MY-SIPGATE-UID", realm="sipconnect.sipgate.co.uk", algorithm=MD5, uri="sip:sipconnect.sipgate.co.uk", nonce="XhhqYF4YaTTNCE518lzjdF0PcPyRH9S6", response="8056b871425b31eab326a6e14076bac5"

Expires: 120

Contact: <sip:MY-SIPGATE-UID@MY-IP:5060>

Content-Length: 0




---

Well your original dialplan had a line setting a SIP header for the P-Preferred-Identity, which is what they want I assume for authing, but your trace doesn’t show that header being set in the dialplan or the SIP message. It just sets your CDR field and dial()'s out. What happened to that PPI header?

We have been trying a few things but to no avail. My apologies for not updating everything. The P-Preferred-Identify is apparently only if we want to change the outbound CLI which we cannot actually do in reality, their system ignores it.

Just to ensure I have the latest and greatest configs, the sip debug above is from the config below and apologies again.

The number 442033933909 is a number they asked us to use for testing (just to eliminate the calls maybe not connecting to mobiles etc)

SIP.CONF

register => SIPGATE-UID:PASSWORD@sipconnect.sipgate.co.uk/SIPGATE-UID

[sipgate-trunk]
type=peer
host=sipconnect.sipgate.co.uk
outboundproxy=sipconnect.sipgate.co.uk
port=5060
defaultuser=SIPGATE-UID
fromuser=SIPGATE-UID
fromdomain=sipconnect.sipgate.co.uk
secret=PASSWORD
dtmfmode=rfc2833
insecure=port,invite
canreinvite=no
registertimeout=600
disallow=all
allow=alaw
allow=ulaw
qualify=yes
context=inbound

EXTENSIONS.CONF

[outbound]
exten => _9X.,1, Set(CDR(customCallTypeId)=6)
        ;same => n, Set(CALLERID(num)=SIPGATE-UID)
        ;same => n, SIPAddHeader(P-Preferred-Identity:sip:44SIPGATECLI@sipconnect.sipgate.co.uk)
        same => n, Dial(SIP/sipgate-trunk/442033933909)
        same => n, Hangup()

Your provider is signaling that the number is not found.

It may be because you are not sending the header they are requesting with the caller ID of your account.

For outgoing calls, please enter the sender number in E.164 format (i.e. international format without the leading zeros or plus (+) sign) as a new header P-Preferred-Identity:

 SIPAddHeader(P-Preferred-Identity: <sip: **4420300000000** @sipconnect.sipgate.co.uk>)

Could it be they are expecting E.164 format for the dialed number?

I prefer copy and paste, so I don’t have to go and open up another page.

It would be worth playing with that suggestion, thank you.

To be honest the provider is really slow with any help and hasn’t really looked into what I have sent them and to top it, my trial numbers have expired today so I can’t run tests properly now until sorted and get to the site where the PBX is which will probably be next week. I don’t like keeping asking the users to “test now… test again… just changed something, try again” :slight_smile:

Quick update and a simple fix after all that. Their documentation wasn’t clear and seemed to want the outbound dial to use E.164 format but without the + sign. I have stuck the + sign in and it now dials out.

I thought I had tried the + sign at some point during the testing but can only now assume that if I did I had some other fault at the time. The outbound context now looks like this…

[outbound]
exten => _9X.,1, Set(CDR(customCallTypeId)=6)
        same => n, Dial(SIP/sipgate-trunk/+44${EXTEN:2})
        same => n, Hangup()

Anyway, appreciate you guys having a look with me.

1 Like

Just an FYI, E.164 format always includes the +