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();
}

}