Table of Contents

Telephony: Dialplan

Conditions and Destination Variables

To create conditions you can use regular expressions to match the value in the variable field. The following expressions can be used:

\d      => 1 digit (0-9)
\d*     => 0 or more digits
\d+     => 1 or more digits
\d{3}   => exactly 3 digits
[0-9]   => any digit (1 digit only) 
[1-3]   => a digit between 1 and 3 (1 digit only) 
[13]    => digit is 1 or 3 (1 digit only)
[134-7] => digit is 1, 3, 4, 5, 6 or 7 (1 digit only) 

^123    => the value starts by 123
123$    => the value ends by 123


^00\d+$   => the number starts by 00 followed by 1 or more digits
^00(\d+)$ => the number starts by 00 followed by 1 or more digits, but the 1 or more digits is save in variable ${val1}

You can check at http://www.regular-expressions.info/ for a full documentation to learn more about regular expressions.

When calling a destination you can use variables that are passed to the action (check the manual for a complete list of variables), for example you can do:

${destination_number} => the destination number dialed by the user
${caller_id_number} => the call caller id number
${caller_id_name} => the call caller id name
${origination_caller_id_number} => the call caller id number effective
${origination_caller_id_name} => the call caller id name effective
${val1}, ${val2}, ... => use the resulting match from the regular expression inside () 
${domain_name} => the domain name
${line_name} => the line name
${account_name} => the account name
${description} => the account description
${accountcode} => the call accountcode
${userfield} => the call userfield
${uuid} => The call unique identifier
${call_uuid} => The call uuid unique identifier
${channel_name} => the channel name
${channel_type} => the channel type
${channel_type} => the channel type
${context} => The dial-plan context name
${extension} => The dial-plan extension name
${billsec} => The call billsec time in seconds
${bridge_hangup_cause} => The hangup cause for the bridge action
${bridge_originate_disposition} => The originate cause for the bridge action
${ivr_digits} => digits pressed inside the ivr
${odbc_[\w-]+} => The odbc return variables
${chan_[\w-]+} => The custom channel variable defined in action channel variable
${sip_p_[\w-]+} => SIP optional P-Key-Flags headers variables
${sip_x_[\w-]+} => SIP optional custom headers variables
${sip_to_user} => SIP to user variable.

Example:

Expression: ^456(\d+)$ => call to: #31#${val1}
Expression: ^\*20#$ => action voicemail: ${caller_id_number} % commsmundi.com

Bridge local

This action allows you call to local accounts or local groups.

Bridge local - account

To call to a account.

Bridge local - group

To call to a group.

Bridge custom

To make a call using a line (SIP or TDM) the action used in the dialplan is the action Bridge Custom. This action allows you to also call to local accounts ignoring the internal forwards activated in the account, it calls directly to the registered endpoint.

Bridge custom - single

To call to a landline (using Spain national numeration) use the following parameters:

Bridge custom - multiple

To call simultaneously to two different accounts. The first to answer the call takes the control and makes the other to hangup.

Bridge custom - failover

To call to a landline (using Spain national numeration), if the first operator returns error it will use the second line.

Bridge custom continue between rules

To call to a landline (using Spain national numeration). If the call can't be completed using the first rule, try to make the call using a second rule.

Add the first rule:

Add the second rule:

Bridge custom retrieve blind transfer between extensions

If the call can not be completed using the first rule, retrieve blind transfer between extensions.

Add the first rule:

Add the second rule:

Bridge custom - single and list condition

To call to destination using list condition, use the following parameters:

- add the list

- add the values in list

- add rule action

Bridge custom - single and send dtmf

To call to a landline (using Spain national numeration) and send dtmf use the following parameters:

Callback

The function callback allows to trigger an automatic call between a destination and an action. For example, you can use this function to build an automatic system where you can call and CM returns you the call and connects it to the application disa, so you can make calls as a normal company extension.

Callback - return call connecting to DISA

To configure a callback that returns you the call, without answer. Oce you answered the returned call connects you to the application disa, you must add the following rules:

  1. add the callback action in the context incoming, in this case my caller id number is 123456789
    • Name: callback me
    • Priority: first
    • Conditions: x - custom; x - caller id number: x-Expression: ^123456789$
    • Action: x - custom: Callback;
      • Callback: ${caller_id_number} @ <outgoing>; Timeout: 60 seconds
      • Destination: disa_callback @ <incoming>
      • Delay: 5000 ms
    • click Add
  2. add the disa action in the context incoming
    • Name: callback disa
    • Priority: first
    • Conditions: x - custom; x - Destination number: x-Expression: ^disa_callback$
    • Action: x - custom: DISA; Context: <outoing>; Timeout: 60 seconds
    • click Add

Eavesdrop

In order to listen for active calls, there are two options, listen to a particular caller or listen to the first active call in one group.

Forcing the destination

Group the destination

:!: The destination group must have “telephony” enabled

Fax mailbox - receiving faxes

Receiving the fax can be done directly or when the destination number is shared between normal calls using a rule to detect if is a fax or not. You must configure in directory an account with fax feature enable.

Direct fax

  1. add the rule to directly receive the fax, in this case my destination number is 123456789
    • Name: fax
    • Priority: first
    • Conditions: x - custom; x - destination number: x-Expression: ^123456789$
    • Action: x - custom: fax mailbox;
      • Destination: fax @ commsmundi.com
    • click Add

Auto detect fax and transfer to another extension

  1. add the rule to directly receive the fax when transfer from the fax detection, in this case the destination number is fax
    • Name: fax
    • Priority: first
    • Conditions: x - custom; x - destination number: x-Expression: ^fax$
    • Action: x - custom: fax mailbox;
      • Destination: fax @ commsmundi.com
    • click Add
  1. add the rule to detect the fax
    • Name: fax
    • Priority: first
    • continue: x - Continue after extension
    • Conditions: x - any;
    • Action: x - custom: fax detect;
      • Timeout: 3 seconds
      • Transfer: fax @ incoming
    • click Add

:!: This two rules are added in the same context incoming. If you add the detection and the rule to receive the fax in different contexts, adjust the configuration.

Hold Music

It's possible to force a different music on hold per type of call.

Forcing hold music rule

Add a new rule using the following parameters:

Forcing hold music inline rule

Force the the music on hold in an already created rule

Intercept

In order to capture incoming calls at one extension, there are two options, capture to a particular caller or capture to the last call in one group.

Forcing the destination

Group the destination

:!: The destination group must have “telephony” enabled

Limit

It's possible to apply a limit to a random resource. This way we can limit the simultaneous calls that a domain can do, limit the international call rate, and more..

Limiting simultaneous calls in one domain

Add a new rule to the outgoing context used by the domain commsmundi. This rule allows 5 simultaneous calls for the domain commsmundi. When the value is higher than 5 the calls get dropped.

Limiting call rate for one domain

Add a new rule to the outgoing context used by the domain commsmundi. This rules allows 5 new calls per minute and then transfer the call to another context where CommsMundi will play a warning message.

ODBC

Using the function ODBC is possible to connect to external databases to extract or insert data. The use of this functions allows interact with external applications or executing dialplan actions in function of external data. In the SQL queries is possible to use dialplan variables.
To add a new ODBC connector go to the Comms Mundi administration page Home → ODBC. For more examples, please check ODBC.

Action ODBC

Adding a rule to extract total call duration for an account. Add the rule using the following parameters:

Adding a rule to update the total call duration for an account upon hangup. Add the rule using the following parameters:

Condition using ODBC

Matching a call with the extract value after the previous rule “control minutes”

Record

It's possible to record any active call in CommsMundi. There are two possible methods to do this operation by trigger the recording from the dialplan or manual trigger in the active call.
All the audio recordings can be accessible from the user's web interface in the application Recording or connecting through FTP.

Recording from the dialplan

Add a new rule to record all the calls using the following parameters:

Recording from the extension in an active call

Activate in the rule the Inline functions [Callee] or Inline features [Caller]:

Ring-Back

It's possible to force a custom ring-back per type of call.

Forcing ring back rule

Add a new rule using the following parameters:

Forcing ring back inline rule

Force the the ring back in an already created rule

SIP-X-Headers

It's possible to set one or more SIP X headers that are used to send non-standard information via SIP protocol, for example, sending the customer credit information in the SIP package. Conditions can be done as well using the SIP X headers received from the remote end to execute actions.

Setting SIP X Headers

Add a new rule to set SIP X headers using the following parameters:

Condition using SIP X Headers

Matching a incoming call using SIP X headers:

SIP-PRESENCE

It could be used to turn on or off lights on a phone.

Add a new rule to force blf to blink:

Forcing blf on (static/busy)

Add a new rule to force blf to stay static or busy:

Forcing blf off (static/free)

Add a new rule to force blf to stay static or free:

SIP-NOTIFY

Create a new rule to reboot a Yealink phone typing any number.

Create a new rule to show text on a Yealink phone typing any number.

	<?xml version="1.0" encoding="ISO-8859-1"?>
	<YealinkIPPhoneTextScreen
 			Beep="yes"
			Timeout="10">
	<Title wrap="yes">TextScreen</Title>
	<Text>xml test</Text>
	</YealinkIPPhoneTextScreen>

Forcing phone to alert of a new message

Create a new rule to turn on the message light or to activate the message notification.

	Messages-Waiting: yes
	Message-Account: sip:100@commsmundi.com
	Voice-Message: 3/0
	

Accountcode

It's possible to set a custom variable Accountcode to group all the calls in one or multiple categories. The history page allows search by Accountcode.

Accountcode rule

Add a new rule to identify international calls using the following parameters:

Accountcode inline rule

Force the Accountcode in an already created rule indentifying calls between registered users.

Userfield

It's possible to set a custom variable userfield to group all the calls in one or multiple categories. The history page allows search by userfield.

userfield rule

Add a new rule to identify international calls using the following parameters:

Userfield inline rule

Force the userfield in an already created rule

Caller id

It's possible to set a caller id number and/or to group all the calls in one or multiple categories.

Caller id rule

Add a new rule to identify international calls using the following parameters:

Caller id inline rule

Force the Caller id number and/or name in an already created rule indentifying calls between registered users.

Voicemail

The voicemail action allows you to check your voicemail messages or directly send a call to a voicemail box to leave a message. To add, modify or delete voicemail accounts go to the CommsMundi administration page Directory.

voicemail rule check messages

Add a new rule to check messages in one account

voicemail rule leave a message

Add a new rule to redirect a caller to a voicemail box when in period “leasure_time”

Playback and Get Digits

The action play and get digits allows to store the dtmf digits introduced by the caller when interacting with a prompt message. The digits are store in a channel variable with the prefix digit that can later be used to trigger special rules or insert the value to a remote database using an odbc connector.

Playback and Get Digits action

Add a new rule to prompt a message to the caller and store the pressed dtmf

Add a rule to play the age (dtmf) introduced in previous rule

DB

The action DB allows to store values ​​in variables that will be reflected in Telephony/Dialplan/variable DB. This values can be used ​​in other rules to perform specific actions. Atention: the stored data are volatile.

Activate day and night mode (outgoing context)

Add a new rule to store information in the variable (activate day mode).

Add a new rule to play (the day mode is active).

Add a new rule to store information in the variable (activate night mode).

Add a new rule to play (the night mode is active).

perform actions with the variable (incoming context)

Add a new rule to check night mode.

Add a new default rule to day mode

JSON response

The HTTP action JSON response allows you to return values using a PHP file and working with this data.

Example php:

<?php

$array = array();
$array[0]['extension'] = "200";
$array[0]['name'] = "name1";
$array['example']['extension'] = "300";
$array['example']['name'] = "name2";

echo json_encode($array);

?>

Query and management of HTTP data (outgoing context)

Add a new rule to query the PHP data.

Add a new rule to manage the consulted data.

The consulted data is stored in variable with this format:

If array is of one dimension the format would be:

Wake up call

You can create a rule to turn on your wake up call and another to disable it.

Turn on Wake up call

Disable Wake up call

IVR

To execte an IVR you need to configure a rule at dialplan.

Call Center

Dial

You will need to create a rule on the dialplan so the agents will have access to the callcenter.

Agent login/logout

You can create a rule so an agent can login or logout (only with dynamic users).

Agent pause/unpause

You can create a rule so an agent can pause or start to receiving calls.

DISA

Scheduler

You can create a rule so Commsmundi will automatically playback, hangup, transfer… every x seconds or once a call. For example, if you want to hangup a call when it duration is 10 seconds when the call is answered:

Park

You can park a call and take it in a different phone.

Park in

Park out

Attendance

You can generate input or output events in attendance.

Attendance in

Attendance out

1)
When the callee press *2 it start or stop the recording