The bottom line is that you need to monitor the state of the communication channels that are being called to the mobile, using the SIP phone and attendant console. Directly through the function, the state of the external trunk cannot be monitored, therefore it was supposed to be done like this: the call gets into the extra virtual sip, which is set up immediately to the call to the mobile device, the device DEVICE_STATE = RINGING is registered, and the call itself goes further.
exten => 101,1,Set(DEVICE_STATE(Custom:SIP/101)=RINGING) exten => 101,n,Dial(SIP/79514585427@51321) exten => 101,hint,SIP/101
But in fact, it turned out that the function does not work, even if you directly register with your hands through the console.
The modules rebooted, in theory, everything should work, but in fact not.
NoOp(${DEVICE_STATE(SIP/${EXTEN})})
as an experiment. and just check whether the status of the device will be obtained. - Zangezi