[asterisk-users] if statement recording - after hours

Brian LaVallee b.lavallee at globaltank.jp
Thu Sep 11 23:40:13 CDT 2014


There are multiple ways to do time-of-day routing.
ExecIf w/ IFTIME, GotoIfTime, and ExecIfTime.
I put some examples below.


Sincerely,
Brian LaVallee


On 9/12/14, 10:05, Eric Wieling wrote:
> See ExecIf in the output of "core show applications".  The IF function might be useful, see "core show functions".   I assume the Asterisk Book also covers this.
>
> -----Original Message-----
> From: asterisk-users-bounces at lists.digium.com [mailto:asterisk-users-bounces at lists.digium.com] On Behalf Of Joseph
> Sent: Thursday, September 11, 2014 5:43 PM
> To: asterisk-users at lists.digium.com
> Subject: [asterisk-users] if statement recording - after hours
>
> In my dial plan I have these two lines:
>
> exten => _NXXXXXX,n,Set(recordfilename=${CALLERID(num)}-${EXTEN}-${STRFTIME(${EPOCH},MST,%C%y-%m-%d-%H%M)}.wav)
> exten => _NXXXXXX,n,MixMonitor(${recordfilename},b)
[main]
exten => _NXXXXXX,1,NoOP(Check Time)
  same => GotoIfTime(9:00-17:00,mon-fri,*,*?open:closed)
[open]
exten => _NXXXXXX,1,NoOP(Normal Call)
[closed]
exten => _NXXXXXX,1,NoOP(Take a Message)
; end

[main]
exten => _NXXXXXX,1,NoOP(Check Time)
  same => n,ExecIf(${IFTIME(9:00-17:00,mon-fri,*,*?1:0)}?Goto(closed))
  same => n,NoOp(Process Normal Call)
[closed]
exten => _NXXXXXX,1,NoOP(Take a Message)
; end

[main]
exten => _NXXXXXX,1,NoOP(Check Time)
  same => n,ExecIfTime(9:00-17:00,mon-fri,*,*?open)
  same => n,NoOp(Take a Message)
[open]
exten => _NXXXXXX,1,NoOP(Normal Call)
; end
> How to add "if" statement to execute these line only after let say 5pm.  To record conversation only after 5pm.
>






More information about the asterisk-users mailing list