Take a look at the things that interest us.

How to setup opening hours transfers in Asterisk

Wesley Wesley 2 years

To create a opening hours transfer in Asterisk, we’ll update the extensions config file.

1. Asterisk Extensions

Let’s start by moving to the Asterisk directory.

cd /etc/asterisk

Here we’ll open our extensions.conf

vi extensions.conf

Here we’ll need to add the GotoIfTime option to our dial plan.

# asterisk documentation

Arguments condition

  • times
  • weekdays
  • mdays
  • months
  • timezone destination
  • labeliftrue - Continue at labeliftrue if the condition is true. Takes the form similar to Goto() of [[context,]extension,]priority.
  • labeliffalse - Continue at labeliffalse if the condition is false. Takes the form similar to Goto() of [[context,]extension,]priority.

Let's add it to our queue dial plan

; Our queue
exten => _2000,1,Verbose(2,${CALLERID(all)} check openings times)
same => n,GotoIfTime(09:00-17:00,mon-fri,*,*,Asia/Tokyo?open:closed)

In the example above we added the GotoIftime function to our queue dial plan, we bassicly check if the company is currently open or closed.

Next we'll add the open label to our dial plan.

; go to queue
same => n(open),Verbose(2,${CALLERID(all)} entering the queue)
same => n,Playback(hello)
same => n,Wait(1)
same => n,Answer()
same => n,Queue(support)
same => n,Hangup()

After this we'll add the closed label to our dial plan. We bassicly transfer the call to a third person when the company is currently closed.

; show outside business hours
same => n(closed),Verbose(2,${CALLERID(all)} outside opening hours)
same => n,Playback(beeperr)
same => n,Dial(PJSIP/1002,60,tT)
same => n,Hangup()

After updating the file we’ll save and close it.


2. Restart Asterisk

The last step is to restart Asterisk, this can be done with the following command.

systemctl restart asterisk

The opening hours transfer has now been set up for Asterisk. When a call is made when the company is closed the call will be transfered to extensions 1002.

How to setup opening hours transfers in Asterisk 2021-08-26 16:26:10

There are no comments.


Have questions about our services?

Contact our Sales team to get answers.

Contact Us