4.11 Packet Exchanges for ACD proxy requests and responses

Figure 13: ACD proxy request and response exchange
The agent application can send proxy requests and receive proxy responses by following these steps:
The client establishes the session as described in the example in section 4.1.
The client sends a CreateAgent packet to server to create an agent. The return value is a positive number that is the request identifier, or a negative number in case of error.
The server creates a packet LINE_PROXYREQUEST with structure based on the client requested packet type. For CreateAgent packet, LINE_PROXYREQUEST packet is created with structure of type LINEPROXYREQUEST_CREATEAGENT.
The server sends the LINE_PROXYREQUEST packet to registered proxy function handler.
After completing the request, proxy application sends the response by calling lineProxyResponse function which results in generation of LINE_REPLY packet.
The server calls the RemoteSPEventProc method of the client with the LINE_REPLY packet, which matches the request identifier previously returned for the proxy request packet. A return value of 0 indicates that the operation was carried out successfully, or a negative number is returned on error.