📜 ⬆️ ⬇️

Step-by-step guide on binding SIP-numbers to Elastix (FreePBX, Asterisk) on the example of the provider Megaline iDPhone

Good day to all.


IP telephony is generally quite an interesting thing, but for a person who has encountered such a system for the first time, the setup process may seem frighteningly difficult. You can read more about how and why to install software IP PBXs somewhere (good information on this issue is enough ), I also wanted to elaborate on its integration with the city SIP numbers of a Kazakhstani provider.
image


I think it is worth mentioning right away that I have no relation to this provider (except for the fact that I am the user of their services).

What we need:




For clarity:



')
So. Our company has at its disposal 2 SIP-numbers with 2 lines on each. At hand was an old sistemnik on which the Elastix was successfully installed. This is where the fun began.

Part 1. Network Setup.


A bit of theory: to ensure the quality of communication, Kazakhtelecom divides the physical channel ADSL into 2 logical channels that do not affect each other. It turns out that two interfaces will come out of the ADSL modem, one for the Internet, the other for ID Phone (SIP). Accordingly, Elastix must also be connected to both of these interfaces. But there is another problem. The ID Phone distributes the IP address via DHCP, so the interface on Elastix must be configured to receive IP via DHCP. The second interface is used to access the Internet, respectively, must have a Default Gateway - the main gateway. It turns out that the main gateway is registered on both interfaces. To solve this problem, it was decided to use the second network card. The idea is that the second network card asterisk is connected directly to the ADSL-modem in the ports for ID Phone. The network card receives a dynamic IP address type 10.20.130.11. The problem is that in this situation, the Elastix server acquires two Default Gateway. One already registered on Megaline 192.168.100.1 and the second, received via DHCP from the network ID Phone. Traffic starts to wander, nothing works. How to be?
First of all, go to the ADSL router settings (in my case 192.168.100.1 ) and turn off DHCP for one of the Ethernet ports (in my case 4th), to which Elastix will be connected directly from the second network card. On my TP-Link TD-W8951ND, it looks like this:
image

We connect the second network card (if we have not done this before) and through SSH we connect to the Elastix server, and then enter the command
ifconfig 

The result looks like this:
image

We see that the device called eth0 has a static IP (in my case it is 192.168.100.6 ), through which we connect to the web interface. So, the network card that we are going to configure to work with Kazaktelecom's DHCP is eth1 .
It turns out that, unlike Windows, Linux can be taught to receive via DHCP not all that is offered, but certain parts. Such as IP address, domain, DNS server, etc. BUT NOT Default Gateway! To do this, using the SSH client connect to the server and create a file called
 /etc/dhclient-eth<X>.conf 

where X is your network card number. In my case it is
 /etc/dhclient-eth1.conf 


write:
 send host-name "asterisk"; request subnet-mask, broadcast-address, time-offset, host-name; 

Now in the SSH client, we restart the network service with the command
 service network restart 

After that, the network card will receive the address via DHCP, but without the default gateway. Next, create a file
 /etc/sysconfig/network-scripts/route-eth<X> ( ) 
in which we write:
 GATEWAY0=192.168.100.6 NETMASK0=255.0.0.0 ADDRESS0=10.0.0.0 

Further. Modify file contents:
  1. / etc / sysconfig / network-scripts / ifcfg-eth0

     # Realtek Semiconductor Co., Ltd. RTL8111/8168B PCI Express Gigabit Ethernet controller DEVICE="eth0" BOOTPROTO=static HWADDR=<b> mac-</b> ONBOOT=yes TYPE=Ethernet IPADDR=192.168.100.6 NETMASK=255.255.255.0 NOZEROCONF=yes BROADCAST=192.168.100.255 NETWORK=192.168.100.0 DEFROUTE=yes NM_CONTROLLED="no" NAME="eth0" # # the GATEWAY is sometimes in: /etc/sysconfig/network GATEWAY=192.168.100.1 

  2. / etc / sysconfig / network-scripts / ifcfg-eth1

     # Realtek Semiconductor Co., Ltd. RTL-8139/8139C/8139C+ DEVICE=eth1 BOOTPROTO=dhcp ONBOOT=yes HWADDR=<b> mac-</b> TYPE=Ethernet IPADDR= NETMASK= NOZEROCONF=yes NM_CONTROLLED="no" 
  3. / etc / sysconfig / network

     NETWORKING=yes NETWORKING_IPV6=no HOSTNAME=host.asterisk GATEWAY=192.168.100.1 DNS1=192.168.100.1 DNS2=8.8.8.8 
  4. / etc / hosts

     # Do not remove the following line, or various programs # that require network functionality will fail. 127.0.0.1 localhost 192.168.100.6 localhost.localdomain 


This completes the configuration of network cards. Just in case, once again for clarity:
192.168.100.1 - static address of the ADSL modem
192.168.100.6 - the static address of the Elastix server

Part 2. Setting up Elastix


Open your personal account on idphone.kz and select the desired phone number. In the menu "Personal data -> Equipment or Phone Settings" we see something like this window
image
Do not forget to press the "change password" button.
Go to Elastix-> PBX-> Trunks-> Add SIP Trunk



Go to Elastix -> PBX -> Inbound Routes -> Add Incoming Route


Outbound Routes -> Add Route


Now go to Elastix -> System -> Network -> Edit Network Parameters
In my case, the settings are as follows:
image
Host parameter is optional. In principle, does not affect anything.
Ultimately, something like this should turn out:
image

Source: https://habr.com/ru/post/198684/


All Articles