• Categories
    Category
  • Categories
    Category
  • News
  • Tutorials
  • Forums
  • Tags
  • Users
Tutorial Comments FAQ Related Articles

How to use Asterisk Dialplan Functions on Debian 12

  • 00:30 lsb_release -a
  • 00:44 cd /etc/asterisk/
  • 01:00 vim extensions.conf
  • 02:10 sudo asterisk -rvvvvvvvvvvvvvvv
  • 02:22 dialplan reload
  • 03:13 core show functions
7661

To Use Functions On Asterisk Dialplan Context

Introduction:

Asterisk functions are very similar to functions in many programming languages. Functions are: Sophisticated subroutines that help you manipulate data in a variety of ways. Callable from within Dialplan and Asterisk's various interfaces.

Procedure:

Step 1: Check the OS version by using following command.

root@linuxhelp:~# lsb_release -a
No LSB modules are available.
Distributor ID:	Debian
Description:	Debian GNU/Linux 12 (bookworm)
Release:	12
Codename:	bookworm

Step 2: Goto the following location by using following command.

root@linuxhelp:~# cd /etc/asterisk/

Step 3: Edit the extensions.conf file for use dialplan functions by using following command.

root@linuxhelp:/etc/asterisk# vim extensions.conf
[internal]
exten => 110,1,NoOp(Result for my function: ${CALLERID(all)})
same => n,Dial(PJSIP/110, 20)
same => n,Playback(sorry_didnt_get)
same => n,Hangup()

exten => 111,1,NoOp(Print the context)
same => n,Dial(PJSIP/111, 20)
same => n,Playback(sorry_didnt_get)
same => n,Hangup()

exten => 112,1,NoOp()
same => n,Dial(PJSIP/112, 20)
same => n,Playback(sorry_didnt_get)
same => n,Hangup()

Step 4: Login to the asterisk console by using following command.

root@linuxhelp:/etc/asterisk# sudo asterisk -rvvvvvvvvvvvvvvv
Asterisk 20.4.0, Copyright (C) 1999 - 2022, Sangoma Technologies Corporation and others.
Created by Mark Spencer <markster@digium.com>
Asterisk comes with ABSOLUTELY NO WARRANTY; type 'core show warranty' for details.
This is free software, with components licensed under the GNU General Public
License version 2 and other licenses; you are welcome to redistribute it under
certain conditions. Type 'core show license' for details.
=========================================================================
Connected to Asterisk 20.4.0 currently running on linuxhelp (pid = 953)

linuxhelp*CLI>

Step 5: Reload the dialplan by using following command.

linuxhelp*CLI> dialplan reload
Dialplan reloaded.
    -- Time to scan old dialplan and merge leftovers back into the new: 0.000006 sec
    -- Time to restore hints and swap in new dialplan: 0.000006 sec
    -- Time to delete the old dialplan: 0.000006 sec
    -- Total time merge_contexts_delete: 0.000018 sec
    -- pbx_config successfully loaded 1 contexts (enable debug for details).

Step 6: Make a Call to Check Dialplan Functions by using Softphone Softwares. snap 1

linuxhelp*CLI> 
    -- Executing [110@internal:1] NoOp("PJSIP/112-00000010", "Result for my function: "linuxhelp3" <112>") in new stack
    -- Executing [110@internal:2] Dial("PJSIP/112-00000010", "PJSIP/110, 20") in new stack
    -- Called PJSIP/110
    -- PJSIP/110-00000011 is ringing
    -- Nobody picked up in 20000 ms
    -- Executing [110@internal:3] Playback("PJSIP/112-00000010", "sorry_didnt_get") in new stack
       > 0x7f5708012710 -- Strict RTP learning after remote address set to: 192.168.6.102:8000
       > 0x7f5708012710 -- Strict RTP switching to RTP target address 192.168.6.102:8000 as source
    -- <PJSIP/112-00000010> Playing 'sorry_didnt_get.ulaw' (language 'en')
    -- Executing [110@internal:4] Hangup("PJSIP/112-00000010", "") in new stack
  == Spawn extension (internal, 110, 4) exited non-zero on 'PJSIP/112-00000010'

Step 7: Check all the functions of asterisk by using following command.

linuxhelp*CLI> core show functions
Installed Custom Functions:
--------------------------------------------------------------------------------
AMI_CLIENT            AMI_CLIENT(loginname,field)          Checks attributes of manager accounts 
ARRAY                 ARRAY(var1[,var2[,...][,varN]])      Allows setting multiple variables at once. 


AST_SORCERY           AST_SORCERY(module_name,object_type  Get a field from a sorcery object 
CALLERID              CALLERID(datatype[,CID])             Gets or sets Caller*ID data on the channel. 
CDR                   CDR(name[,options])                  Gets or sets a CDR variable. 
CDR_PROP              CDR_PROP(name)                       Set a property on a channel's CDR. 
CONFBRIDGE            CONFBRIDGE(type,option)              Set a custom dynamic bridge, user, or menu profile on a channel for the ConfBridge application using the same options available in confbridge.conf. 
CONFBRIDGE_CHANNELS   CONFBRIDGE_CHANNELS(type,conf)       Get a list of channels in a ConfBridge conference. 
CONFBRIDGE_INFO       CONFBRIDGE_INFO(type,conf)           Get information about a ConfBridge conference. 
CONNECTEDLINE         CONNECTEDLINE(datatype[,i])          Gets or sets Connected Line data on the channel. 
CSV_QUOTE             CSV_QUOTE(string)                    Quotes a given string for use in a CSV file, escaping embedded quotes as necessary 
DEVICE_STATE          DEVICE_STATE(device)                 Get or Set a device state. 
EVAL                  EVAL(variable)                       Evaluate stored variables 
EXCEPTION             EXCEPTION(field)                     Retrieve the details of the current dialplan exception. 
FEATURE               FEATURE(option_name)                 Get or set a feature option on a channel. 
FEATUREMAP            FEATUREMAP(feature_name)             Get or set a feature map to a given value on a specific channel. 
FIELDNUM              FIELDNUM(varname,delim,value)        Return the 1-based offset of a field in a list 
FIELDQTY              FIELDQTY(varname,delim)              Count the fields with an arbitrary delimiter 
FILTER                FILTER(allowed-chars,string)         Filter the string to include only the allowed characters 
HASH                  HASH(hashname[,hashkey])             Implementation of a dialplan associative array 
HASHKEYS              HASHKEYS(hashname)                   Retrieve the keys of the HASH() function. 
HINT                  HINT(extension[@context][,options])  Get the devices set for a dialplan hint. 

Conclusion:

We have reached the end of this article. In this guide, we have walked you through the steps required to use Asterisk Dialplan Functions on Debian 12. Your feedback is much welcome.

Tags:
grayson
Author: 

Comments ( 0 )

No comments available

Add a comment

Frequently asked questions ( 5 )

Q

What is an Asterisk dialplan function?

A

- An Asterisk dialplan function is a built-in feature that allows you to perform various tasks and manipulate data within the Asterisk dialplan. These functions enable you to work with variables, strings, numbers, and more.

Q

How do I use dialplan functions in Asterisk?

A

To use a dialplan function, you typically enclose it in `${}` and provide any required arguments. For example, `${FUNCNAME(argument)}`.

Q

What are some common dialplan functions?

A

Common dialplan functions include `SET`, `EXTEN`, `CALLERID`, `STRFTIME`, `LEN`, `TIMEOUT`, and many more. These functions serve different purposes, such as setting variables, formatting time, and manipulating strings.

Q

Can I create custom dialplan functions?

A

Yes, you can create custom dialplan functions using Asterisk's "FUNC_ODBC" or by writing custom dialplan code in extensions.conf. This allows you to implement custom logic and data retrieval.

Q

How do I retrieve the current extension in Asterisk?

A

You can use the `${EXTEN}` dialplan function to retrieve the current extension being dialed in Asterisk.

Related Tutorials in How to use Asterisk Dialplan Functions on Debian 12

Related Tutorials in How to use Asterisk Dialplan Functions on Debian 12

How to install Gparted on Debian 9.0
How to install Gparted on Debian 9.0
Sep 13, 2017
Installation SSL Certificate on Ubuntu/Linuxmint/Debian to Secure Apache
Installation SSL Certificate on Ubuntu/Linuxmint/Debian to Secure Apache
Sep 19, 2018
How to install and update OpenSSL on Debian 11.3
How to install and update OpenSSL on Debian 11.3
Oct 21, 2022
How to install qBittorrent on Debian 9.0
How to install qBittorrent on Debian 9.0
Sep 8, 2017
How to Install FileZilla in Debian
How to Install FileZilla in Debian
Nov 29, 2016
How to install Nmap on Debian 9.0
How to install Nmap on Debian 9.0
Sep 9, 2017
How to Install Laravel in Debian
How to Install Laravel in Debian
Dec 7, 2016
How to install and configure Asterisk in CentOS
How to install and configure Asterisk in CentOS
Jul 19, 2016

Related Forums in How to use Asterisk Dialplan Functions on Debian 12

Related Forums in How to use Asterisk Dialplan Functions on Debian 12

MariaDB
ryan class=
E: Unable to locate package mariadb-server
Sep 18, 2017
Linux
AadrikaAnshu class=
How to add timestamps to history On Any Linux Machine
Jun 18, 2019
vim
jacob class=
Change true vi-compatible editor from Debian Vim-compatible
Nov 8, 2021
debian
anandaamatya class=
RedNotebook on Debian buster
Jun 30, 2020
Ubuntu
Kirin class=
Videos Always Micro-Shutter
Mar 8, 2019
debian
luke class=
workbench for debian
May 26, 2017
debian
teddybarax class=
Softwae installation problem
Aug 24, 2020
debian
colbyvance class=
Trouble Installing Debian 10.8.0 (Gnome)
Feb 28, 2021

Related News in How to use Asterisk Dialplan Functions on Debian 12

Related News in How to use Asterisk Dialplan Functions on Debian 12

Debian IceDove kicks the bucket after Thunderbird revisits Debian Repositories
Debian IceDove kicks the bucket after Thunderbird revisits Debian Repositories
Feb 28, 2017
Mass update of Jessie - A better alternative to new version?
Mass update of Jessie - A better alternative to new version?
May 8, 2017
Debian 9.2 ‘Stretch’ OS is here, download distro now
Debian 9.2 ‘Stretch’ OS is here, download distro now
Oct 9, 2017
Back To Top!
Rank
User
Points

Top Contributers

userNamenaveelansari
135850

Top Contributers

userNameayanbhatti
92510

Top Contributers

userNamehamzaahmed
32150

Top Contributers

1
userNamelinuxhelp
31040

Top Contributers

userNamemuhammadali
24500
Can you help keel johnston ?
Unhide the folders on windows Explorer

Give any solutions to unhide folder using command prompt?

forum3

Networking
  • Routing
  • trunk
  • Netmask
  • Packet Capture
  • domain
  • HTTP Proxy
Server Setup
  • NFS
  • KVM
  • Memory
  • Sendmail
  • WebDAV
  • LXC
Shell Commands
  • Cloud commander
  • Command line archive tools
  • last command
  • Shell
  • terminal
  • Throttle
Desktop Application
  • Linux app
  • Pithos
  • Retrospect
  • Scribe
  • TortoiseHg
  • 4Images
Monitoring Tool
  • Monit
  • Apache Server Monitoring
  • EtherApe 
  • Arpwatch Tool
  • Auditd
  • Barman
Web Application
  • Nutch
  • Amazon VPC
  • FarmWarDeployer
  • Rukovoditel
  • Mirror site
  • Chef
Contact Us | Terms of Use| Privacy Policy| Disclaimer
© 2025 LinuxHelp.com All rights reserved. Linux™ is the registered trademark of Linus Torvalds. This site is not affiliated with linus torvalds in any way.