Contact

Blogs

Take a look at the things that interest us.

How to check if the extension is registered in the Asterisk dial plan

Wesley Wesley 2 years

With Asterisk, you can easily check if a user is registered with your asterisk dial plan. This can be done by checking the device state of Asterisk.

Example

; check device status
[extensions]
exten => _2000,1,Verbose(2,check device status)
same => n,Verbose(Get device status ${DEVICE_STATE(pjsip/1000)})
same => n,GotoIf($[${DEVICE_STATE(pjsip/1000)}=UNAVAILABLE]?absent:makecall)

In the example above we check if the extension is 1000 is registered or not, when the extension is registered we will go to the label makecall, if the extension is not registered we will go to the label absent

Let's first create the label absent.

; absent
same => n(absent),Verbose(2, The agent is not registred)
same => n,Playback(beeperr)
same => n,Hangup()

When the current extensions are not registered we will play a sound file and after that hang-up. Next, we'll create the label make call.

; make call
same => n(makecall),Verbose(2, Call to extension)
same => n,Answer()
same => n,Dail(PJSIP/1000)
same => n,Hangup()

It's quite common in a dial plan to check if the endpoint is registered or not. If you have any questions, let me know in the comments below.

How to check if the extension is registered in the Asterisk dial plan 2021-08-24 08:05:32

There are no comments.

4632

Have questions about our services?

Contact our Sales team to get answers.

Contact Us
gomibako@aska-ltd.jp