NCID Client, Gateway, and Server Protocol File last changed by jlc on Mon Oct 19, 2009 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 300 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 the call log file (cidcall.log) - send a 300 line if a call log was sent (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