Hello,
I am trying to transfer call to next extension if previous is using (INUSE) or call is in progress. I tried to use EXTENSION_STATE(extension[@context]) to find the status as follow:
You are checking the extension state after dialing SIP/123.
You also probably want to use the DEVICE_STATE dialplan function and get the status of SIP/123 instead of the extension state, since that device is what you would be trying to call.
There is also a window of time between checking the state and dialing where something else could theoretically place a call or the device could send a call into Asterisk.
I’m not sure if this is still true, but you also needed to have call limits enabled for device state to work in earlier versions.
Also, it is probably better to attempt the call and then check DIALSTATUS and/or HANGUPCAUSE, than to bother with device state at all.
It is important to understand the difference between extensions and devices in Asterisk. There is a zero or more to zero or more relation between them.
Nothing. That’s what it does. You will get close to what you want without the first two lines, so you should start from there and then see if you really need anything more complex. At least it will help you to clarify the specification.