1. Prefix - this application allows you to set digits which to be added to the digits from the extension.

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

NOTE: After Asterisk version 1.2.6 this application is completely obsolete and has been removed.

Syntax:

Prefix(digits)

Purpose and usage

The purpose of this application is to allow you to add an additional digits in front of already existing extension number. In this way you can easily change the extension number. This feature is useful within big and complicated dialplans.

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.

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.

In our example when somebody dials 1111, the call will be answered by the Answer application. The next executed extension will be the one which contains the SendText application. Thanks to it, we will check the content of the ${EXTEN} variable. It should be the number of the dialed extension. In our example the application will send a message to the caller with the following text: The current extension is: 1111.

The next executed extension will be the one with the Wait application. It will give us a time before the next message. We have set the time to 5 seconds.

The next executed extension will be the one with the Prefix application. In its brackets we have set the following: 1010. This will cause the change of the number of the next executed extension. In other words, what we have set as argument in the brackets will be added to the number of the next executed extension. It will be added in front of the number. The number in our case will be 10101111.

Now, the number of the next extension - the one with priority 5, should be 10101111 instead of 1111. This extension will use again the SendText application to check what is the new content of the variable ${EXTEN}. It should be 10101111. Thanks to this application, on the screen of the caller will be displayed the following message: The new extension number is: 10101111.

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 your Idefisk and on the CLI of the Asterisk PBX

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

Javier (8tb3lo09f at gmail dot com)18 December 2015 10:14:31Sanjay,Can you get the hylafax+asterisk+iaxmodem setup to work with Google Voice as a trunk? I have my gogloe voice working as a SIP trunk. I just wondering if i can use it for faxing (most T38) which is more reliable than analog faxing which is succeptable to channel jitter and other noise.By the way, I am using plain asterisk 1.8. Can you provide dial plan (extension.conf) and iax.conf and other files configuration setup?

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.