Firstly, if you want to do this within the constraints of Elastix, you may find one of the forums on freepbx.org is a better choice.
A device is what FreePBX calls an extension (an extension, in Asterisk, is closer to a FreePBX virtual extension which may or may not have an associated device). Device state is whether the device is busy (all lines in use), in-use, free, etc. There is a device state for most real devices, although you may have to enable features like SIP qualify, to get valid data.
It is also possible to define fictional devices and manipulate their device state from the dialplan.
SIP devices can monitor device states by referring to the associated extension number. Extension numbers are given to devices, for this purpose, using the “hint” priority. To find out how you associate and extension number with a user interface element on your phone, read the phone’s manual.
Note, if you want call waiting to be aggressively presented, you should not enable the queue option to consider in use as equivalent to busy and you should make sure that your phone device is allowed to receive at least two calls. That way the phone will be offered a second call when it is on a call.
You may also find the call completion services (camp on) in the latest versions of Asterisk to be useful.
Unfortunately, I’m using a old version of Asterisk, and a lot of the detail here refers to newer versions, so there may be mistakes in the above, and even if it were reasonable to go into more detail on a free support forum, I would be getting out of my depth.