I am looking for an XML script that during opening hours from 9 to 12 and from 1 to 5, I offer an IVR menu with 3 options, but during lunch from 12 to 1 an IVR with only 2 options.
I don't want to use schedules or other, but want to route inside the IVR condition to menu 1 or 2 based on time of day.
Anybody came across the same, or similar?
this is quite common requirement, I suggest you read the IVR documentation and search for a keyword "datetime" (https://docs.cc.sinch.com/cloud/ivr-development-guide/en/IVR_Development_Guide.pdf ). This way you can query current time and branch your IVR accordingly.
Another option is to use a schedule assigned to some dummy queue and query on open/closed queue status.
The latter is better for management, i.e. you have all time/date dependent data in one place. Managing time conditions directly written in different IVR will get complicated over time...
Yes, we already misuse queues as dummy queues to query open.close, but I was looking to make it leaner and add opening hours in the IVR and route either to menu 1 or menu, or even the an OOO message, based on ToD.
I was experimenting and I feel I am close, but the condition does not return a true or false in the If-block.
Do you have something like that?
Like dhlashwe said, the keyword is "datetime" and using that in an IF block. For example:
You create a variable that checks the current time:
currentTime = datetime.datetime.now().strftime('%H:%M')
This will return a string in 24H format.
In the IF block you check the current time and place a goto element that will forward it to the right Menu.
IF: "12:00" <= currentTime < "13:00"
- goto Menu1 (Lunch time)
ELSEIF "09:00" <= currentTime < "12:00" or "13:00 <= currentTime < "17:00"
- goto Menu2 (Regular working time)
- goto ServiceClosedBlock
You don't have to use the datetime string format. You can use the datetime object and make comparisons with that. Also the order isn't important. You just need to make the checks correctly.
But I would also recommend using schedules with a dummy queue. With that it's hard to go wrong or make major mistakes in the IVR (Queue Query: Checking Service Availability). It's easier to mess up in the IVR if you make date/time comparisons there.