4.4 Packet Exchanges to Answer an Incoming Call

Client answering an incoming call

Figure 6: Client answering an incoming call

A client can answer an incoming call by following the steps below:

  1. The client establishes the session as described in the example in section 4.1.

  2. The server calls the RemoteSPEventProc method of the client with the LINE_APPNEWCALL packet to indicate that a new call has appeared on the line device. The handle to the newly created call is provided as part of this LINE_APPNEWCALL packet. The client can allocate any required resources for a new call at this stage.

  3. The server calls the RemoteSPEventProc method of the client with the LINE_CALLSTATE packet; the call state is LINECALLSTATE_OFFERING to indicate that the client is being offered a new call.

  4. The client calls the Answer packet to the server to accept the incoming call. The return value is a positive number that is the request identifier, or a negative number in case of error.

  5. The server calls the RemoteSPEventProc method of the client with the LINE_REPLY packet, which matches the request identifier previously returned for the Answer packet. A return value of 0 indicates that the call was answered successfully, or a negative number is returned on error.

  6. When done with the call, the client calls ClientRequest with the Drop packet to terminate the call. The server closes the call and returns 0 if it is successful, and a negative error number if an error occurs.

  7. The client calls ClientRequest with the DeallocateCall packet to release any resources on the server. For example, even after terminating the call, the client might want to query information about the terminated call, such as the caller ID. The server closes the call, and the handle for this call is no longer valid. The server returns 0 if the DeallocateCall operation is successful, and a negative error number if an error occurs.

  8. The client can terminate the session as described in the example in section 4.2.