There is an problem faced me, that when I perform debugging for my script there is a message appeared to me " Task:25000000007 AcceptStep: Trigger is not contactApplication".
and when i apply this script to application i called it Test and try to hear what i do, but i hear "sorry we have a critical problem call us again".
the script is attached
Did you add a CSQ and ressource groupe, whith agent ont UCCX appadmin. In your script the CSQ name is empty ! That's may explain the issue.