1. Cut - this application allows you to split the content of a variable by using a specified delimiter.
NOTE: This application is valid for Asterisk version 1.0.9 and 1.0.10.
If you are using version 1.2 or newer, then you have to know that this application is deprecated. However, if you want to use its functionality, there is a new syntax, which require the usage of the Set application. For more information click on the link - The new syntax - the CUT function.
Syntax:
Cut(newvar=varname,delimiter,fieldspec)
List with the possible options
newvar - The new variable where you want to put the already cut file. varname - this is the variable which content you would like to split. delimiter - the delimiter is set by default to "-" fieldspec - number of the field you want (1-based offset). It may also be specified as a range (with -) or group of ranges and fields (with &)
Purpose and usage
The purpose of this application is to give you an access to the Asterisk`s voicemail system. You will be asked to enter a voicemail number and password.
The usage is obvious. Thanks to this application you can check your voicemail box for new messages. Once you have entered the system, you can also manage your messages and folders. You can even record your own greeting message. The Asterisk system will guide you through the menus.
This application could be used with the ChanIsAvail one.
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.
We used a similar example when we explained the application. The idea is that the return result from the application has an unnecessary attachment. SO, In order to use this result for something(for example to dial this channel), we have to Cut this unnecessary attachment.
In our example when somebody dials 1212, the call will be answered by the Answer application. The next executed extension will be the one which contains the ChanIsAvail application. It will check whether the set channel is free or not. If the channel is available then it will be set in the ${CHANISAVAIL} variable. In our case the result in the variable will be IAX2/10.3.3.35:4569/3. To find out this we have used the NoOp application.
We need only the first four signs before the first "/" character. We need the IAX2 abbreviation.
We have to Cut the unnecessary part. For that purpose we will use the application Cut. The first thing which we have to write in its brackets is the name of the desired new variable. In our example this is NewVar. Then the variable is followed by the "=" character and then by the AVAILCHAN variable.
The next argument is the delimiter. By default it is set to "-". In our case we will change it to the /character.
The last argument is the fieldspec one. We have set this parameter to 1, which means that the application will Cut all characters before the first "/" character. In other words, the application will start from the first sign and it will cut the following characters until it reaches the first "/" character. The cut characters will be saved in the variable NewVar. In our case these characters are IAX2.
NOTE: Please, pay attention, that the both variables are without the "${}" characters. In our example: exten => 1212,2,Cut(NewVar=AVAILCHAN,/,1).
We use another NoOp application to check whether the result is the desired one. In our case this application returns IAX2, which is exactly what we have wanted.
So, lets use this variable for something. Lets call an user through the available channel. For that purpose we will use the Dial application. As argument in its brackets we will set the following: ${NewVar}/user1. Actually, ${NewVar} contains the IAX2 string, so the user user1 will be called through the channel IAX2.
Please pay attention that here, the variable NewVar is used with the ${} characters.
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
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
User Comments
Coorousia (Almorette at abdulah dot xyz) 12 June 2021 22:49:37 <a href=https://vslasixv.com>lasix pay online american express
Coorousia (Almorette at abdulah dot xyz) 25 May 2021 21:11:31 <a href=https://fcialisj.com/>buy cialis online safely
Winstonbloon (ddhetr554wn at gmail dot com) 08 March 2017 07:09:33 thanks towards this countless informative website, keep up the massive undertaking check out this <a href=http://onlinecasinos-x.com>casino online</a> offers , buy <a href=http://www.sextoysfun.net>sex toys</a>