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

6.1.1.13. MATH (dialplan function) - NEW

1. MATH - this function allows you to perform simple mathematical operations.

NOTE:Information about the Asterisk functions could be obtained by typing the show functions command.

Information about a particular function could be obtained by typing the show function <function name> on the Asterisk CLI command.

NOTE: In Asterisk versions 1.2 and up there are several applications which are mark as deprecated and which are no longer supported.

These applications will now become functions and these functions will be used in combination with the Set application.

You have to know that their functionality will be the same, but with a different syntax.

The MATH function is one of those new functions which will replace the old applications. In this tutorial we will show you its syntax and possible usage.

Check out the old syntax of the Math application here
 


Syntax:

Set(ReturnVar=${MATH(<parameter1>OPERATION<parameter2>,[result type])})

 


List of the possible options

ReturnVar - the variable, where the return result to be stored
parameter1 - the first digit
parameter2 - the second digit
OPERATION - the mathematical operation. It could be - +,-,/,*,%,<,>,>=,<=,==

 


Purpose and usage

The purpose of this function is obvious - it allows you to perform simple mathematical operations.

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. We are using Asterisk version1.2.1.

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

 


Asterisk PBX configurations

iax.conf Configurations

We need to create one user in the 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.

iaxlanguage.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.

EXTMATHnew.jpg

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

In this example, we will show you all the operation which the function could perform.

When somebody dials 100, the call will be answered by the Answer application.

Then we have an extension with the Set application. As arguments in its brackets we will set the following- NEWVAR=${MATH(1+20)}. This will perform the mathematical operation SUM in the brackets and then it will return the result in the NEWVAR variable.

We will use an extension with the NoOp application - to check the result.

Just to see the other possible mathematical operations we will use the same couple of applications.

So we have:

Set(NEWVAR=${MATH(3*10)})
NoOp(${NEWVAR})
Set(NEWVAR=${MATH(10/5)})
NoOp(${NEWVAR})
Set(NEWVAR=${MATH(20-10)})
NoOp(${NEWVAR})
Set(NEWVAR=${MATH(10-200)})
NoOp(${NEWVAR})
Set(NEWVAR=${MATH(1<20)})
NoOp(${NEWVAR})
Set(NEWVAR=${MATH(1>=20)})
NoOp(${NEWVAR})
Set(NEWVAR=${MATH(101>20)})
NoOp(${NEWVAR})
Set(NEWVAR=${MATH(1==20)})
NoOp(${NEWVAR})
Set(NEWVAR=${MATH(20<=20)})
NoOp(${NEWVAR})
Set(NEWVAR=${MATH(123%16)})
NoOp(${NEWVAR})
Set(NEWVAR=${MATH(1%16|i)})
NoOp(${NEWVAR})

As you could see in the last Set extension there is the letter i at the end. This indicates the desired result type. So i stands for integer.

The other possible types are:

- float (the default one) - use the letter f
- hex - use the letter h
- char - use the letter c

NOTE: The function MATH is case sensitive. You always have to write it in your dialplans with capital letters.

In order to be sure that the Asterisk PBX will hang up the line, when the conversation is over, it is a good idea to use the Hangup application.

 


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

cliMATHnew.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

More information about the Set application could be found here

 


4. Uploaded files

MATH.tar - configuration files

 

 
User Comments
sdgsefsef sefsefs (aawdawdawdawd at gmail dot com)
27 June 2024 17:20:32
https://www.scoop.it/topic/full-hd-xem-phim-nhung-ga-trai-hu-4-2024-vietsub-thuyet-minh
https://www.scoop.it/topic/xem-phim-full-hd-nhung-ga-trai-hu-4-2024-vietsub-thuyet-minh-truc-tuyen
https://github.com/Streaminge-Filme-en-Francaise/Nh-ng-G-Trai-H-4-Vietsub-Thuy-t-Minh-tr-c-tuy-n-Phimmoi
https://github.com/Streaminge-Filme-en-Francaise/Xem-phim-Full-HD-Nh-ng-G-Trai-H-4-2024-Vietsub-Thuy-t-Minh-tr-c-tuy-n
dsgdhftjftfhfth (anita dot maher01 at gmail dot com)
23 June 2024 20:34:10
https://www.taptap.io/post/7647066
https://www.taptap.io/post/7647070
https://www.taptap.io/post/7647073
https://www.taptap.io/post/7647086
https://www.taptap.io/post/7647090

https://www.taptap.io/post/7647106
https://www.taptap.io/post/7647109
https://www.taptap.io/post/7647115
https://www.taptap.io/post/7647118
https://www.taptap.io/post/7647120

https://www.taptap.io/post/7647128
https://www.taptap.io/post/7647130
https://www.taptap.io/post/7647133
https://www.taptap.io/post/7647139
https://www.taptap.io/post/7647140

https://www.taptap.io/post/7647143
https://www.taptap.io/post/7647246
https://www.taptap.io/post/7647250
https://www.taptap.io/post/7647254
https://www.taptap.io/post/7647256

https://www.taptap.io/post/7647263
https://www.taptap.io/post/7647265
https://www.taptap.io/post/7647269
https://www.taptap.io/post/7647270
https://www.taptap.io/post/7647273

https://www.taptap.io/post/7647275
https://www.taptap.io/post/7647281
https://www.taptap.io/post/7647285
https://www.taptap.io/post/7647289
https://www.taptap.io/post/7647291

https://www.taptap.io/post/7647295
https://www.taptap.io/post/7647297
https://www.taptap.io/post/7647317
https://www.taptap.io/post/7647318
https://www.taptap.io/post/7647328

https://www.taptap.io/post/7647327
https://www.taptap.io/post/7647326
https://www.taptap.io/post/7647339
https://www.taptap.io/post/7647340
https://www.taptap.io/post/7647341
https://www.linksubmission.in.net/story/https-www-taptap-io-post-7647066/
https://saidit.net/s/LateStageCapitalism/comments/d9di/httpswwwtaptapiopost7647066/
https://www.penana.com/story/156720/hkyhderfdsgdrgd/issue/1
https://www.thaicarpenter.com/index.php?lay=boardshow&ac=webboard_show&WBntype=1&Category=thaicarpentercom&thispage=1&No=2724450
https://paste.myst.rs/raw/9au9nwks/nf7lqea8
https://snippet.host/mmmisy
https://tempaste.com/WQXGb2DD56x
https://rentry.co/sbhb82vv
https://pastelink.net/qqj2s6n1
https://paste.feed-the-beast.com/view/97e01e4f
http://nopaste.paefchen.net/10357257
dsfefs efsef (anitamaher045 at gmail dot com)
20 June 2024 18:35:00
https://m.taptap.io/post/7618281
https://m.taptap.io/post/7618288
https://m.taptap.io/post/7618293
https://m.taptap.io/post/7618298
https://m.taptap.io/post/7618304

https://m.taptap.io/post/7618313
https://m.taptap.io/post/7618317
https://m.taptap.io/post/7618323
https://m.taptap.io/post/7618326
https://m.taptap.io/post/7618329
https://www.penana.com/story/156458/sdgdrhthfhftg/issue/2
sefsef (sefsef at sggse dot com)
19 June 2024 23:06:26
https://www.taptap.io/post/7610174
https://www.taptap.io/post/7610185
https://www.taptap.io/post/7610199
https://www.taptap.io/post/7610201
https://www.taptap.io/post/7610204
https://www.taptap.io/post/7610205
https://www.taptap.io/post/7610209
https://www.taptap.io/post/7610233
https://www.taptap.io/post/7610237
https://www.taptap.io/post/7610242

https://www.taptap.io/post/7610248
https://www.taptap.io/post/7610251
https://www.taptap.io/post/7610281
https://www.taptap.io/post/7610284
https://www.taptap.io/post/7610286
https://www.taptap.io/post/7610288
https://www.taptap.io/post/7610289
https://www.taptap.io/post/7610293
https://www.taptap.io/post/7610305
https://www.taptap.io/post/7610306

https://www.taptap.io/post/7610310
https://www.taptap.io/post/7610313
https://www.taptap.io/post/7610318
https://www.taptap.io/post/7610332
https://www.taptap.io/post/7610334
https://www.taptap.io/post/7610342
https://www.taptap.io/post/7610345
https://www.taptap.io/post/7610348
https://www.taptap.io/post/7610349
https://www.taptap.io/post/7610353

https://www.taptap.io/post/7610355
https://www.taptap.io/post/7610358
https://www.taptap.io/post/7610359
https://www.taptap.io/post/7610368
https://www.taptap.io/post/7610369
https://www.taptap.io/post/7610373
https://www.taptap.io/post/7610377
https://www.taptap.io/post/7610380
https://www.taptap.io/post/7610393
https://www.taptap.io/post/7610395

https://www.taptap.io/post/7610401
https://www.taptap.io/post/7610407
https://www.taptap.io/post/7610411
https://www.taptap.io/post/7610425
https://www.taptap.io/post/7610426

https://www.penana.com/story/156458/sdgdrhthfhftg/issue/1
https://tempaste.com/GgKWZcoSFW8
https://snippet.host/iumcwd
https://paste.myst.rs/raw/53qzswvz/6mv2fl8j
https://pastelink.net/wnsfbg1x
https://rentry.co/rnov68u8
https://paste.enginehub.org/tsAY9V2JE
https://pastebin.com/cxNagvgK
https://paste.feed-the-beast.com/view/1a0d0004
http://nopaste.paefchen.net/10123644
https://medium.com/@anitamaher01/drgdrg-dslrkgjldrng-drgdrg-6f182efc3926
Thomassourn (painkillerfer at hotmail dot com)
20 April 2017 08:08:22
marquess website! solemnize up the cyclopean work. visit my website only if you are overwhelming 21 check this <a href=http://www.sextoysfun.net/>adult toys</a> portal, <a href=http://randomsend.com/>email server</a> , buy <a href=http://esextoyfun.com/c.html?c=22/>Buy Dildo</a>
Affinity (hcn4bl1ge at hotmail dot com)
21 April 2016 03:20:08
This is way better than a brick & mortar estntlishmeab. http://mkgqplwkbu.com [url=http://esianti.com]esianti[/url] [link=http://uapqpil.com]uapqpil[/link]
Butterfly (ctp4a2wqbbo at gmail dot com)
19 April 2016 14:33:23
Mighty useful. Make no mistake, I <a href="http://zmekgdkpn.com">apptrciaee</a> it.
fuck (gene_patrick23 at yahoo dot com)
02 October 2007 08:34:39
nakakatamad laman website nyo shit!!!
 
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://v4visa.ca/wp-content/uploads/for...
    tutorial: SIP with NAT or Firewalls
  • https://v4visa.ca/wp-content/uploads/for...
    tutorial: SIP with NAT or Firewalls
  • https://sites.google.com/view/british-ai...
    tutorial: SIP with NAT or Firewalls
  • https://aspireeducation.org/wp-content/u...
    tutorial: SIP with NAT or Firewalls
  • Primal Compound Shilajit Gummies Review...
    tutorial: Basic Information
 
contact us at: support@asteriskguru.com - asterisKGuru.com © all rights reserved   |   *asterisk is registered trademark of © Digium™