NCID Client, Gateway, and Server Protocol Last modified by jlc on Fri May 23, 2008 The NCID-FORMAT file explains the lines sent to the client by the server. It also explains lines sent by a gateway to the server. Client Implementation: - connect to port 3333. - receive a connect line that identifies the server - possibly receive multiple CIDLOG lines (only at connect) - possibly receive a server MSG line - possibly receive a CIDINFO line at each ring - receive a CID line whenever a call comes in - ignore lines that do not begin with: 200 CID: CIDLOG: MSG: MSGLOG: CIDINFO: - parse CID and CIDLOG lines based on name fields, so if fields are added, the client will still work - clients are allowed to connect and disconnect as they please - clients are allowed to send a text message to the server Gateway Implementation: - connect to port 3333. - read and ignore all lines from the server, including: a connect line that identifies the server and CIDLOG, MSGLOG, CID, and MSG lines - connect to Caller ID service - when CID information is obtained from the service, send the data to the server in the CALL data Line format - if hangup detected before answer, send the data to the server in the CALLINFO CANCEL line format - if hangup detected after answer, send the data to the server in the CALLINFO BYE Line format - If outgoing call is detected, send the data to the server in the CALLINFO CALLED Line forma Server Implementation: - listen to port 3333 for a connection, - send a connect line to identify the server - if configured, send CIDLOG and MSGLOG lines when a client connects these are the CID: and MSG: lines in cidcall.log - send a CID line when a call is received to connected clients - send a MSG line with important information, if needed - send a CIDINFO line at each ring with a line indicator (default -) and the ring count - send a CIDINFO line after ringing stops, with a ring count of 0 - maintain a constant TCP connection with the clients - detect clients as they come and go - if client sends text, sent it to all connected clients - if gateway sends a line prefixed with CALL: treat it as CID data from a device - if a gateway sends a line prefixed with CALLINFO: process CANECEL as a ring count of -1, and BYE as a ring count of -2