• News
  • Idefisk
  • Tools
  • Tutorials
  • Forum
  • Reviews
  • VoIP Providers
  • Archives
  • Gallery
ZOIPER SIP softphone
Back to Tutorials

6.1.2.75. SayUnixTime (dialplan application)

1. SayUnixTime is a dialplan application that says the date and time.

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

 

Syntax:
SayUnixTime([unixtime][|[timezone][|format]]) : the time and date that you want to be said must be first argument in seconds after 1st Jan 1970. All the parameters are optional – if none given the default values will be taken.

In the next paragraph you can find better description of the parameters.

 

Purpose and usage
The purpose of this dial plan application is to say the date and time, given in seconds after 1st Jan 1970. Here are the parameters and the values they can have:
Unixtime – time(in seconds) after 1st Jan 1970. May be negative (seconds before 1st Jan 1970). Default value is now. This parameter is optional.

Timezone – this is abbreviation of the time zone for the time/date you are looking. More info for the time zones you can find in /usr/share/zoneinfo. Default value is the one to which the computer is set. You can check if by typing date. This parameter is optional.

Format – this is the date/time format in which you want the date/time to be said. Here are the format abbreviations.

A or a - Day of week (Saturday, Sunday, ...)
B or b or h - Month name (January, February, ...)
d or e - numeric day of month (first, second, ..., thirty-first)
Y - Year
I or i - Hour, 12 hour clock
H - Hour, 24-hour clock (single digit hours preceded by "oh")
k - Hour, 24 hour clock (single digit hours NOT preceded by "oh")
M - Minute
P or p - AM or PM
Q - "today", "yesterday" or ABdY
q - ""(for today), "yesterday", weekday, or ABdY
R - 24 hour time, including minute

You can also find this table in /etc/asterisk/voicemail.conf. The default format value is:"ABdYIMp".

 

Prerequisites
First of all you need to install Asterisk PBX. Afterwards you need to configure at least one user in iax.conf, sip.conf or mgcp.conf – the protocol you are going to use depends on you or of the phone you are using. After this you need to write some extensions in extensions.conf.

In this tutorial I will use Idefisk softphone that is an IAX client. You can download it by clicking here. Tutorial showing how it works and configuration support can be found here.


 

Asterisk PBX configurations


NOTE: This is just an example of what you can use this application for. Of course you can use it and for other purposes.

When you have installed and working Asterisk PBX you will need some user to test this application. If you do not have any registered in iax.conf you may add the following one. If you are not going to user Idefisk Softphone and iax.conf you have to register the user in the same way in sip.conf, h323.conf or mgcp.conf – depending on the protocol you are using.



Above I registered a user [ivan] with the properties:
type=friend (type might be user – just can call, peer – just can be called and friend – can call and can be called)

username=ivan – this is the user which must authenticate when connecting to the Asterisk PBX server

context=test is the context from extensions.conf which the user can access (including any other context which is/are included in this one)

secret=ivan is the password with which the user must authenticate when connecting to the Asterisk server

host=dynamic means that the host for this user is dynamic and he/she can connect to Asterisk PBX from different computers (host may be defined with static ip address)

Allow=all means that all audio codecs are allowed (You can allow certain codecs as well as disallow others)

We now have a user that can use the context test from extensions.conf. So now we need some dial plan application in [test] in extensions.conf.



Here is the application in extensions.conf:

exten => 567,1,Answer()
the call is answered

exten => 567,2,Playback(welcome)
welcome message is played on playback

exten => 567,3,SayUnixTime(-1,UTC)
this will say the time one second before 1st Jan 1970 according to the UTC (Coordinated Universal Time) time zone in the default format.

exten => 567,4,SayUnixTime(,CET,kMbdY)
this will say the date/time at the moment according to the CET (Central European Time) time zone. The format is:
k - Hour, 24-hour clock (single digit hours NOT preceded by "oh")
M - Minute
b - Month name
d - numeric day of month
Y - Year

exten => 567,5,Playback(vm-goodbye)
goodbye message is played

exten => 567,6,Hangup()
hangup() closes the line

 

2.The application in CLI





 


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. Similar dialplan applications

SayAlpha()
SayPhonetic()
SayDigits()
SayNumber()
 

 
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:

  • 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
  • Grandstream GXP-2020
    added 15/Oct/2007 18:17

Latest Comments:

  • uh, why not just use the asterisk packag...
    tutorial: Installation on Debian
  • <br /> <p><a href="http://www.7be.com">...
    section: voip software
  • <br /> <br /> <p><a href="http://www.7...
    section: voip software
  • <br /> <br /> <p><a href="http://www.7...
    section: Asterisk
  • <p><span lang="ar-sa"><a href="http://ww...
    section: Asterisk
 
contact us at: support@asteriskguru.com - asterisKGuru.com © all rights reserved   |   *asterisk is registered trademark of © Digium™