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

6.1.1.14. CHECK_MD5 (dialplan function) - NEW

1. CHECK_MD5 - this function allows you to compare two MD5 checksums

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 CHECK_MD5 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 MD5Check application here
 


Syntax:

Set(var=${CHECK_MD5(<hash>,<string>)})

 


List of the possible options

var - The variable, where the returned result will be stored. The result could be either 1 if there is a match or 0 if there is mismatch
hash - previously calculated checksum. This is the first parameter in the equation
string - this is the second parameter in the equation. The system will calculate the checksum on this string and then it will be compared with the <hash>.

 


Purpose and usage

The purpose of this function is to calculate the checksum of a word set as an argument in the function's brackets and then this checksum to be compared with another one, which is also set as a function's argument - to see whether there is a match.

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.

extCHECK_MD5SETnew.jpg

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

We will use the extensions from the MD5() function tutorial

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

Then thanks to the MD5() function we will calculate the checksum of the word test.

Use the Set application and type the following as argument in its brackets - NEWVAR=${MD5(test)}. This will cause the calculation of the checksum for the word test.

Now we will use the CHECK_MD5 function to compare this checksum with an another one calculated for another word.

We have to use the Set application. The following is what you have to write in the brackets of the application:

NEW=${CHECK_MD5(${NEWVAR}|test)}

This operation will return either 1 or 0 depending on whether there is a match or not.

${NEWVAR} is the variable where the hash for the word test is stored.

Intentionally we set the word test as desired one for a comparison. So the expected result has to be 1, which means match

NEW - is the name of the variable, where the result will be stored. Then we will use this to take a decision what to do next.

For the decision - we will use the GoToIf application. If the checksums are equal the call will be send to the extension with priority 5 and thanks to the SendText application the caller will receive a Success message . Otherwise the call will be send to the extension with priority 7 and the caller will receive a Failure message.

So in our case we have to expect a message for success.

NOTE: The function CHECK_MD5() is case sensitive. You always have to write it 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 and with your Idefisk(v.1.24)

cliCHECK_MD5new.jpg

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

CHECK_MD5.tar - configuration files

 


5. Similar dialplan functions

MD5()

 

 
User Comments
generic for proventil hfa inhaler (nidiachau7472 at pw dot epac dot to)
10 July 2020 13:49:54
generic for proventil hfa inhaler https://amstyles.com/
Margaretta (0f1u38kc at gmail dot com)
20 November 2016 08:34:46
I came, I read this article, I conqdereu. http://mfjxgi.com [url=http://ohajrjbr.com]ohajrjbr[/url] [link=http://bwpvoob.com]bwpvoob[/link]
Luisa (luisampj at gmail dot com)
15 April 2008 15:53:57
How can i Authenticate sip extensions using MD5 but not making a Context?. I mean..I have made a context and I need to authenticate the extensions using MD5. In sip.conf is another way to set it up but not in context?
 
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://donde-ver-ant-man-y-la-avispa-qu...
    tutorial: Digium Wildcard TE405 / Wildcard TE410P
  • https://donde-ver-scream-6-tyt.statuspag...
    tutorial: Digium Wildcard TE405 / Wildcard TE410P
  • https://donde-ver-guardianes-de-la-noche...
    tutorial: Digium Wildcard TE405 / Wildcard TE410P
  • https://donde-ver-demon-slayer-villa-de-...
    tutorial: Digium Wildcard TE405 / Wildcard TE410P
  • https://www.reddit.com/r/BenavidezvPlant...
    tutorial: Digium Wildcard TE405 / Wildcard TE410P
 
contact us at: support@asteriskguru.com - asterisKGuru.com © all rights reserved   |   *asterisk is registered trademark of © Digium™