AgentLogin & hang up

Hi

I write code in java, but i have problem with AgentLogin();

String agentNumber = channel.getData("agent-user");
channel.exec("AgentLogin", agentNumber+"|s");

i can login using telephon, but if i hang up then automatically my agent
"logged out". Why?

I would login to my agent username and hang up, if somone want call to me
then my telephon should start ringing.
This is possible ?

Chris