Transfer a call

I have been often asked, how to transfer a call.Hmmm.. if you now how, it seems to be very easy, so enjoy that code

 

Written by Jörg Wiesmann   Saturday, 05 August 2006

**

     @param connectionMaster
     @param numberToTransferTo
     */
    public void transferCall(CallControlConnection connectionMaster, 
        String numberToTransferTo) {

        if (observedAddress.getConnections() != null && 
            observedAddress.getConnections()[0].getState() == Connection.CONNECTED) {
            CiscoCall callMaster = 
              (CiscoCallobservedAddress.getConnections()[0].getCall();
            CiscoCall callCreateNew;
            try {
                callCreateNew = (CiscoCallprovider.createCall();
                try {
                    ((CallControlTerminalConnectionobservedAddress.getTerminals()[0].
                        getTerminalConnections()[0]).hold();
                    ((CiscoConnectionobservedAddress.getConnections()[0]).
                    redirect(numberToTransferTo, CiscoConnection.REDIRECT_NORMAL,
                            CiscoConnection.ADDRESS_SEARCH_SPACE);
                    // callCreateNew.transfer(callMaster);
                catch (Exception e) {
                    TerminalConnection terminalNewCreated = observedAddress.
                    getTerminals()[0].getTerminalConnections()[0];
                    if (callMaster.getConferenceController() == null) {

                        callMaster.setConferenceController(terminalNewCreated);
                        callCreateNew.setTransferEnable(true);
                    }
                    callCreateNew.consult(terminalNewCreated, numberToTransferTo);
                    callMaster.transfer(callCreateNew);
                }
            catch (Exception e) {
                Logger.getLogger(this.getClass()).warn(“Transfer failed created ” + e);
            }
        else {
            Logger.getLogger(this.getClass()).info(“Connection must be ” +
                “established to transfer a call”);
        }
    }

 

Leave a Reply

Your email address will not be published. Required fields are marked *