Contact

Blogs

Take a look at the things that interest us.

How to transfer a call on not registered sip account with Asterisk

Wesley Wesley 3 months

In today blog post we are going to transfer a call through our Asterisk dial plan to another extension, when the current extension is not registred. Let's get started.

References

1. Asterisk Extensions

To check if a extensions is registered in Asterisk, we’ll update the extensions config file.

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 GotoIf option with the Device State option to our dial plan.

# asterisk documentation
GotoIf(condition?[labeliftrue:[labeliffalse]])

Arguments condition 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

[extensions]
exten => _2000,1,Verbose(2,${CALLERID(all)} entering the support queue)
same => n,Verbose(Get device status ${DEVICE_STATE(pjsip/1000)})
same => n,GotoIf($[${DEVICE_STATE(pjsip/1000)}=UNAVAILABLE]?absent:queue)

In the example above we added the GotoIf function to our queue dial plan. In the GoToIf function we'll check if the current extensions is registered or not.

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

; absent agents
same => n(absent),Verbose(2, There are no agents registered)
same => n,Playback(beeperr)
same => n,Wait(1)
same => n,Answer()
same => n,Queue(support-offline)
same => n,Hangup()

if the agent is not registered, we'll transfer the call to a third person.

After this we'll add the queue label to our dial plan.

; queue
same => n(queue),Verbose(2, Call into queue)
same => n,Playback(hello)
same => n,Wait(1)
same => n,Answer()
same => n,Queue(support)
same => n,Hangup()

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

!wq;
  1. Restart Asterisk

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

systemctl restart asterisk

The transfer on not registered has now been set up for Asterisk. When a call is made to the queue and the agent is not registered, we'll transfer the call to a third queue.

How to transfer a call on not registered sip account with Asterisk 2021-08-27 10:42:24

There are no comments.

4039

Have questions about our services?

Contact our Sales team to get answers.

Contact Us