Soft hangup with wildcards

Hi, I’m pretty new to work with asterisk and php.
But I would like to create a php website, that list all active calls and an link to each one of them so I could hang up them.

I tried something like this:

But that didn’t worked out well…
I would like to get all the channels into one variable so I can match them against my sip accounts.
Or if it is possible to do something like this:

In that case I could just make a link to each sip account and click it and if there ain’t no active call nothing happens. But I can’t get the wildcard part to work.

I hope you understand what I want and have an answer to my question.

Best regards Joacim