Calls getting transferred

When I use the below code, I am able to make a call, to the extension i want to, but the propblem arises when the call is taken.
As the call is taken, it gets transferred to the other line, and all what the person gets to hear is the ringing tone, as the call is transferred to his other line.
For example, if the user takes the cal on line 1, then as he picks up, the call goes to line 3, and he only hears the ringtone.

I dnt know how to deal with this, plz help

Code attached below :

package asterisk;
import java.io.IOException;

import org.asteriskjava.manager.AuthenticationFailedException;
import org.asteriskjava.manager.ManagerConnection;
import org.asteriskjava.manager.ManagerConnectionFactory;
import org.asteriskjava.manager.ManagerEventListener;
import org.asteriskjava.manager.TimeoutException;
import org.asteriskjava.manager.action.OriginateAction;
import org.asteriskjava.manager.action.RedirectAction;
import org.asteriskjava.manager.action.SetVarAction;
import org.asteriskjava.manager.action.StatusAction;
import org.asteriskjava.manager.event.ManagerEvent;
import org.asteriskjava.manager.response.ManagerResponse;

public class HelloEvents implements ManagerEventListener
{
private ManagerConnection managerConnection;

public HelloEvents() throws IOException
{
ManagerConnectionFactory factory = new ManagerConnectionFactory(
pbx.co.uk”, “username”, “password”);

this.managerConnection = factory.createManagerConnection();
}

public void run() throws IOException, AuthenticationFailedException,
TimeoutException, InterruptedException
{
// register for events
managerConnection.addEventListener(this);

// connect to Asterisk and log in
managerConnection.login();

// request channel state
managerConnection.sendAction(new StatusAction());

// wait 100 seconds for events to come in
// Thread.sleep(10000);
OriginateAction originateAction;
ManagerResponse originateResponse;

originateAction = new OriginateAction();
originateAction.setChannel(“SIP/3006”);
originateAction.setContext(“default”);
originateAction.setExten(“3006”);
originateAction.setPriority(new Integer(1));
originateAction.setTimeout(new Integer(5000));

originateResponse = managerConnection.sendAction(originateAction, 30000);
SetVarAction setVarAction = null;

if(originateResponse.getResponse().equals(“Success”))
{
System.out.println(“I am coming hereeeeeeeeeeeeeee”);
System.out.println(“the reason for failure is=====>>”+originateResponse.getResponse().toString());
setVarAction.setVariable(“STRING3”);
setVarAction.setValue(“SIP/3006”);
originateResponse = managerConnection.sendAction(setVarAction, 30000);
// if(originateResponse.getResponse().equals(“Success”))
// {
//
// RedirectAction redirectAction = new RedirectAction();
// redirectAction.setChannel (“SIP/3000”);
// redirectAction.setContext(“mariaSIP”);
// redirectAction.setExten(“444”);
// redirectAction.setPriority (new
// Integer(1));
// originateResponse = managerConnection.sendAction (redirectAction,
// 30000); if (originateResponse.getResponse().equals(“Success”))
// {
// …
// }
// …
// }
// and finally log off and disconnect

}
else
{
System.out.println(" i am not takin callssssssssssssssss");
}
managerConnection.logoff();
}
public void onManagerEvent(ManagerEvent event)
{
// just print received events
System.out.println(event);
}

public static void main(String[] args) throws Exception
{
HelloEvents helloEvents;

helloEvents = new HelloEvents();
helloEvents.run();
}
}

Hi,
I have tried to compile the HelloEvents program like:

[quote]
javac -cp asterisk-java-0.3.1.jar HelloAgi.java
[/quote].
It compiles well.I have add an extension 1300 to the default section of extensions.conf

[quote]
exten => 1300,1,Agi(agi://localhost/hello.agi)
[/quote].
In fastagi-mapping.properties,

[quote]
hello.agi = HellloManager
[/quote].
Then I have started the fastagi as
java -cp asterisk-java-0.3.1.jar:. org.asteriskjava.fastagi.DefaultAgiServer
After the agiserver startted,I have called 1300 from an extension,It is showing the following error:

[quote]
INFO: Received connection from /127.0.0.1
Jan 23, 2008 12:32:13 PM org.asteriskjava.fastagi.AbstractMappingStrategy createAgiScriptInstance
SEVERE: Unable to create AgiScript instance of type HelloManager: Class does not implement the AgiScript interface
Jan 23, 2008 1:03:19 PM org.asteriskjava.fastagi.AbstractMappingStrategy createAgiScriptInstance
SEVERE: Unable to create AgiScript instance of type hello.agi: Class not found, make sure the class exists and is available on the CLASSPATH
Jan 23, 2008 1:03:19 PM org.asteriskjava.fastagi.internal.AgiConnectionHandler run
SEVERE: No script configured for URL ‘agi://localhost/hello.agi’ (script ‘hello.agi’)
[/quote].
Am i going wrong?If so could you please help me?