LogoLogo
www.mikopbx.comTelegram communityForum
English
English
  • MikoPBX Manual
    • Quick start
    • Getting to know MikoPBX
    • System requirements
  • Installation
    • Standalone Computer
    • Virtual Machine
      • VMware ESXi
      • VMware Fusion
      • VirtualBOX
      • VMware Workstation Pro
      • Hyper-V
      • Proxmox
    • Cloud
      • AWS
        • AWS deployment guide
        • AWS Marketplace
      • Microsoft Azure
      • Google Cloud
        • Google Cloud deployment guide
        • Google Cloud Marketplace
      • Hetzner cloud (In dev)
      • Digital Ocean
      • Alibaba Cloud
      • Vultr
    • Docker container
      • Docker installation and creating a user and directories
      • Running MikoPBX in a container
      • Running MikoPBX using docker compose
  • User manual
    • Telephony
      • Extensions
      • Call queues
      • IVR Menu
      • Conferences
      • Sound files
      • Call detail records (CDR)
    • Call Routing
      • Telephony providers
      • Incoming routing
      • Outbound routing
      • Night and Holiday Switch
    • Modules
      • Registration in the modules marketplace
      • Module management
      • Application dialplans
    • Maintenance
      • PBX update
        • Updating from the web interface
        • Updating from the MikoPBX console
        • Updating the docker
      • System log entries
      • Reboot
    • Network and Firewall
      • Network interface
      • Firewall
      • Anti brute force
    • System
      • General settings
      • Time Settings
      • Mail settings
        • Setting up E-mail notifications for the Gmail mail service
      • Asterisk Manager Interface(AMI)
      • System files customisation
  • FAQ
    • Setup
      • Installation on MDADM RAID1
      • Fine-tuning the firewall
      • Migrating MikoPBX to Another Server
        • Transfer Using Backup
        • Transfer using scheduled backup (SFTP)
        • Transfer using rsync
      • Reset to factory settings
      • Monitoring Providers on MikoPBX
    • Management
      • Change the login name
      • The extra disk space has run out, the disk size has increased
      • Storing Recordings in a Shared Windows Folder
      • Resetting WEB Interface Credentials
      • Backup Internet and Provider Re-Registration
    • Troubleshooting
      • Connecting to the PBX using SSH
        • Connecting to PBX using SSH client (Putty)
        • Connecting via SSH (Windows)
        • Connecting via SSH (Linux/MacOS)
      • Connecting to a PBX using WinSCP
      • Getting logs using the tcpdump application
      • Capturing Logs from PBX using Wireshark
      • Traffic Analysis Using Sngrep
      • Adjusting the volume
      • Troubleshooting sound problems
      • Jitter Configuration
    • Incoming Routing
      • Choosing a provider when redirecting to a mobile
      • Notification of Employment, Call Waiting
      • Black and white lists
      • Allow additional dialing of the internal number in the queue
      • Output of information about the did number
      • Setting individual non-working hours for a provider account
      • An example of the implementation of a typical route of incoming calls
      • Routing by DID Number
      • Normalization of incoming phone number
      • Basic IVR example
    • Outbound routing
      • Add P-Preferred-Identity and Remote-Party-ID header
      • Conference with a regular external subscriber
      • Outgoing with internal number dialing
      • Remove all special characters from the dialed number
      • Prohibiting calls via a backup route
      • Calls to emergency numbers
      • Number Templates
        • Uniform distribution of outgoing
        • Sample template: calls to another country
        • How to prohibit the replacement of "+" with 00
        • Changing the number prefix from "+345" to "347"
        • Changing the number prefix from "345, 347" to "+345"
        • Removing the area code from the number
        • Adding the prefix "1" to the number
      • Making Calls Through a Specific Provider
    • Scenarios and cases
      • Generate extensions by REST API
      • Missed Call Telegram Notifications
      • Call the company from your mobile and dial an extension to call a third-party company
      • Sending an incoming fax to email
      • Customer's assessment of the quality of service
      • Simulation of external calls
      • Disabling "off-hours" for VIP numbers
      • Registering multiple accounts from one provider
      • Setting up individual non-working hours for several providers on one host
      • Disable forwarding to mobile for internal calls
      • Unique background music for the queue
      • Pause for Queue agent
      • Dynamic Queue Agents
      • Setting up the "Paging" function
      • Limit the number of authorizations per SIP account
      • Call Monitoring (ChanSpy)
      • Conversion of Call History FreePBX -> MikoPBX
      • SSL Certificate for MikoPBX Web Interface from OPNSense
      • Hiding the Caller’s Number from Employees
    • Interconnections
      • Merging two MikoPBX
      • Integration of MikoPBX and Grandstream UCM6202
      • MikoPBX and FreePBX (PJSIP)
      • MikoPBX and FreePBX (IAX)
    • VoIP providers
      • Mango
      • Zadarma
    • Softphones
      • Bria Solo
      • Sessiontalk
      • MicroSIP
      • Groundwire
      • Zoiper
      • Jitsi
      • PhonerLite
      • Linphone (MacOS)
      • Telephone(MacOS)
      • Configuring webRTC client SIMPL5
      • Softphone.pro
      • 3CX Softphone
      • PortSIP
    • IP telefones
      • Snom D120
      • Yealink T19
    • VoIP gateways
      • GoIP4
      • Grandstream HT503
      • Using a Huawei E173 USB Modem for Calls (chan_dongle)
  • Modules
    • MIKO modules
      • for 1C:Enterprise
        • Панель телефонии 4.0 для 1С
        • Панель телефонии 1.0 для 1С
        • Модуль умной маршрутизации
      • Users groups
      • CRM Bitrix24 integration
      • Autoprovision
      • Let's Encrypt
      • Access control management
      • Module auto dialer
      • Backup
      • Synchronization with LDAP/AD
      • Callback module
      • Extended call history
  • other
    • Changelog
      • MikoPBX 2024.1
      • MikoPBX 2023.2
      • MikoPBX 2023.1.223
Powered by GitBook
On this page
  • Task Description
  • Telephony Providers
  • Outbound Routing
  • Incoming Routing
  • Call Forwarding
  • Subscriber Statuses
  • Resolving Identical Numbers on PBXs
  • Conclusion and Results

Was this helpful?

Edit on GitHub
Export as PDF
  1. FAQ
  2. Interconnections

Merging two MikoPBX

Analysis of a case involving the integration of two MikoPBX systems

Last updated 6 months ago

Was this helpful?

Task Description

In this example, a call center company has two offices: in Berlin and in Cologne. Each office uses a separate MikoPBX system:

  • PBX Berlin - 192.168.0.202 - all internal employee numbers are assigned using the pattern 2XX (e.g., 201, 202, 203, ...)

  • PBX Cologne - 192.168.0.201 - all internal employee numbers are assigned using the pattern 3XX (e.g., 301, 302, 303, ...)

For the purposes of this example, local IP addresses are used.

The goal is to merge these two PBX systems to create a unified internal numbering plan: employees in the Berlin office should be able to dial employees in the Cologne office using short numbers and vice versa.

A schematic representation of call routing is shown in the figure below.

Telephony Providers

  1. For each PBX, you need to add a provider account. To create it, navigate to "Routing" → "Telephony Providers".

  1. Create providers and fill in the connection parameters as follows:

The provider ID will appear in the address bar only after saving the provider. Temporarily, in the "Username" field, enter a derived value. After saving the provider, you can correct it.

  1. In "Advanced Setting" → "Redefining SIP header "From"," check the box "Disable using the fromuser field." This needs to be done for both providers.

  1. In "Advanced Setting" → "Advanced Options," add the following:

[endpoint]
set_var=IGNORE_TIME=1 

This option disables the "Non-working Hours" feature for all incoming calls through this provider.

Outbound Routing

Navigate to "Routing" → "Outbound Routing." Configure the outgoing routes as shown in the screenshot below:

Incoming Routing

  1. For each PBX, add the same dialplan application that will redirect calls to internal numbers. In the "Modules" → "Dialplan Applications" section, add a new application with the following parameters:

    • "Name" - any name

    • "Extension to Call the Application" - any unique number

    • "Code Type" - Dialplan Asterisk

  1. Go to the "Programme Code" tab and add the following code to handle calls:

1, GoTo(internal,${FROM_DID},1)
n, Hangup()
  1. Create an incoming route for each PBX. Navigate to "Routing" → "Incoming Routing," and add a new rule with the following parameters:

Call Forwarding

For security reasons, forwarding to external phone numbers is prohibited!

First PBX

To remove this restriction, add the following code to the end of the "extensions.conf" file via the "System" → "Customize System Files" section:

[internal-transfer](+)
exten => _2XX,1,Set(__ISTRANSFER=transfer_)
     same => n,Goto(outgoing,${EXTEN},1) 

This allows forwarding to 2XX numbers.

Second PBX

On the second PBX, to allow forwarding to 3XX numbers, add the following code to the end of the "extensions.conf" file via the "System" → "Customize System Files" section:

[internal-transfer](+)
exten => _3XX,1,Set(__ISTRANSFER=transfer_)
     same => n,Goto(outgoing,${EXTEN},1) 

This allows forwarding to 3XX numbers.

Subscriber Statuses

In some cases, subscribers on one PBX need to know the statuses of subscribers on the other PBX. For example, when using:

  • BLF on telephone devices

  • "Telephony Panel for 1C"

To configure statuses:

  1. On the first PBX, add the following code to the end of the extensions.conf file via the "Customize System Files" section:

[internal-hints]
exten => 301,hint,PJSIP/301
exten => 303,hint,PJSIP/303
exten => 302,hint,PJSIP/302
  1. For each PBX, add the following code to the end of the pjsip.conf file via the "Customize System Files" section:

[<ID-Provider-Current-PBX>-devicestate]
type=outbound-publish
server_uri=sip:<ID-Provider-Current-PBX>@<ID-Provider-Other-PBX>:<SIP-Port-Other-PBX>
event=asterisk-devicestate

[<ID-Provider-Current-PBX>]
type=asterisk-publication
devicestate_publish=<ID-Provider-Current-PBX>-devicestate
device_state=yes

[<ID-Provider-Current-PBX>]
type=inbound-publication
event_asterisk-devicestate=<ID-Provider-Current-PBX>

Replace the placeholders <ID-Provider-Current-PBX>, <ID-Provider-Other-PBX>, and <SIP-Port-Other-PBX> with your actual values.

  1. On the second PBX, add the following code to the end of the extensions.conf file via the "Customize System Files" section:

[internal-hints]
exten => 201,hint,PJSIP/201
exten => 203,hint,PJSIP/203
exten => 202,hint,PJSIP/202

Resolving Identical Numbers on PBXs

Ideally, each PBX should have its own range of SIP numbers that do not overlap. However, in practice, overlaps can occur. This might lead to issues when calling from one PBX to another: the call may drop.

You can work around this problem. On each PBX, add the following code to the end of the extensions.conf file via the "System" → "System file customization" section:

[ID_PROVIDER-outgoing-custom]
; For outgoing calls, add an "_" (underscore) prefix to the caller ID
exten => _X!,1,Set(CALLERID(num)=_${CALLERID(num)})
    same => n,return

[ID_PROVIDER-incoming-custom]
; For incoming calls, remove the prefix for correct caller ID display
exten => _[0-9*#+]!,1,Set(CALLERID(num)=${CALLERID(num):1})
    same => n,return

ID_PROVIDER is the identifier of the provider on the current PBX. You can find it in the browser's address bar:

Conclusion and Results

By following these steps, we have successfully connected two PBXs! A green indicator next to the provider account confirms the successful connection of the two systems:

For PBX Berlin (192.168.0.202):

For PBX Cologne (192.168.0.201):

Similarly, you can connect three or even four PBX systems! Note that when connecting three PBXs, each PBX must have not one but two providers. This can be schematically represented as:

Routing diagram
"Telephony Providers" section
Provider settings for merging
Advanced setting
Outbound Routing Settings
Dialplan settings
Inbound routing rule
Provider ID
Status on MikoPBX station in Berlin office
Status on MikoPBX station in Cologne office
Scheme of merging 3 MikoPBX stations