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

How to use Functions on Asterisk Dialplan Context

  • 00:43 lsb_release -a
  • 00:58 systemctl status asterisk
  • 01:24 cd /etc/asterisk/
  • 01:40 vim extensions.conf
  • 07:02 asterisk -rvvvvvvvvvvvvvvvvvvvvvvvv
  • 07:16 dialplan reload
7609

To Use Function 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. Dialplan Functions tend to be geared towards manipulating channel data and attributes as well as providing general tools for manipulating data in variables and expressions, whether they are channel related or not.

Procedure

Step 1: Check the OS version by using the below command

root@linuxhelp1:~# lsb_release -a
No LSB modules are available.
Distributor ID:    Ubuntu
Description:    Ubuntu 22.04.2 LTS
Release:    22.04
Codename:    jammy

Step 2: Check the status of the Asterisk by using the below command

root@linuxhelp1:~# systemctl status asterisk
● asterisk.service - LSB: Asterisk PBX
     Loaded: loaded (/etc/init.d/asterisk; generated)
     Active: active (running) since Wed 2023-07-26 07:30:54 IST; 28min ago
       Docs: man:systemd-sysv-generator(8)
    Process: 1428 ExecStart=/etc/init.d/asterisk start (code=exited, status=0/SUCCESS)
      Tasks: 72 (limit: 4537)
     Memory: 131.9M
        CPU: 21.198s
     CGroup: /system.slice/asterisk.service
             └─1451 /usr/sbin/asterisk
Jul 26 07:30:54 linuxhelp1 systemd[1]: Starting LSB: Asterisk PBX...
Jul 26 07:30:54 linuxhelp1 asterisk[1428]:  * Starting Asterisk PBX: asterisk
Jul 26 07:30:54 linuxhelp1 asterisk[1428]:    ...done.
Jul 26 07:30:54 linuxhelp1 systemd[1]: Started LSB: Asterisk PBX.
Jul 26 07:31:04 linuxhelp1 asterisk[1451]: radcli: rc_read_config: rc_read_config: can't open />
Jul 26 07:31:04 linuxhelp1 asterisk[1451]: radcli: rc_read_config: rc_read_config: can't open />

Step 3: Move to the Asterisk directory by using the below command

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

Step 4: Edit the extensions.conf file to modify the dialplan by using the below command

root@linuxhelp1:/etc/asterisk# vim extensions.conf

Step 5: Add the below lines in the extensions.conf file by using the below command

[internal]
exten => _XXX,1,NoOp(Call Started for ${EXTEN})
exten => _XXX,n,Set(TIMEOUT(response)=10)
exten => _XXX,n,Playback(enter-phone-number10)
exten => _XXX,n,WaitExten()
exten => 168,1,Dial(PJSIP/168,10)
exten => 168,2,Hanhup()

Step 6: Login to the Asterisk CLI mode by using the below command

root@linuxhelp1:/etc/asterisk# asterisk -rvvvvvvvvvvvvvvvvvvvvvvvv
Asterisk 20.3.1, 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.3.1 currently running on linuxhelp1 (pid = 1451)

Step 7: Reload the Dialplan by using the below command

linuxhelp1*CLI> dialplan reload
Dialplan reloaded.
    -- Including switch 'DUNDi/e164' in context 'ael-dundi-e164-switch'
    -- Including switch 'Lua/' in context 'default'
    -- Including switch 'Lua/' in context 'local'
    -- Including switch 'Lua/' in context 'public'
    -- Including switch 'Lua/' in context 'demo'
    -- Time to scan old dialplan and merge leftovers back into the new: 0.001115 sec
    -- Time to restore hints and swap in new dialplan: 0.000007 sec
    -- Time to delete the old dialplan: 0.000103 sec
    -- Total time merge_contexts_delete: 0.001225 sec
    -- pbx_config successfully loaded 27 contexts (enable debug for details).
    -- Added contact 'sip:167@192.168.6.101:51040;transport=TCP;ob' to AOR '167' with expiration of 300 seconds
  == Endpoint 167 is now Reachable
    -- Contact 167/sip:167@192.168.6.101:51040;transport=TCP;ob is now Reachable.  RTT: 6.149 msec

Output : 

    -- Executing [111@internal:1] NoOp("PJSIP/168-00000000", "Call Started for 111") in new stack
    -- Executing [111@internal:2] Set("PJSIP/168-00000000", "TIMEOUT(response)=10") in new stack
    -- Response timeout set to 10.000
    -- Executing [111@internal:3] Playback("PJSIP/168-00000000", "enter-phone-number10") in new stack
       > 0x7f1580028060 -- Strict RTP learning after remote address set to: 192.168.6.101:4000
       > 0x7f1580028060 -- Strict RTP learning after remote address set to: 192.168.6.101:4000
    -- <PJSIP/168-00000000> Playing 'enter-phone-number10.ulaw' (language 'en')
       > 0x7f1580028060 -- Strict RTP switching to RTP target address 192.168.6.101:4000 as source
    -- Executing [111@internal:4] WaitExten("PJSIP/168-00000000", "") in new stack
       > 0x7f1580028060 -- Strict RTP learning complete - Locking on source address 192.168.6.101:4000
    -- Executing [168@internal:1] Dial("PJSIP/168-00000000", "PJSIP/168,10") in new stack
    -- Called PJSIP/168
    -- PJSIP/168-00000001 is ringing
  == Spawn extension (internal, 168, 1) exited non-zero on 'PJSIP/168-00000000'

Conclusion:

By this how to use Functions on Asterisk Dialplan Context has come to an end.

Tags:
grayson
Author: 

Comments ( 0 )

No comments available

Add a comment

Frequently asked questions ( 5 )

Q

What is Dialplan in Asterisk?

A

The Asterisk Dialplan is responsible for routing calls, so it is often referred to as the heart of an Asterisk system.

Q

What are extensions in Asterisk?

A

An extension is simply a named set of actions.

Q

What is the channel in the Asterisk?

A

A channel is an entity inside Asterisk that acts as a channel of communication between Asterisk and another device.

Q

What is the function used for Getting or setting timeouts on the channel.?

A

The function used for Getting or setting timeouts on the channel is TIMEOUT

Q

What is the syntax of the TIMEOUT?

A

TIMEOUT(timeouttype)

Related Tutorials in How to use Functions on Asterisk Dialplan Context

Related Tutorials in How to use Functions on Asterisk Dialplan Context

How to install Meld tool in Ubuntu
How to install Meld tool in Ubuntu
Feb 25, 2017
How to install Dconf-Editor on Ubuntu 18.04
How to install Dconf-Editor on Ubuntu 18.04
Jul 14, 2018
How to install and update OpenSSL on Ubuntu 16.04
How to install and update OpenSSL on Ubuntu 16.04
Mar 9, 2017
How to install GLib 2.0 on Ubuntu 17.04
How to install GLib 2.0 on Ubuntu 17.04
May 22, 2017
How to Install Android Emulator on Ubuntu 20.4.1
How to Install Android Emulator on Ubuntu 20.4.1
Jul 13, 2021
How To Install AnyDesk on Ubuntu 16.04
How To Install AnyDesk on Ubuntu 16.04
Apr 4, 2018
How to install Genymotion 2.12.1 on Ubuntu 18.04
How to install Genymotion 2.12.1 on Ubuntu 18.04
Jul 9, 2018
How to install Timeshift 18.4 on Ubuntu 18.04
How to install Timeshift 18.4 on Ubuntu 18.04
Jul 6, 2018

Related Forums in How to use Functions on Asterisk Dialplan Context

Related Forums in How to use Functions on Asterisk Dialplan Context

Linux
jayce class=
shasum command not found
May 5, 2017
Ubuntu
matthew class=
Failed to enable unit: Refusing to operate on linked unit file sshd.service
Apr 15, 2019
Linux
stephan class=
How to list all samba users
Jan 12, 2018
Ubuntu
mason class=
Passwd: You may not view or modify password information for root On Ubuntu 19.04
May 27, 2019
Ubuntu
isaac class=
/etc/apt/sources.list Permission denied
May 18, 2017
pv command
muhammad class=
pvcreate command not found error
May 9, 2017
Linux
henry class=
Starting NFS daemon: rpc.nfsd: writing fd to kernel failed: errno 111 (Connection refused)
Apr 25, 2017
Ubuntu
yousuf class=
lsb_release command not working : Debian
Jan 18, 2018

Related News in How to use Functions on Asterisk Dialplan Context

Related News in How to use Functions on Asterisk Dialplan Context

Anbox, the Android-to-Linux tool the developers have been waiting for
Anbox, the Android-to-Linux tool the developers have been waiting for
Apr 17, 2017
How To Install Mixxx on Ubuntu 16.04
How To Install Mixxx on Ubuntu 16.04
Oct 11, 2017
Linus Torvalds stops signing Linux kernel RC tarballs
Linus Torvalds stops signing Linux kernel RC tarballs
May 17, 2017
Ubuntu 17.04 released with greater expectations
Ubuntu 17.04 released with greater expectations
Apr 15, 2017
Capsule8 Launches Linux-Based Container Security Platform
Capsule8 Launches Linux-Based Container Security Platform
Feb 14, 2017
Ubuntu Core now available on i.MX6 based TS-4900 thanks to Technologic Systems Inc.
Ubuntu Core now available on i.MX6 based TS-4900 thanks to Technologic Systems Inc.
Mar 1, 2017
Symantec updates Management console product
Symantec updates Management console product
Nov 22, 2017
Latest Linux driver release feature seven AMD Vega
Latest Linux driver release feature seven AMD Vega
Mar 23, 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 Elijah ?
Remote Desktop Connection Has Stopped Working

When accessing my remote machine server using remote desktop on a windows machine I am getting this error

forum (1)

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.