Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

  

SEO Metadata
composedTitleSmart Dialplan - use of Custom Applications
titleSmart Dialplan - use of Custom Applications

Smart Dialplan explains how to use Custom Applications in Wildix Dialplan to interact with external software and databases.

...

AGI in “Custom Application”

Variables in Dialplan

Variables are needed to store the information necessary to execute the application.

...

Example:

PDF avoid Pagebreak

Image Modified


This Dialplan is assigned to user 102.
NoOp function serves to display the variable value in logs:

...

Note

With the help of QUEUE_MEMBER function it is possible to configure CG strategy to execute another Dialplan procedure. The function counts the number of free members of a Call group. When there are no available CG members, an incoming call is routed according to another Dialplan procedure.

PDF avoid Pagebreak

Image Modified

  • Jump to if -> "${QUEUE_MEMBER(<call_group_id>,free)}"="0"

where

"free" - returns the number of not paused / busy members for a specified queue that can answer calls or are currently paused for the duration of wrap up time after a previous call (free CG members).

Note: Wrap up time and ringing state are not considered when using the function.

For example: All Call group members are put on pause for the duration period of wrap up time -> the incoming call stays in a queue until wrap up time doesn't expire

Warning

Limitation: the system recognizes unregistered (offline) CG members as available for answering calls. In case unregistered members are present in CG -> QUEUE_MEMBER = 0 performance is false.


...

For this purpose, a query to CDR is made to get a count of unanswered calls from the Caller ID number over the previous X minutes.

PDF avoid Pagebreak

Image RemovedImage Added


NoOp(FromNumber is ${CALLERID(num)}) - 
detects the Caller ID.

...

${CallCount} > 0 - If a count of calls is greater than 0, a call will be routed to the Dialplan procedure.

Note

Note: The same scenario can be set up for checking outgoing calls, refer to the Article: How to check whether missed call has been called back.

...

After these initial steps it’s necessary to set up “accounting” procedure:

Context 555 (called number 555)

“Custom applications”:

Read(CALLER,00000/accounting/code,,,,10)

(secret code for authentication)

MYSQL(Connect connid support-fr.wildix.com odessa2016-12 oDess@0912to18 odessa2016-12)

MYSQL(Query resultid ${connid} SELECT credit FROM accounting WHERE id=${CALLER})

MYSQL(Fetch fetchid ${resultid} Current_units)

MYSQL(Clear ${resultid})

NoOp(Current Units : ${Current_units})

(connection to the DB and check the number of credits)

GotoIf($[${Current_units} != NULL]?accounting,0,1:accounting,1,1)

(jump to context 1 if code is wrong, else - context 0)

...

Call Remote script it in Dialplan:

PDF avoid Pagebreak

Image Modified

Call file directory to generate a call

...

Warning

Attention! mv (move) command is an atomic operation (an operation which does not take effect until it is 100% complete) and as such it is perfectly suited to move .call files. With cp (copy) command, the file is copied line by line, which could lead to PBX engine processing an incomplete file.

Call file Syntax

A simple call file example which dials a number and plays a sound file.

Test.call

Code Block
-------------------------------------------------------
Channel: SIP/trunkname/18882223333
Application: Playback
Data: 0000/hello-world
-----------------------------------------------------------------

Syntax of call files

  • Specify the call destination and the channel to use:

    • Channel: <channel>: Channel to use for the call.

    • CallerID: "name" <number> Caller ID, please note: it may not work if you do not respect the format: CallerID: "Some Name" <1234>

    • MaxRetries: <number> Number of retries before failing (not including the initial attempt, e.g. 0 = total of 1 attempt to make the call). Default is 0.

    • RetryTime: <number> Seconds between retries. Default is 300 (5 min).

    • WaitTime: <number> Seconds to wait for an answer. Default is 45.

  • If the call answers, connect it here:

    • Context: <context-name> Context in extensions.conf

    • Extension: <ext> Extension definition in extensions.conf

    • Priority: <priority> Priority of extension to start with

    • Set: Set a variable to be used in the extension logic (example: file1=/tmp/to)

    • Application: Application to run (use it instead of specifying context, extension and priority)

    • Data: The options to be passed to the application

Use Callfile in dialplan

Create a script file in /var/www/scripts dir.

...

Code Block
------------------------------------------------------
#! /bin/sh
cp /var/www/scripts/test.call /var/www/scripts/temp.call
mv /var/www/scripts/temp.call /var/spool/callweaver/outgoing/
------------------------------------------------------
Give permissions to execute the script.
#chmod +x /var/www/scripts/callfile.sh
Create a template file in /var/www/scripts dir.
Test.call
------------------------------------------------------
Channel: SIP/0276510950/0970720101
Application: Playback
Data: 00000/callfile/message
---------------------------------------------------------


Call a remote script in dialplan.

PDF avoid Pagebreak

Image Modified

Use device comment field for customize CID of outgoing call

Set comment in WMS -> Devices for devices:

  • Double click on a device to edit it

  • Fill out the “Comment” field and click Save


PDF avoid Pagebreak

Image Modified


In users dialplan add the following Custom apps:

PDF avoid Pagebreak

Image Modified


Set(Useragent=${SIPCHANINFO(useragent)})

...

Prior to this, you should create  dialplans named like this users_${Descript} and another one -- users_default in our example -- for calls don’t match to a device with comment field.

PDF avoid Pagebreak

Image Modified


PDF avoid Pagebreak

Image Modified

External outgoing call with audio file playback

...

Dial(SIP/0123456789/${EXTEN:3},30,A(00000/Message/Recording) - in this example SIP trunk is used and ${EXTEN:3} removes 3 first digits from the called number.

What else can you do with Custom Dialplan Apps?

Delayed Paging

Read the doc: Delayed Paging

Notify callers of call recording

Read the doc: How to notify callers of call recording

Callback feature for Call groups

Read the docHow to enable Callback feature for Call groups

Director-Secretary configuration

Read the docDirector - Secretary configuration

Initiate an audio conference using API Originate

Read the doc: How to automatically initiate an audio conference using API Originate

Block outgoing calls from hotel rooms

Read the doc: How to block outgoing calls from hotel rooms

Change Voicemail PIN from a phone

Read the docHow to change Voicemail PIN from a phone

Automatically generate a call and play a voice message

Read the docAutomatically Generate a Call and Play a Recording

Record multiple answers from a caller and combine them into one file

Read the docRecording multiple answers from a caller and combining them into one file

...