Set channel variables before/during channel origination

I have successfully originated a channel using the ARI with the /channels method, placing the call into the dialplan exactly where I wanted.

However, before my channel is placed into the dialplan at the specified point, I need to set a couple of channel variables. I thought I would do this with the /setchannelVar method. But…this method wants the channel id!

So I have a chicken and egg scenario…I can’t set channel vars until I have created the channel, and I cant originate the channel until I have set my channel vars.

Is there a simple way to do this when creating a channel? Or do I have to create the channel without dialling, set the vars, and then dial the channel?

Channel variables can be passed in the body when originating a channel[1].

[1] Channels - Asterisk Documentation