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
  • other
    • Changelog
      • MikoPBX 2024.1
      • MikoPBX 2023.2
      • MikoPBX 2023.1.223
Powered by GitBook
On this page
  • Problem Statement
  • Solution

Was this helpful?

Edit on GitHub
Export as PDF
  1. FAQ
  2. Outbound routing

Making Calls Through a Specific Provider

Last updated 1 year ago

Was this helpful?

Problem Statement

In MikoPBX (Telephony → Employees), the following employee accounts are configured:

In MikoPBX, there are two providers configured (Routing → Telephony Providers):

The requirement is that:

  1. The phone connected to account 201 should only make calls through the first provider PT.

  2. The phone connected to account 202 should only make calls through the second provider Zadarma(Novofon).

Outbound calls to the external world (to a city) through both providers are implemented using the same outgoing rule: it's a ten-digit number starting with 7. This task can be schematically represented as follows:

Solution

Routing calls through a specific provider can be achieved using outbound dial plan prefixes.

  • Calls will always go through the first provider if you add 1 before the outgoing number. Therefore, if the subscriber with 201 wants to dial outgoing numbers with the 1 prefix, the calls will go through the first provider.

  • Calls will always go through the second provider if you add 2 before the outgoing number. Therefore, if the subscriber with 202 wants to dial outgoing numbers with the 2 prefix, the calls will go through the second provider.

You can schematically represent this as follows:

You can implement this task in two ways in MikoPBX:

  1. Subscribers 201 and 202 will always add specific prefixes before dialing on their phones. For example, if they want to call the number 74952293042, they will add the prefix 1 or 2 before this number, such as 174952293042 or 274952293042.

  2. Subscribers 201 and 202 do not dial special prefixes; the PBX itself performs this action for them.

First Method

The first method of implementing our task assumes that subscribers 201 and 202 will independently dial the corresponding prefixes on their phones. Subscriber 201 will always add 1 before the number, and subscriber 202 will add 2.

  1. For the first provider, create an outbound rule. Go to Routing → Outbound Routes. Add a new rule.

  1. Fill in the parameters as shown in the screenshot below:

3. For the second Zadarma provider, we create an outgoing rule. Go to the Routing → Outgoing routes section. Adding a new rule as in the screenshot below:

Second Method

The second method of implementing our task assumes that subscribers 201 and 202 do not dial specific prefixes on their phones; the PBX does this for them.

  1. In the Routing → Telephony Providers section, add a third provider account.

  1. Fill in the parameters as shown in the screenshots below:

  1. Save the account and copy the ID of this provider in the address bar.

  1. Add an outgoing rule for the created provider. By default, we will direct all calls through this provider, so be careful when creating an outgoing template. Calls through our providers can be made to numbers starting with 7, so our template takes the form:

  1. Please note that the priority of the outgoing rule for the Router provider should be lower than all!

  1. Go to System -> System file customization section

  1. Open the extensions.conf configuration file for editing.

  1. Select the "Add to end of file" mode. In the editing window, insert the following lines:

[globals](+)
MIKO_PREFIX_NUMBER_201=1; Prefix for internal number 201
MIKO_PREFIX_NUMBER_202=2; Prefix for internal number 202

[SIP-1690973516-outgoing-custom]
exten => _.!,1,ExecIf($[ "${PREFIX_NUMBER}x" != "x" ]?return)
    same => n,ExecIf($[ "${MIKO_PREFIX_NUMBER}x" == "x" ]?Set(MIKO_PREFIX_NUMBER=${MIKO_PREFIX_NUMBER_${CHANNEL(peername)}}))
    same => n,Set(PREFIX_NUMBER=${MIKO_PREFIX_NUMBER})
    same => n,ExecIf($[ "${MIKO_PREFIX_NUMBER}x" != "x" ]?Goto(outgoing,${MIKO_PREFIX_NUMBER}${EXTEN},4))
    same => n,return
    
[all_peers-custom]
include

 => internal-custom

[internal-custom]
exten => _.!,1,NoOp(Start custom context)
    same => n,ExecIf($[ "${MIKO_PREFIX_NUMBER}x" == "x" ]?Set(MIKO_PREFIX_NUMBER=${MIKO_PREFIX_NUMBER_${FROM_PEER}}))
    same => n,Return()

In the code snippet above, you need to create the correct context name. The format of the created context:

[PROVIDER-ID-outgoing-custom]

PROVIDER-ID - the value you saved in the third step described in this method. In our example, it's SIP-1690973516.

Save the changes and return to the list of configuration files.

This way, for the 201 and 202 accounts, we have set prefixes. All outgoing calls will now go through the required provider.

Default Route

In some cases, when defining incoming routes, you may need to redirect a call not to an internal number but to an employee's mobile number. In this case, you need to describe the "Default Prefix," otherwise, there may be problems with handling such calls.

When routing by DID number:

[public-direct-dial-custom]
exten => _.!,1,NoOp(Start custom context)
    same => n,Set(__MIKO_PREFIX_NUMBER=2)
    same => n,Return()

For each provider, you should also describe the context:

[PROVIDER-ID-incoming]
exten => _.!,1,NoOp(Start custom context)
    same => n,Set(__MIKO_PREFIX_NUMBER=2)
    same => n,Return() 

With these configurations, you have completed the setup.

Add outbound rules for the first and second Zadarma providers, as described in the . The settings are identical.

first method
The scheme of solving the problem
Section "Extensions"
The scheme of the task
Creating a new rule
Routing parameters for the first provider
Routing parameters for the second provider
New Provider
Router Parameters
ProviderID
Routing Parameters for Router
Priority in outbound routing
"System file customization" section
"extensions.conf" file
Code for extensions.conf
Drawing