# Transferring a call

Use nccAutomaticTransfer or nccTransferCall to transfer a call.

#### Prototype

DWORD NMSAPI nccAutomaticTransfer ( NCC_CALLHD callhd, char *digitstr, unsigned transferwhen, void *transferparms, void *mgrcallparms, void *protcallparms)

Argument | Description
callhd | Call handle returned to the application with the NCCEVN_SEIZURE_DETECTED event or returned from nccPlaceCall.
Digitstr | Not used with SIP for NCC.
Transferwhen | Specifies when to transfer the call. Valid values: NCC_TRANSFER_PROCEEDING NCC_TRANSFER_ALERTING NCC_TRANSFER_CONNECTED
Transferparms | Not used with SIP for NCC.
Mgrcallparms | Not used with SIP for NCC.
protcallparms | Pointer to a buffer containing SIP IEs.

#### Details

nccAutomaticTransfer sends a REFER message to the transferee with the refer-to header containing the SIP_IE_CONTACT_ADDRESS provided in protcallparms. The stack disconnects the call when it receives:

- 2xx status for NCC_TRANSFER_PROCEEDING.

- 180 or 183 for NCC_TRANSFER_ALERTING.

- 200 for NCC_TRANSFER_CONNECTED.

Specify SIP_IE_TRANSFER_TIMEOUT to abort the transfer after xxx milliseconds have elapsed.

#### Example

DWORD b[256];
NCC_SIP_INFO *ie;
static char digits[40] = "123";
static unsigned when = NCC_TRANSFER_PROCEEDING;
promptuns( "Transfer on: 1-proceeding, 2-alerting, 3-connected", &when) ;
promptstr( "Contact", sip.contact, sizeof(sip.contact) );
NCC_SIP_INFO_INIT ( b, &ie );
NCC_SIP_INFO_ADD_STR ( b, &ie, SIP_IE_CONTACT_ADDRESS, sip.contact ); // contact
ret = nccAutomaticTransfer( currentContext->callhd, digits, when, NULL, NULL, b );

#### Prototype

DWORD NMSAPI nccTransferCall (NCC_CALLHD callhd1, NCC_CALLHD callhd2, void *protcallparms)

Argument | Description
callhd1 | Call handle returned to the application with the NCCEVN_SEIZURE_DETECTED event or returned from nccPlaceCall.
callhd2 | Call handle returned to the application with the NCCEVN_SEIZURE_DETECTED event or returned from nccPlaceCall.
protcallparms | Set this parameter to SIP_SUPERVISED_TRANSFER to enable supervised transfer with SIP for NCC.

#### Details

nccTransferCall performs a supervised call transfer using the two call handles specified when calling the function. The two calls must be in the NCC_CALLSTATE_CONNECTED before calling this function.

The function uses callhd2 to construct a replaces header that is appended to a REFER message that is sent to the call specified by callhd1. In the REFER message, refer-to is set to the contact field from callhd2 followed by the replaces header. On success, both calls are disconnected with NCC_DIS_TRANSFER for callhd1 and NCC_DIS_SIGNAL for callhd2.

#### Example

ret = nccTransferCall(callhd1, callhd2, SIP_SUPERVISED_TRANSFER );