• Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • Categories
    Category
    {{ postCtrl.tags }}
    • {{ category.tag_type }}

      • {{tag.tag_name}}
      • View more
  • News
  • Tutorials
  • Forums
  • Tags
  • Users
Tutorial News Comments FAQ Related Articles

How to use Asterisk Goto and GotoIf application on Debian 12

  • 00:32 cat /etc/os-release
  • 00:43 cd /etc/asterisk
  • 00:58 vim extensions.conf
  • 01:17 asterisk -rvvvvvvvvvvvvvvvvvvvv
  • 01:31 dialplan reload
  • 02:35 vim extensions.conf
  • 03:21 dialplan reload
  • 04:17 vim extensions.conf
  • 06:15 dialplan reload
  • 07:03 vim extensions.conf
  • 07:26 dialplan reload
{{postValue.id}}

To Use Asterisk Goto And GotoIf Application On Debian 12

Introduction:

Goto allows jumping to a specific context, extension, or priority, while GotoIf enables conditional branching based on certain conditions, providing flexibility in call routing.

Procedure:

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

root@linuxhelp:~# cat /etc/os-release
PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
NAME="Debian GNU/Linux"
VERSION_ID="12"
VERSION="12 (bookworm)"
VERSION_CODENAME=bookworm
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL=https://bugs.debian.org/

Step 2: Go to Following Location by using the below command.

root@linuxhelp:~# cd /etc/asterisk

Step 3: Open and Check extensions.conf file for dialplan configuration by using the below command.

root@linuxhelp:/etc/asterisk# vim extensions.conf
[internal]

exten => 110,1,NoOp(Print the context)
same => n,Dial(PJSIP/110,10)
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(Print the context)
same => n,Dial(PJSIP/112, 20)
same => n,Playback(sorry_didnt_get)
same => n,Hangup()

Step 4: Open another tab in the terminal as shown in below image. snap 1

Step 5: Login to the Asterisk Console by using following command.

root@linuxhelp:~# asterisk -rvvvvvvvvvvvvvvvvvvvv
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 = 1043)
linuxhelp*CLI>

Step 6: Reload the dialplan by using the below command.

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

Step 7: Check the connections by making call by using MicroSIP Software as shown in below image. snap 2

Step 8: Open and edit the extensions.conf file for use Goto application by using the below command.

root@linuxhelp:/etc/asterisk# vim extensions.conf
[internal]

exten => 110,1,NoOp(Print the context)
same => n,Goto(111,2)
same => n,Dial(PJSIP/110,10)
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(Print the context)
same => n,Dial(PJSIP/112, 20)
same => n,Playback(sorry_didnt_get)
same => n,Hangup()

Step 9: Goto the asterisk console and reload dialplan by using the below command.

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

Step 10: Again, Check the connections by making call by using MicroSIP Software as shown in below image. snap 3

Step 11: Again, Open and Edit the extensions.conf file for use GotoIf application by using the below command.

root@linuxhelp:/etc/asterisk# vim extensions.conf
[internal]

exten => 110,1,NoOp(Print the context)
same => n,SET(TEST=1)
same => n,GotoIf($[ ${TEST} = 1]?111,2:110,4)
same => n,Dial(PJSIP/110,10)
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(Print the context)
same => n,Dial(PJSIP/112, 20)
same => n,Playback(sorry_didnt_get)
same => n,Hangup()

Step 12: Goto the asterisk console and reload dialplan by using the below command.

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

Step 13: Check the connections by making call by using MicroSIP Software as shown in below image. snap 4

Step 14: Open and edit the extensions.conf file for make some changes in the GotoIf conditions by using the below command.

root@linuxhelp:/etc/asterisk# vim extensions.conf
[internal]

exten => 110,1,NoOp(Print the context)
same => n,SET(TEST=2)
same => n,GotoIf($[ ${TEST} = 1]?111,2:110,4)
same => n,Dial(PJSIP/110,10)
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(Print the context)
same => n,Dial(PJSIP/112, 20)
same => n,Playback(sorry_didnt_get)
same => n,Hangup()

Step 15: Goto the asterisk console and reload dialplan by using the below command.

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

Step 16: Again, Check the connections by making call by using MicroSIP Software as shown in below image. snap 5

Conclusion:

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

Tags:
grayson
Author: 

Comments ( 0 )

No comments available

Add a comment
{{postCtrl.cmtErrMsg}}

Frequently asked questions ( 5 )

Q

What is the purpose of the Goto application in Asterisk?

A

The Goto application in Asterisk is used to redirect the call flow to a specific context, extension, or priority within the dialplan.

Q

How can I implement the Goto application in my Asterisk configuration on Debian 12?

A

To use Goto, include it in your dialplan with the desired context, extension, and priority parameters. For example: `exten => s,n,Goto(mycontext,100,1)`.

Q

What does the GotoIf application do in Asterisk?

A

The GotoIf application allows conditional branching in the dialplan. It evaluates a condition and jumps to a specified location if the condition is met.

Q

How do I use GotoIf in my Asterisk dialplan on Debian 12?

A

To use GotoIf, specify a condition and the label to jump to if the condition is true. For instance: `exten => s,n,GotoIf($[${MYVAR} = 1]?true_label:false_label)`.

Q

Can I combine Goto and GotoIf in my dialplan?

A

Yes, you can use Goto and GotoIf together to create more complex call flow logic in your Asterisk configuration.

Load more

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 Ganesh Konka ?
Zentya 6.1 http proxy configuration

please send link for creating zentyal 6.1 for http proxy and firewall as gateway.

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.