Misc. Dialplan Tools strepoch

From FreeSWITCH Wiki
Jump to: navigation, search

Contents

Description

Returns the number of seconds since the Unix epoch (UTC of midnight January 1, 1970)

From the dialplan

<action application="set" data="my_timestamp=${strepoch()}"/>

Examples

The following extension will only start to play music on hold if called before the date/time specified by the epoch.

<extension name="moh">
  <condition field="destination_number" expression="^1234$"/>
  <condition field="${cond(${strepoch()} < 1273755900 ? true : false)}" expression="^true$">
    <action application="answer"/>
    <action application="playback" data="$${hold_music}"/>
    <anti-action application="log" data="NOTICE The string quartet has gone home."/>
  </condition>
</extension>

From the CLI

strepoch