AMI using PAMI redirect multiple channels

I have am able to redirect a single channel to a conference like this:
$responseRedirect = $pamiClient->send(new RedirectAction($channel, $numtodial, ‘mycontext’, ‘1’));

I am trying to redirect both channels at the same time to a conference using the setExtraChannel etc.

Not sure how to accomplish this and I can’t find much in the way of sample code in the docs or anywhere really. The followed the only example I found but can’t make it work. I have tried a bunch of variations but no luck. Any advice is appreciated. Here is what I tried in a nutshell.

$doRedirect = new RedirectAction($channel, $numtodial, ‘mycontext’, ‘1’);

Of course I have the PAMI client setup before my code, I’m opening the client and closing it at the end, just left this out for simplicity in this post.

Oops, I was tired last night when working on this and wasn’t paying attention to my response from the AMI.

Just looked at what I was logging and it’s saying:
Message: ExtraChannel does not exist: PJSIP/304

So, I know this is the issue and I’m digging in so I can remember how to properly reference the channel for the SIP extension.

I’ll report back once it’s solved, thanks for looking.

You don’t reference the SIP peer (technology/data), but rather than channel: which will be technology/data-instance, or the the channel unique ID.

The double redirect is intended for situations like constructing a conference from two directly connected channels; it cannot create a channel from a device address; the channel must already exist.

You need to establish a connection to the endpoint and find the Asterisk channel name for that specific connection.