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

6.1.2.65. ReadFile (dialplan application)

1. ReadFile - this application allows you to read characters from a file.

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

 


Syntax:

ReadFile(varname=file,length)

 


List of the possible options

varname - the name of the variable in which you would like to store the read characters.
file - the full path to the file, plus its name, plus its extension.
length - the number of characters you would like to capture and store in the varname.

 


Purpose and usage

The purpose of this application is to give you the possibility to read the content of a text file. You can use it, to read any kind of information, which you decide, that is appropriate. The application could read letters as well as numbers.

Below, we will give you an example, how to use this application.

 


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.

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.

extreadfile.jpg

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

When somebody dials 1111, the call will be answered by the Answer application. The next executed extension will be the one which contains the ReadFile application. As arguments in its brackets we have written the following: test=/tmp/test_file.txt,13.

test - the variable which will store the read characters. In other words, the application will read the specified characters and then it will store them in this variable.

/tmp/test_file.txt - this is the full path to the text file(/tmp/). Also, the filename(test_file) and its extension(.txt)

13 - the number of letters ar digits which the application has to read. It will read the first thirteen characters.

The next executed extension, will be the one with the SendText application. Thanks to it a message will be displayed on the callers screen. The message will contain the value of the test variable. In other words it will show us the thirteen letters or numbers, which the ReadFile application read and stored in the variable test

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.

NOTE: The ReadFile application could read the characters horizontal as well as vertical. The space between the characters is also counted. Also, the new lines are counted as one character.

NOTE: In the horizontal arranged file the characters are: 1010 test asterisk idefisk. In the vertical file they are arranged like the following:
1010

test
asterisk
idefisk


 


2. Screenshots of what you can see on your Idefisk and on the CLI of the Asterisk PBX
1) With horizontal arranged characters
idereadfilehor.jpg

clireadfilehor.jpg

2) With vertical arranged characters
idereadfilever.jpg

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

Read()

 

 
User Comments
JasonAspix (1758zascpt0jm at mantilia48 dot fancycarnavalmasks dot com)
02 March 2019 15:19:30
canadian pharmacy cialis super activetarget pharmacy price cialis Buy Cialis 60mg <a href="http://xcialis20mg.com">http://xcialis20mg.com</a>
gsfdg (fdsaf at 163 dot com)
09 July 2009 05:56:20
<a href="http://www.edhardy-zone.com/">cheap ed hardy</a><br>





<a href="http://www.edhardy-zone.com/Ed-Hardy-T-Shirts-.html">ed hardy t-shirts</a><br>
 
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:

  • <a href=https://okna-plastic-10.ru/>http...
    tutorial: VMAuthenticate (dialplan application)
  • Ваши розы – это клас...
    tutorial: Installation on Fedora Core
  • https://www.jampsped.org/wp-content/uplo...
    tutorial: SIP with NAT or Firewalls
  • <a href=https://okna-plastic-7.ru/>за...
    tutorial: VMAuthenticate (dialplan application)
  • https://www.flaquarium.org/wp-content/up...
    tutorial: SIP with NAT or Firewalls
 
contact us at: support@asteriskguru.com - asterisKGuru.com © all rights reserved   |   *asterisk is registered trademark of © Digium™