Your lua script is being called after freeswitch checks all conditions, so group 2 conditions are checked before the lua script is called.
Solution:
After the lua script action, transfer the call to a different dialplan that will check the action vars are set.