• Idefisk
  • Tools
  • Tutorials
  • Reviews
  • VoIP Providers
  • Archives
ZOIPER softphone
Back to Tutorials

6.1.2.39. MacroExit (dialplan application)

1. MacroExit - this application allows you to exit from a macro, without waiting it to execute all its extensions.

NOTE: This application is valid for Asterisk version 1.0.9 and above.

 


Syntax:

MacroExit()

 


Purpose and usage

The purpose of this extension is to allow you, to exit from the macro context, whenever you want. Any extensions, in the macro context, after this application won`t be executed.

Below, we will give you an example.

 


Prerequisites

To use this application you need a working Asterisk PBX with registered users in iax.conf, sip.conf or mgcp.conf(It depends on which protocol you would like to use) and made extensions. Also you need to create [macro-name] contexts in extensions.conf file.

To see how the application works we recommend to use our IAX softphone Idefisk. You can download it from here. Please also read our tutorial to learn how to configure it to work with Asterisk PBX.

 


Asterisk PBX configurations

NOTE: This is only an example of what for you can use this application. Of course you can use it and for other things.


iax.conf Configurations

We need one registered user in iax.conf file. This is because we are going to use the IAX2 protocol. If you want to use other protocol such as SIP or MGCP, you have to do the configurations below respectively in sip.conf or mgcp.conf.

iaxoneuser.jpg

So, we have registered the user user1.

Type=friend means that this user can make and receive calls. Host=dynamic means that the IP is not static but dynamic through a DHCP server. Allow=all means that the line which this user will use, could support all audio codecs. Context=test - this shows that this user is working with the extensions in this context of the configuration file extensions.conf.


extensions.conf Configurations

Now, lets take a look at the extensions.conf file.

extmacroexit.jpg

On the picture above you can see our extensions.conf file.

First of all, we will create a macro called [macro-testmacro]. In this macro we will create the following extensions:

-An extension with the GoToIfTime application. This extension will check whether the current time matches the specified one in the brackets. If they do not match, then the next executed extension will be the one with priority 2. This extension contains the Playback application. Thanks to it the caller will hear a welcome message.

-Then the next extension will be executed. It contains the Dial application. Thanks to it the call will be connected to the user user1 through the IAX2 channel. Then we have an extension with the Hangup application. It will hang up the line after the conversation is over.

-If the current and the specified time match, then the next executed extension will be the one with priority 102. This extension again contains the Playback application. Thanks to it the caller will hear a sound message. In our case this is the message, which announce lunch time. If you would like, you can specify another sound message. The sound files are store by default in the directory var/lib/asterisk/sounds.

-Then we have the MacroExit application. It will cause the exit from the macro.
In our case this application is in the last extension of the macro. However, you can put it wherever you want in the macro, but remember that any extension after this application won’t be executed.

Now, when somebody dials 1111, the call will be answered by the Answer application. The next executed extension will be the one which contains the Macro application. As arguments in its brackets, we have to write the name of the macro context, which we would like to be executed. Not the whole name, but only the part of the name, after the dash character. In our case the whole name of the macro context is: macro-testmacro. We have to write in the brackets only: testmacro. So, this context will be executed and the operations, which we have explained above, will be executed.

Finally, in order to be sure that the Asterisk PBX will hang up the line after the conversation is over, it is a good idea to make an extension for hanging up the line.

 


2. Screenshots of what you can see on the CLI of the Asterisk PBX

climacroexit.jpg

 


3. Additional information

For more information about extensions.conf you can check here.
For more information about iax.conf you can check here.

This application is tested with our IAX softphone Idefisk. You can download it from here. For more information about this softphone please read our tutorial.

If you would like to test this application with the SIP channel you can read our tutorials about the SIP Softphones to learn how to configure them to work with Asterisk PBX

 


4. Uploaded files

extensions.conf
iax.conf

 


5. Similar dialplan applications

MacroIf()
Macro()

 

 
User Comments
cialis online no prior prescription (myrna dot mcgill at grassfed dot us)
02 August 2020 11:57:33
cialis online no prior prescription https://www.wisig.org/
ed remedies (mapleeasterby at disposable dot ml)
08 July 2020 00:12:45
ed remedies http://www.cialij.com/
Karson (7yakfa7s at gmail dot com)
18 November 2016 02:44:39
This <a href="http://hntjbwvvhth.com">webtsie</a> makes things hella easy.
Essy (s5badw93mte at hotmail dot com)
09 November 2016 09:36:02
<a href="http://orihtlfnuq.com">Intghiss</a> like this liven things up around here.
 
Add Comment
Name:
Email:
Comment:
In order to prevent automatic posting on our website, we kindly request you to type in the number you see in the picture below.
Image Verification:
 

Latest Headlines:

  • T.38 faxing with Zoiper 2.15 is now easier than ever
    section: voip software
  • Asterisk 1.4.21 Released
    section: Asterisk
  • Asterisk 1.4.20 Released
    section: Asterisk
  • Asterisk 1.4.20-rc2 Released
    section: Asterisk
  • Asterisk 1.4.20-rc1 Now Available
    section: Asterisk
  • News Archives (older news)

Latest Tutorials:

  • Sending Fax from Zoiper to Zoiper using T.38
    added 08/Dec/2008 18:16
  • VMAuthenticate (dialplan application)
    added 01/Mar/2008 15:57
  • Siptronic ST-530
    added 06/Nov/2007 17:57
  • Siemens C455 IP hardphone
    added 05/Nov/2007 10:24
  • Zoiper
    added 22/Oct/2007 17:53

Latest Comments:

  • https://git-ce.rwth-aachen.de/mbd/kiste_...
    tutorial: Basic Information
  • https://git-ce.rwth-aachen.de/mbd/kiste_...
    tutorial: Basic Information
  • https://www.thebeachlittlehampton.co.uk/...
    tutorial: Digium Wildcard TE405 / Wildcard TE410P
  • https://www.viessmann-community.com/t5/R...
    tutorial: Asterisk Installation
  • https://d2l.msu.edu/d2l/eP/presentations...
    tutorial: Asterisk Realtime configuration
 
contact us at: support@asteriskguru.com - asterisKGuru.com © all rights reserved   |   *asterisk is registered trademark of © Digium™