How to use Getvar to get the uniqueID of a call?

I am struggling with GetVar using the AMI.

I am originating the call by sending the following lines:

Action: Originate
ActionID: 69
Channel: local/211@from-internal
Context: from-internal
Exten: 0412868320
CallerID: inCommand Call
Priority: 1
Async: yes

What should the GetVar looklike to get hte unique ID of the above call?

Or should I change the above?



Action: Getvar
Channel: local/211@from-internal-XXXX;1
Variable: UNIQUEID
ActionID: YYYY

where XXXX is the instance ID, which you would need to get from newchan events. Tracking newstate events, with suitable hints in the dialplan, might be easier, but I’m not going to work out the details of that as free consultancy. newchan events probably include the unique ID, anyway.

This assume that you want the owner side of the local channel. If you want the PBX side, you will need to use ;2.