Yes sorry, I got originate action in my mind, as is the most used on AMI, I corrected my post
I got it working by sending two ami commands. The first one I send is setvar which sets the global variable and then I send the redirect command. Works like a charm.
Thanks for all your help.