Skip to content
SIPTrunkHub

Setup guide · Provider trunk

Connect a SIP trunk to MagnusBilling

MagnusBilling is an Asterisk-based billing softswitch. You add SIPTrunkHub as a provider, create a trunk for it, put the trunk in a trunk group, and point your plan’s rates at that group. Your customers then dial through MagnusBilling and the calls leave via us.

Before you start

What you need

  • MagnusBilling 7 with admin access to the web panel
  • The server’s public IP (we whitelist it)
  • Your SIPTrunkHub account details: SIP server, auth method, tech prefix if any
  • An existing plan, or permission to create one

IP auth or register auth?

IP authentication

Recommended

Recommended. We whitelist the MagnusBilling server IP. Set Register trunk to No and leave username and password empty.

Register (digest) authentication

Set Register trunk to Yes and fill in username and password. MagnusBilling builds the register line for you.

Step by step

Configure MagnusBilling

sip.example-host.net and 203.0.113.10 are documentation placeholders. Replace them, and the username, password and tech prefix, with the values from your account.

  1. 01

    Add the provider

    Routes › Providers › Add. Enter SIPTrunkHub as the provider name and a short description. Providers group trunks for reporting.

  2. 02

    Add the trunk

    Routes › Trunks › Add. Select the provider and fill in the fields below. The trunk code is the trunk’s internal name. Leave Add prefix empty unless your account uses a tech prefix.

    Trunk (field → value)
    Provider .............. SIPTrunkHub
    Trunk code ............ siptrunkhub
    Username .............. YOUR_SIP_USERNAME   (register auth only)
    Password .............. YOUR_SIP_PASSWORD   (register auth only)
    Host .................. sip.example-host.net
    Add prefix ............ 1234#               (tech prefix, if any)
    Remove prefix ......... (blank)
    Codec ................. g729,ulaw,alaw  →  set ulaw,alaw,g729
    Provider tech ......... sip
    Status ................ Active
    Register trunk ........ No | Yes
    Max use ............... 30                  (your channel limit)
    Failover trunk ........ (optional second trunk)
  3. 03

    Check the supplementary settings

    On the trunk’s supplementary tab confirm the SIP options. These map straight to the generated Asterisk peer.

    Supplementary info
    Context ............... billing
    DTMF mode ............. RFC2833
    Insecure .............. port,invite
    NAT ................... force_rport,comedia
    Directmedia ........... no
    Qualify ............... yes
    Sendrpid .............. pai
    Fromdomain ............ sip.example-host.net
  4. 04

    Create a trunk group

    Routes › Trunk Groups › Add. Name it, choose the order type (Order for primary/backup, Random to spread load) and add the siptrunkhub trunk. Add a second trunk here for failover.

  5. 05

    Point rates at the trunk group

    Rates › Tariffs (Rates). For each prefix in your plan, set Trunk group to the group you just created and enter your sell price. Prefixes themselves only hold the number and destination name; the routing lives on the rate.

    Rate (field → value)
    Plan .................. Retail A-Z
    Prefix ................ 44 (United Kingdom)
    Trunk group ........... SIPTrunkHub-Primary
    Sell price ............ 0.0120   (example — your retail rate)
    Initial block ......... 1
    Billing block ......... 1
  6. 06

    Number format and DIDs

    Dial in E.164 without +. If customers dial 00, use Remove prefix 00 on the trunk, or handle it with your customers’ SIP account tech prefix. For inbound, add each DID under DIDs › DIDs, then under DID Destination point it at the customer’s SIP account (for example SIP/customer1001).

Media

Codec order

  • MagnusBilling writes the trunk Codec field into the Asterisk peer allow line. Order it ulaw,alaw,g729.
  • Make sure customers’ SIP accounts share at least one codec with the trunk to avoid transcoding on the billing server.
  • G.729 needs the codec module on the MagnusBilling server.

NAT notes

  • MagnusBilling is normally installed on a public IP. If not, set externip and localnet in the Asterisk SIP settings.
  • Keep NAT force_rport,comedia and Directmedia no on the trunk so media stays anchored on the server.
  • Open UDP 5060 and RTP 10000–20000 inbound from our IPs. Check the server firewall (iptables / fail2ban) whitelists 203.0.113.10.

Verify

Test the trunk

Check the peer and registration from the Asterisk CLI, then make a test call from a customer SIP account and look it up in Reports › CDR. Failed attempts show in Reports › CDR Failed with the SIP cause.

MagnusBilling server shell
asterisk -rx "sip show peer siptrunkhub"
asterisk -rx "sip show registry"
asterisk -rx "sip set debug peer siptrunkhub"
tail -f /var/log/asterisk/messages

Troubleshooting

Common SIP errors

What each response means and what to check first on MagnusBilling. If you still need help, send the Call-ID and timestamp to the NOC.

Common SIP error codes and fixes for MagnusBilling
CodeMeaningLikely causeFix on MagnusBilling
401UnauthorizedWe challenged the INVITE or REGISTER and the credentials were wrong or missing. With IP auth it usually means the call arrived from an IP we have not whitelisted.Check the username, password and auth realm. For IP auth, confirm the public IP your PBX actually sends from matches the one on your account.
403ForbiddenAuthenticated, but not allowed: wrong or missing tech prefix, zero prepaid balance, destination blocked on your account, or an invalid caller ID.Check that Add prefix matches your tech prefix exactly, including the # if there is one.
404Not FoundThe dialled number is not in a format we can route: missing country code, an extra 00 or +, or a local trunk prefix left in.The number still has 00 or a customer tech prefix in front. Use Remove prefix on the trunk.
408Request TimeoutNo response came back. Usually a firewall, wrong port or transport, a DNS failure, or SIP ALG on the router eating packets.Confirm UDP/TCP 5060 is open outbound and to 203.0.113.10. Disable SIP ALG. Test with an OPTIONS ping.
480Temporarily UnavailableThe far end could not be reached: handset off, out of coverage, or the route for that prefix is temporarily down.Retry later or route to another trunk. If it hits one prefix repeatedly, send examples to the NOC.
486Busy HereThe called party is busy, or you reached the concurrent-channel limit on your account.If every call returns busy, Max use on the trunk may be lower than your traffic.
503Service UnavailableCapacity limit hit (calls per second or channels), or every route for that destination failed.Over your CPS or channel limit. Lower Max use to your account limit so MagnusBilling fails over instead.

Seeing one-way audio instead of an error? Read One-Way Audio on VoIP Calls.

FAQ

MagnusBilling questions

Why does Reports › CDR show the call but not the cost?

The rate for that prefix has no trunk group or no sell price. Check Rates for that prefix in the customer’s plan.

Can I resell SIPTrunkHub routes to my own customers?

Yes. That is what MagnusBilling is for. See our reseller program for wholesale pricing and white-label support.

How do I add failover?

Either set Failover trunk on the trunk itself, or put two trunks in the trunk group with order type Order.

Related

Other setup guides

All 12 guides

Popular destinations

Stuck on a step?

The NOC answers 24/7. Send your platform, a SIP trace and the Call-ID of a failed attempt.

Ready to connect MagnusBilling?

Prepaid from $200. No setup fee, no contract. Get rates and your account details from sales.