How to set device_state in asterisk 13.2.0

Hi all,

How i can set Device_state on asterisk-13.2.0 .
i´m using PJSIP


You can only set custom device states, which is done using the DEVICE_STATE dialplan function[1]. The device state of PJSIP devices is determined using built in logic and can not be set.



Tankś jcolp to replay

I try folow the link you send to me . In my dial plan i try configure two extensions for test so i have same extensions with ip phones yealink . One example 3 iphone yealink one of does is console othes is extensions how i can see when the 2 extensions itś ocupied ?

I try configure thus: in dial plan:

exten => 20050,1,NoOp()
exten => 20050,n,Set(DEVICE_STATE(Custom:lamp1)=BUSY)
exten => 20050,n,Set(DEVICE_SATE(Custom:lamp2)=INUSE)
exten => 20050,n,Dial(PJSIP/${EXTEN},20,tTwW)
exten => 20050,n,Hangup()

exten => 20051,1,NoOp()
exten => 20051,n,Set(DEVICE_STATE(Custom:lamp1)=BUSY)
exten => 20051,n,Set(DEVICE_STATE(Custom:lamp2)=INUSE)
exten => 20051,n,Dial(PJSIP/${EXTEN

i try these but with out sucess ;(


I’d suggest reading the documentation on device and extension states[1] as it covers this sort of usage well.


Hi ,

Sorry to asking i need install corosync and Openais in asterisk-13.2.0 ?
To use device_state and extensions:state .


If you want to use it on 1 system, no. That’s for sharing it between different Asterisk systems.

You have to have a hint on the system though, and your phone has to subscribe to get the state. If you want to query from the dialplan then you use the DEVICE_STATE dialplan function.


I only have one server with asterisk in these case i need ti use hint and DEVICE_STATE dialplan funcion ?


Hints map extension numbers to devices. The DEVICE_STATE dialplan function allows you to, from the dialplan, set custom device state or query device state. I’m not really clear what exactly you are trying to achieve so I can’t suggest anything further.

Hello Joshua!

I have a question about device states. I have trunk with lync server that can call through Asterisk. Every lync user has extension number and when lync sends Invite it places this username in SIP message. At the moment such calls are defined as calls from trunk and not bound to extensions. If i disable auth on endpoint and setup identify to username instead of IP such calls would be reflected as calls from those endpoints e.g. changing device state and other info respectively. My question is can this or something similar be done with auth enabled? So those calls would come from lync trunk but be reflected as calls from specific endpoints based on username in SIP message?

Please don’t hijack threads like this. Create a new one with your issue/question. If you do so also include the SIP signaling so it can be seen exactly what you mean.

Oh, sorry. I will make new thread.