Monday, March 16, 2020

Rogers SIP connection on Asterisk

Rogers Business SIP service (Canada) to asterisk (FreePBX Distro/ Centos7)
Also a method of using multiple NICS on a single linux box for asterisk

Here's what I did to get Rogers Dedicated business SIP service connected to Asterisk

Their service is pretty straight forward to connect.  We had a dedicated router dropped in, we plugged the Ethernet connection into our PBX.

Here's an example of an asterisk PBX.  
ETH0 is connected to your local LAN (and Internet) and default gateway
ETH1 is connected to the Rogers router, and configured with their designated internal 10.0.30.0/29 address

They are going to give you a private IP to configure on your SBC/network/PBX

The PRIVATE side IP they gave me to use was:

Rogers IP: 10.0.30.137 / 29
Company IP: 10.0.30.138 - 10.0.30.142/29

Their SIP gateways were 

173.46.30.202

My example, i'm connecting their private circuit directly to my asterisk PBX on its own Ethernet port ETH1

My PBX was established already with ETH0 already assigned to 10.1.100.59
So the config looks like this for my PBX.

[root@pbx-07 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
BOOTPROTO="static"
BROADCAST="10.1.100.255"
DNS1="10.1.100.80"
GATEWAY="10.1.100.1"
HWADDR="00:15:1D:06:08:1F"
IPADDR="10.1.100.59"
NETMASK="255.255.255.0"
NM_CONTROLLED="yes"
ONBOOT="yes"
TYPE="Ethernet"
UUID="a1210692-da12-417d-862e-152ffb8ab93c"
ZONE=internal
DESCRIPTION="LAN"

I setup a new NIC on my server, ETH1 the network config for Rogers on it looks like this:

[root@pbx-07 ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth1
DEVICE=eth1
BOOTPROTO=static
ONBOOT='yes'
IPADDR=10.0.30.138
NETMASK=255.255.255.248
ZONE=external
DESCRIPTION="ROGERS"

You'll notice that there is NO GATEWAY.  You don't want to assign multiple gateways, it will confuse things.  We keep the primary gateway on whatever direction your internet will actually go on, or the main network.

So now you'll have something like this once you save your changes and restart your networking

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 00:11:51:01:11:2f brd ff:ff:ff:ff:ff:ff
    inet 10.1.100.59/24 brd 10.1.100.255 scope global eth0
    inet6 fe80::215:5dff:fe06:182f/64 scope link
       valid_lft forever preferred_lft forever
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 00:11:51:16:11:31 brd ff:ff:ff:ff:ff:ff
    inet 10.0.30.138/29 brd 10.0.30.31 scope global eth1
    inet6 fe80::215:5dff:fe06:1830/64 scope link
       valid_lft forever preferred_lft forever

Now we need to get to their PBX gateways.  They use the 173.46.30.0/24 network, and although it might be possible for you to trace/ping to that IP via internet, you'll need to access it via their private network they have installed FROM the private IP address they have assigned to you.

Since we want this particular network to go out ETH1 towards the Rogers network, we'll need to put in a ROUTE to tell your asterisk PBX that any traffic to/from that network comes via ETH1 (not ETH0 which is your likely default gateway)

Type this command into your CLI

route add -net 173.46.30.0 netmask 255.255.255.0 gw 10.0.30.137 dev eth1

You should now be able to traceroute to that IP, and the traffic should pass across the 10.0.30 subnet

[root@pbx-07 ~]# traceroute 173.46.30.202
traceroute to 173.46.30.202 (173.46.30.202), 30 hops max, 60 byte packets

 1  10.0.30.137 (10.0.30.137)  0.514 ms  0.492 ms  0.480 ms


Well this is good, but this route isn't persistent.  You'll need to make sure it re-establishes that route if you need to reboot.  

To make it persistent, create the following file /etc/sysconfig/network-scripts/route-eth1

and then add in the information below.
GATEWAY0=10.0.30.137
NETMASK0=255.255.255.0
ADDRESS0=173.46.30.0

Save your changes.

MAKE SURE YOU HAVE THE SYNTAX EXACTLY RIGHT, ELSE IT WILL FAIL

Now your trunk config in asterisk.

I did mine in FreePBX, so this is what my FreePBX trunk looks like:

I created a SIP trunk and this is the PEER DETAILS for the trunk.
(if anyone reading has suggestions to tweek these details please leave a comment!)

You don't need anything in INCOMING or registration string.

Make sure you have valid SIP networking in place.  I'm using FreePBX so you'll want to make sure asterisk knows that its a valid sip domain



Create an outbound route for Rogers, you'll need to dial all 10 digits for calls.

Now setup an INBOUND routes for your Rogers connection.

Likely the numbers are going to come in as full 10 digit numbers so it would look something like

You should be all done!

From the Asterisk CLI you can issue the command

sip show peers

the response would be something like:

Name/username Host                  Dyn Forcerport Comedia  ACL Port     Status    
T33ROG01         173.46.30.202        Yes  Yes                              5060     OK (40 ms)
T34ROG02         173.46.30.218        Yes  Yes                              5060     OK (31 ms)

1 comment:

  1. Exelent, also can you see on cli route -n
    your 0.0.0.0 gateway ip

    ReplyDelete

Feel free to leave a comment! If you have any information that you think should be included, please do so here and I'll get it added in.