Call routing based on Calendar

I had asterisk talking to my exchange server and checking for an appointment when a call comes in to a particle number, then forwards it to an extension and phone number that is in the subject line of the calendar. I lost my configuration for this and need help with.

I currently have asterisk talking to Exchange and that’s about it, I have also read the guides online but just cannot make it work

Any help would be gratefully received.


We can’t give cookbook answers that only require copy-paste from the forum.

If you gave some more details and ask specific questions maybe we can help you.

Kind regards,


Basically a call comes in on a DID, Asterisk then read the calendar to check if busy or not.
If busy then redirects the call to a phone number the subject line. If not busy then sends the call to any extension.
The below is now working for me, but don’t know if it’s 100%
exten => 111,1,Verbose(2,Simple calendar busy check example)
same => n,Set(CalendarBusy=${CALENDAR_BUSY(exchangecale)})
same => n,Set(id=${CALENDAR_QUERY(exchangecale,${EPOCH},${i})})
same => n,Set(Supportnumber=$[${CALENDAR_QUERY_RESULT(${id},summary)}])
same => n,GotoIf($["${CalendarBusy}" = “1”]?dial1)
same => n,GotoIf($["${CalendarBusy}" = “0”]?dial2)
same => n(dial1),Dial(DAHDI/g1/${Supportnumber},30)
same => n(dial2),Dial(SIP/600,30)