0800 310 1010
← All articles
SIP trunking · 8 min read

Connect FreeSWITCH to a NumberGroup SIP trunk: gateway config that works

Working FreeSWITCH gateway XML for a NumberGroup SIP trunk — sip.numbergroup.com registrar, T-AAAAAA-NNN auth, inbound dialplan that routes by DDI in R-URI, NAT and codec settings.

This is the working setup for adding a NumberGroup SIP trunk to FreeSWITCH (1.10+). It uses our standard register-and-authenticate delivery and the inbound presents the dialled DDI in the Request-URI — so inbound routing in your dialplan is just a regex match on destination_number.

When you ask us to set up the trunk, mention you want the User-Agent Type to "DDI in R-URI (FreeSWITCH)" and Send Numbers As to "International (xx)". That gives FreeSWITCH's default public dialplan a clean destination_number like 441214001262 to regex-match on.

What you'll need from us

The credentials and settings your device needs to register against the NumberGroup SIP trunk are:

  • Domain / registrar: sip.numbergroup.com
  • Authorisation ID (also called SIP username): looks like T-AAAAAA-NNN e.g. T-102377-001
  • Password: a random string we generate per trunk
  • User-Agent Type: we set this our side to match your device (e.g. 3CX Phonesystem, DDI in R-URI (Asterisk), RFC3261 Standard Trunk) so DDIs present in the format your equipment expects
  • Send Numbers As: also set our side — pick the format that works best for your platform:
    • International (+xx) — true E.164 (+441214001262) for 3CX, Cisco, Yealink and most modern PBXs
    • International (xx) — bare digits (441214001262) for Asterisk / FreeSWITCH dialplan regex
    • United Kingdom — UK format (01214001262) for direct-register desk phones / softphones where humans read the Caller ID
  • Allowed IPs (optional): for an extra security layer we can lock the trunk to only register from your office IPs — tell us which when you ask

Once you have the credentials, the rest of this guide walks through the device-side config. If you'd rather skip the config altogether, ask us — we'll do it for you on most common PBXs and phones.

Step 1: create the gateway

Create /etc/freeswitch/sip_profiles/external/numbergroup.xml:

<include>
  <gateway name="numbergroup">
    <param name="username"     value="T-102377-001"/>
    <param name="realm"        value="sip.numbergroup.com"/>
    <param name="from-domain"  value="sip.numbergroup.com"/>
    <param name="password"     value="YOUR_PASSWORD"/>
    <param name="extension"    value="T-102377-001"/>
    <param name="proxy"        value="sip.numbergroup.com"/>
    <param name="register"     value="true"/>
    <param name="register-transport" value="udp"/>
    <param name="expire-seconds" value="600"/>
    <param name="retry-seconds" value="30"/>
    <param name="caller-id-in-from" value="false"/>
    <param name="ping"         value="25"/>
  </gateway>
</include>

Replace T-102377-001 with your Authorisation ID and YOUR_PASSWORD with your trunk password from us.

Step 2: confirm the external profile is good

The default external SIP profile in FreeSWITCH is correct for a typical hosted trunk. Make sure these values are set in sip_profiles/external.xml:

<param name="ext-rtp-ip" value="YOUR.WAN.IP"/>
<param name="ext-sip-ip" value="YOUR.WAN.IP"/>
<param name="rtp-ip" value="0.0.0.0"/>
<param name="sip-ip" value="0.0.0.0"/>
<param name="sip-port" value="5080"/>
<param name="apply-nat-acl" value="nat.auto"/>

If your server has a public IP directly (no NAT) you can use auto for both ext-*-ip values.

Step 3: reload and check registration

fs_cli -x "reloadxml"
fs_cli -x "sofia profile external rescan"
fs_cli -x "sofia status gateway numbergroup"

The status output should show Status: REGED within ~30 seconds. In the NumberGroup portal, refresh the trunk page — the Registered field should switch to "registered".

Step 4: inbound dialplan

Because we set the trunk's User-Agent Type to DDI in R-URI (FreeSWITCH), the dialled DDI lands as destination_number in E.164 form (e.g. 441214001262). Standard FreeSWITCH public dialplan works:

<include>
  <context name="public">
    <!-- Main switchboard number → IVR -->
    <extension name="numbergroup-441214001262">
      <condition field="destination_number" expression="^(441214001262)$">
        <action application="set" data="domain_name=$${'$'}{domain}"/>
        <action application="transfer" data="ivr_main XML default"/>
      </condition>
    </extension>

    <!-- Direct dial straight to extension 100 -->
    <extension name="numbergroup-441214001263">
      <condition field="destination_number" expression="^(441214001263)$">
        <action application="set" data="domain_name=$${'$'}{domain}"/>
        <action application="transfer" data="100 XML default"/>
      </condition>
    </extension>

    <!-- Catch-all while you're testing -->
    <extension name="numbergroup-catchall" continue="false">
      <condition field="destination_number" expression="^(44\d+)$">
        <action application="log" data="INFO Inbound to $${'$'}{destination_number}"/>
        <action application="transfer" data="100 XML default"/>
      </condition>
    </extension>
  </context>
</include>

Step 5: outbound dialplan

Send any UK external call out through the trunk. Edit dialplan/default.xml or your own outbound context:

<extension name="numbergroup-uk-outbound">
  <condition field="destination_number" expression="^(0[1-9]\d{8,10})$">
    <action application="set" data="effective_caller_id_number=441214001262"/>
    <action application="set" data="effective_caller_id_name=YourCompany"/>
    <!-- strip leading 0, prefix 44 -->
    <action application="set" data="dialled_uk=44$${'$'}{regex($${'$'}{destination_number},'^0(.+)$','%1')}"/>
    <action application="bridge" data="sofia/gateway/numbergroup/$${'$'}{dialled_uk}"/>
  </condition>
</extension>

<extension name="numbergroup-international">
  <condition field="destination_number" expression="^00(\d+)$">
    <action application="set" data="effective_caller_id_number=441214001262"/>
    <action application="bridge" data="sofia/gateway/numbergroup/$1"/>
  </condition>
</extension>

The effective_caller_id_number must be one of your registered DDIs in E.164 — otherwise the trunk's Default CLI will be substituted on outbound.

Firewall / NAT

  • UDP 5060–5080 outbound (SIP signalling)
  • UDP 16384–32768 outbound (FreeSWITCH default RTP range)
  • Disable SIP ALG on your router — almost always wrong

Debug commands

fs_cli
> sofia status gateway numbergroup
> sofia status profile external
> sofia loglevel all 9
> show channels
> show calls

Common failure modes

  • Status NOREG / FAIL_WAIT— wrong Auth ID or password, or the realm/proxy doesn't match sip.numbergroup.com.
  • 403 on outbound— your effective Caller ID isn't one of your registered DDIs.
  • Ringing but no audio — NAT issue. Confirm ext-rtp-ip and ext-sip-ip are set to your real WAN IP.
  • 488 Not Acceptable Here— codec mismatch. FreeSWITCH defaults are fine; if you've customised, ensure PCMU (G.711µ) and PCMA (G.711a) are offered.

Lock down fraud caps

Before going live, ask us to set the Fraud Detection limits on the trunk — Simultaneous Calls and Daily Spend 50–100% higher than your real peak. See our UK telecom fraud guide for recommended defaults.

Source: the device navigation in this guide follows FreeSWITCH documentation (FreeSWITCH Explained). We keep the click-path with the manufacturer so it stays current — the NumberGroup trunk values above are the part specific to your account.

SIP trunks at carrier cost

Run your own FreeSWITCH, or let us host a cloud PBX for you — Membership covers SIP trunks (free, up to 25 concurrent calls), unlimited UK numbers, hosted PBX and every smart feature. £149/mo flat.

See what Membership includes →Read the SIP trunking guide →
Related reading