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 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(”, “username”, “password”);

this.managerConnection = factory.createManagerConnection();

public void run() throws IOException, AuthenticationFailedException,
TimeoutException, InterruptedException
// register for events

// connect to Asterisk and log in

// 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.setPriority(new Integer(1));
originateAction.setTimeout(new Integer(5000));

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

System.out.println(“I am coming hereeeeeeeeeeeeeee”);
System.out.println(“the reason for failure is=====>>”+originateResponse.getResponse().toString());
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

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

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

helloEvents = new HelloEvents();;

I have tried to compile the HelloEvents program like:

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

exten => 1300,1,Agi(agi://localhost/hello.agi)

hello.agi = HellloManager
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:

INFO: Received connection from /
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’)
Am i going wrong?If so could you please help me?