Hangup from browser

I want to Hangup a call from browser.

<?php $socket = fsockopen("127.0.0.1","5038", $errno, $errstr, $timeout); fputs($socket, "Action: Login\r\n"); fputs($socket, "UserName: test\r\n"); fputs($socket, "Secret: test\r\n\r\n"); fputs($socket, "Action: Command\r\n\r\n"); fputs($socket, "Command: Hangup\r\n\r\n"); fputs($socket, "Channel: SIP/agent008-adbc\r\n\r\n"); while (!feof($socket)) { $wrets .= fread($socket, 8192); } fclose($socket); echo <<

What I make wrong?

I made some change and now it’s ok.

old script was:
fputs($socket, “Action: Command\r\n”);
fputs($socket, “Command: Hangup\r\n\r\n”);
fputs($socket, “Channel: “.$agentchannel.”\r\n\r\n”);

new script is (and it’s work)
fputs($socket, “Action: Hangup\r\n”);
fputs($socket, “Channel: “.$agentchannel.”\r\n\r\n”);

Where do I get the exact channel-name ( your .$agentchannel ) from?

I use “Channel: SIP/32\r\n” to orignate a call from an external application via mananger api. But the asterisk uses s.th. like " Channel SIP/32-0819f3e8 was answered." for internal call-handling.

Where do I get this “-0819f3e8” from? I need it for hangup-actions out of external applications.

Thx
meph