Disable a User in Asterisk

Hello!

I try to create an interface in JavaScript for Asterisk Users,

In this interface, the user can choose his state like “available” and “not available”.

I would like that when the user is in the state “not available” and a call is received, the phone doesn’t ring, is it possible?

I have already tested to disconnect the WebSocket but it’s doesn’t do anything.

Thanks for your help

This sounds like something completely client side (SIP UAS side) in the your browsers.

The slightly difficult part of doing this in Asterisk itself, instead, would be communicating the state back to Asterisk. Once you have done that, it is a trivial matter of testing the state and bypassing the Dial application call.

Traditionally signalling back to Asterisk would be done by defining special extensions (feature codes) that could be dialled from the phone, to put it into a do not disturb mode, although some SIP phones may also have modes where they respond busy to all callers.

I can ask to asterisk the state of the IP phone but do you mean that I can impose to asterisk the state of the phone which I would not available?

You can dial an extension that sets a global variable, or ASTDB entry to indicate that calls to the phone should be rejected by the dialplan. This would be the way of doing it with normal phones.

You can use some out of band mechanism to set a file or database entry, that can be tested by the dialplan.

You can make the phone busy and have Asterisk act accordingly when it gets a busy status back when it actually tries the call.

OK, I understand this, but my goal is to don’t have to touch the phone and to be able to control all with the interface, I suppose that’s impossible to do.

The second option will do it, but is nothing like out of the box.

The third option will do it if the browser allows you do do it, but that is nothing to do with Asteiisk, and I know almost nothing about WebRTC, so I don’t know what you can rely on as being supported by all browsers.