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

Was this helpful?

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

Conference with a regular external subscriber

Last updated 1 year ago

Was this helpful?

  • Let's say a conference room with the number "354233" is configured on the PBX.

  • When calling an employee(s) to a conference, it is always necessary to connect an external subscriber.

  • When disconnecting employees from the conference, the external subscriber must be disconnected

This may be required to organize communication with an external (relative to MIKOPBX) conference. It will allow saving on outgoing calls (only one line will be occupied).

  1. In the "Telephony" section, go to "Conference" and create a new conference.

  1. We will indicate the name of the room "Z-CONF-354233"

  1. We will indicate the internal number "354233"

  1. Name "Z-Worker-CONF"

  1. The number to call "2200103" (can be arbitrary)

  1. Specify the code type "PHP-AGI script"

  1. Programme code:

<?php

require_once 'Globals.php';

use MikoPBX\Core\System\Util;
use \MikoPBX\Core\Asterisk\AGI;
use \MikoPBX\Core\Asterisk\AsteriskManager;

function checkStartConf(){
    $Z_DTMF         = '354233';
    $Z_PROVIDER_ID  = 'SIP-1601534775';
    $Z_DST          = '37127776675';

    $am = new AsteriskManager();
    $am->connect();

    $confEmpty = true;
    $confChannelFound = false;
    $data = $am->meetMeCollectInfo($Z_DTMF);
    foreach ($data as $channelData){
        $value = $am->GetVar($channelData['Channel'], 'ZDTMF', null, false);
        if(!empty($value)){
            // This is the conference channel.
            $confChannelFound = true;
        }else{
            // There is an end user channel.
            $confEmpty = false;
        }
    }

    if($confChannelFound === false && $confEmpty === false){
        // You need to connect to an external conference.
        $am->Originate(
            'Local/'.$Z_DTMF.'@z-meetme',
            $Z_DST,
            'z-outgoing',
            '1',
            null,
            null,
            null,
            null,
            "__ZDTMF={$Z_DTMF},__ZPROVIDERID={$Z_PROVIDER_ID},__ZDST={$Z_DST}}",
            '0');

    }elseif ($confChannelFound === true && $confEmpty === true){
        $asteriskCmd = Util::which('asterisk');
        Util::mwExec("{$asteriskCmd} -rx 'meetme kick {$Z_DTMF} all'");
    }
}

$action = $argv[1]??'';
if($action === 'start'){
    $pid = Util::getPidOfProcess(basename($argv[0])." start$", getmypid());
    var_dump($pid);
    if(!empty($pid)){
        $killCmd = Util::which('kill');
        Util::mwExec("{$killCmd} {$pid}");
    }
    while (true){
        checkStartConf();
        sleep(3);
    }
}else{
    $agi = new AGI();
    $agi->answer();
    checkStartConf();
    $agi->hangup();
}
  1. Adding the task to the end of the file:

*/1 * * * * /usr/bin/php -f /var/lib/asterisk/agi-bin/DIALPLAN-APP-EC12CFAE6783FE82FD34F16E40C7386B.php start > /dev/null 2> /dev/null

In this example, "DIALPLAN-APP-EC12CFAE6783FE82FD34F16E40C7386B" is the ID of the previously created application. The ID can be peeped in the browser address bar when editing the application.

  1. Add the following code to the end of the file:

[z-outgoing]
exten => _X!,1,Ringing()
  same => n,Gosub(${ISTRANSFER}dial,${EXTEN},1)
  same => n,Dial(PJSIP/${EXTEN}@${ZPROVIDERID},600,${DOPTIONS}TKU(z-dial-answer)b(dial_create_chan,s,1))
  same => n,ExecIf($["${ISTRANSFER}x" != "x"]?Gosub(${ISTRANSFER}dial_hangup,${EXTEN},1))
  same => n,Set(pt1c_UNIQUEID=${EMPTY_VALUE})
  same => n,ExecIf($["${BLINDTRANSFER}x" != "x"]?AGI(check_redirect.php,${BLINDTRANSFER}))
  same => n,Hangup()

[z-dial-answer]
exten => s,1,NoOp(Answered send DTMF...)
  same => n,Gosub(dial_answer,${EXTEN},1)
  same => n,SendDTMF(${ZDTMF})
  same => n,return
	
[z-meetme]
exten => _X!,1,Answer()
  same => n,Meetme(${EXTEN},qdMTr)
  same => n,Hangup()

When calling the conference number 354233, an external subscriber with the number 37127776675 will automatically connect. As soon as the subscriber answers, the extension number 354233 will be dialed. As soon as all the "internal" participants have left the conference, the external subscriber will be disconnected.

The task in the crown is needed only for additional "protection", in fact it is a restart of the php script every minute

Let's describe the "Dialplan Application" (see )

Edit the file "/var/spool/cron/crontabs/root" via the menu

We will describe additional contexts through the menu. We will edit the extensions.conf file.

Dialplan Applications
System files Customization
Customization of system files
New Conference
Conference name
Conference number
New Dialplan Application
Name of dialplan
Number for dialplan
Type of script
Code for dialplan
/var/spool/cron/crontabs/root file
Code for Crontabs/root
Extensions.conf file
Code for Extensions.conf