# Creating time based ivr

**URL:** <https://community.asterisk.org/t/creating-time-based-ivr/48290>\
**Category:** Asterisk General\
**Created:** [March 2, 2015, 9:15am UTC](https://community.asterisk.org/t/creating-time-based-ivr/48290 "2015-03-02T09:15:07Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rubence](https://avatars.discourse-cdn.com/v4/letter/r/c67d28/32.png) [@rubence](https://community.asterisk.org/u/rubence)\
**Post date:** [March 2, 2015, 9:15am UTC](https://community.asterisk.org/t/creating-time-based-ivr/48290/1 "2015-03-02T09:15:07Z")

</div>

I want to play different greetings based on time . after then a common ivr (mainivr) will be played. problem is when its 7.00 am all three ivr is being played. when its 15.00 afternoon and evening is played. seems it cannot skip the next priority. please help

```auto
exten => 1234,1,Answer()

same => n,GotoIfTime(06:01-13:59,*,*,*?time1)
same => n,GoToIfTime(14:00-18:00,*,*,*?time2)
same => n,GoToIfTime(18:01-06:00,*,*,*?time3)
same => n(time1),Background(mysounds/morning)
same => n(time2),Bakcground(mysounds/afternoon)
same => n(time3),Background(mysounds/evening)
same => n,Wait(2)
same => n,Background(mainivr)

```

---

<div class="post-metadata">

**Author:** ![Lexus45](https://avatars.discourse-cdn.com/v4/letter/l/f0a364/32.png) [@Lexus45](https://community.asterisk.org/u/Lexus45)\
**Post date:** [March 2, 2015, 9:23am UTC](https://community.asterisk.org/t/creating-time-based-ivr/48290/2 "2015-03-02T09:23:17Z")

</div>

Hello.  
Try [GoTo](https://wiki.asterisk.org/wiki/display/AST/Application_Goto) application.  
Though I don’t remember if it can jump to priority labels, but I hope/sure it can:

```auto
exten => 1234,1,Answer()

same => n,GotoIfTime(06:01-13:59,*,*,*?time1)
same => n,GoToIfTime(14:00-18:00,*,*,*?time2)
same => n,GoToIfTime(18:01-06:00,*,*,*?time3)
same => n(time1),Background(mysounds/morning)
same => n,Goto(mainivr)
same => n(time2),Bakcground(mysounds/afternoon)
same => n,Goto(mainivr)
same => n(time3),Background(mysounds/evening)
same => n,Goto(mainivr)
same => n(mainivr),Wait(2)
same => n,Background(mainivr)

```

---

<div class="post-metadata">

**Author:** ![rubence](https://avatars.discourse-cdn.com/v4/letter/r/c67d28/32.png) [@rubence](https://community.asterisk.org/u/rubence)\
**Post date:** [March 2, 2015, 9:39am UTC](https://community.asterisk.org/t/creating-time-based-ivr/48290/3 "2015-03-02T09:39:48Z")

</div>

cool ! its working … thanks a lot 😄
