# Sending SIP messages

There are two ways to send a SIP message with the SIP for NCC API:

- Using SIP for NCC API functions that send SIP messages automatically.

- Use nccSendCallMessage to send SIP messages that cannot be sent by using other NCC functions. When you use nccSendCallMessage, you must include values for SIP information elements.

## Using SIP for NCC API functions that send SIP messages automatically

The following table lists the SIP for NCC API functions along with the SIP commands and responses they are associated with:

Function | SIP method | Response code
nccAcceptCall | INVITE | 180
nccAcknowledgeCall | ACK | request
INVITE | 100
nccAnswerCall | INVITE | 200
nccAutomaticTransfer | REFER | request
nccDisconnectCall | BYE or CANCEL | request
nccHandleTransferRequest | REFER | 202 or 501
nccHoldCall | INVITE | request
nccPlaceCall | INVITE | request
nccRejectCall | INVITE | 3xx, 4xx, 5xx
nccRetrieveCall | INVITE | request
nccSendCapabilityQuery | REQUEST | 200
nccSendCapabilityResponse | OPTIONS | 200
nccSendPrack | PRACK | request
nccSendPrackResponse | PRACK | 200
nccTransferCall | REFER | request

For example, to send a SIP INVITE request when you are placing a call, invoke nccPlaceCall. The nccPlaceCall function generates a SIP INVITE request and sends it automatically.

Note: This method of sending a SIP message is compatible with SIP for NCC 1.0 functionality.

## Using nccCallMessage

Use nccSendCallMessage to send SIP messages that cannot be sent using the NCC functions listed in the previous subsection. When you use nccSendCallMessage, include the following information elements with the function:

- SIP_IE_BODY

- SIP_IE_CONTENT_LENGTH

- SIP_IE_CONTENT_TYPE

- SIP_IE_METHOD

- SIP_IE_OTHER_HEADER

- SIP_IE_RESPONSE_CODE

The following table lists the SIP methods and response codes that you can use with nccSendCallMessage:

SIP method | Response codes | Notes
INVITE used to initiate a dialog | 1xx |
INVITE issued in the context of a dialog (also called a re-INVITE) | request | Used in the connected state only.
1xx – 6xx | Used in the connected state only.
ACK | Used in the connected state only. The ACK message may be generated automatically, depending on the server configuration.

For example, to send a SIP INVITE request in the context of a dialog (a re-INVITE request), invoke nccSendCallMessage with the following information element values:

- SIP_IE_METHOD = INVITE

- SIP_IE_BODY = SDP offer for reINVITE