Unpack a CTI Message

Procedure


Step 1

Read the first 4 bytes as an unsigned integer. This value is the message BodyLength. Remember to convert the BodyLength bytes from network-byte order to host-byte order.

Step 2

Make sure all the BodyLength bytes are available from the network before further unpacking.

Step 3

Read the next 4 bytes and convert them to a host-byte-order unsigned integer. This value is the MessageTypeID.

Step 4

Based on the MessageTypeID, you can then use the message body definition to find out the fixed fields and their appropriate order in the fixed part of the message.

Step 5

Read each field, one by one, and convert it to host data-byte order, if needed.

Step 6

Based on the FieldDataID value and its definition, convert the floating data fields to the host-byte order, if necessary.

Step 7

Repeat this process to unpack the rest of floating fields until the end of the message. The end of the message is determined by the Message BodyLength.