# NCID API Documentation
![](images/ncid-1.jpg)
API 1.10
Last edited: Jan 13, 2020
Copyright © 2010-2020
John L Chmielewski
Todd A Andrews
This document contains information needed to develop servers, clients, client output modules and gateways for NCID (Network Caller ID). All example phone numbers and names contained herein are intended to be fictional. There are 5 feature sets of NCID conformance: - Feature Set 1: Modem and Device Support (required) - Feature Set 2: Gateway Support (optional) - Feature Set 3: Client Job Support (optional) - Feature Set 4: Acknowledgment Support (optional) - Feature Set 5: Relay Job Support (optional) ## Table of Contents > **[Before you begin](#b4-begin)** >> [ABOUT CONFIGURATION OPTIONS FOR SERVER IMPLEMENTATIONS](#about-config) >> [ABOUT END-OF-LINE TERMINATORS](#about-eol) >> [ABOUT LINE TYPES AND FIELD PAIRS](#about-pairs) >> [GENERAL NOTES ON NAME, NMBR, LINE AND MESG FIELD DATA](#gen-text) >> [GENERAL NOTES ON DATE AND TIME FIELD DATA](#gen-datetime) >> [ENSURING CONNECTIVITY WITH THE SERVER](#connectivity) >> [COMPANION DOCUMENTS](#companion) > **[Call/Message Line Types, Categories and Structure (new in API 1.7)](#comm)** >> [OVERVIEW](#comm-overview) >> [TABLE](#comm-table) >> [{CALLTYPES} CATEGORY STRUCTURE](#comm-calltypes) >> [{MSGTYPES} CATEGORY STRUCTURE](#comm-msgtypes) >>> [Server Output Lines](#comm-msgtypes-server) >>> [Client/Gateway Output Lines](#comm-msgtypes-client-gw) > **[Feature Set 1: Modem and Device Support](#fs1-modem-support)** >> [SERVER IMPLEMENTATION](#fs1-server-impl) >>> [Server Output Lines](#fs1-server-output) >>> [Server Alias Support](#fs1-alias-support) >>> [Server Hangup Support](#fs1-hangup-support) >>> [Modem-to-Server](#fs1-modem2server) >>> [Optional Server Extensions](#fs1-server-ext) >>> [Optional Server Hangup Extension](#fs1-hangup-ext) >>> [Optional NetCallerID Device-to-Server](#fs1-netcid2server) >>> [Optional TCI Device-to-Server (new in API 1.1)](#fs1-tci2server) >> [CLIENT IMPLEMENTATION](#fs1-client-impl) >>> [Client-to-Server](#fs1-client2server) >>> [Optional Client-to-Module](#fs1-client2module) >>> [Optional Client-to-TiVo Display (Removed in API 1.6) ](#fs1-client2tivo) > **[Feature Set 2: Gateway Support](#fs2-gw-support)** >> [SERVER IMPLEMENTATION](#fs2-server-impl) >>> [XDMF Input (new in API 1.8)](#fs2-xdmf-input) >>> [Server Output Lines](#fs2-server-output) >> [GATEWAY IMPLEMENTATION](#fs2-gw-impl) >>> [Gateway-to-Server](#fs2-gw2server) >>> [Forwarding Gateway (Server-to-Server) (new in API 1.4)](#fs2-fwdgw) >> [CLIENT IMPLEMENTATION](#fs2-client-impl) >>> [Optional Client-to-Module](#fs2-client2module) > **[Feature Set 3: Client Job Support](#fs3-client-job-support)** >> [OVERVIEW OF AVAILABLE CLIENT JOBS](#fs3-overview) >> [SERVER IMPLEMENTATION](#fs3-server-impl) >>> [Server Output Lines](#fs3-server-output) >> [CLIENT IMPLEMENTATION](#fs3-client-impl) >>> [Client-to-Server](#fs3-client2server) >> [REQUIREMENTS FOR DIAL-A-NUMBER CLIENT JOB (new in API 1.6)](#fs3-dial-req) >>> [*lineid*](#fs3-dial-lineid) >>> [Server Implementation](#fs3-dial-server-impl) >>> [Client Implementation](#fs3-dial-client-impl) >> [CLIENT JOB EXAMPLES](#fs3-examples) > **[Feature Set 4: Acknowledgment Support](#fs4-ack-support)** >> [SERVER IMPLEMENTATION](#fs4-server-impl) >>> [Server Output Lines](#fs4-server-output) >> [GATEWAY IMPLEMENTATION](#fs4-gw-impl) >>> [Gateway-to-Server](#fs4-gw2server) >> [CLIENT IMPLEMENTATION](#fs4-client-impl) >>> [Client-to-Server](#fs4-client2server) > **[Feature Set 5: Relay Job Support (new in API 1.4)](#fs5-relay-job-support)** >> [RELAY JOB OVERVIEW](#fs5-overview) >> [SERVER IMPLEMENTATION](#fs5-server-impl) >> [RELAY JOB ORIGIN (RJO) IMPLEMENTATION](#fs5-origin-impl) >>> [RJO Line Type Definition](#fs5-def-rjo) >> [RELAY JOB TARGET (RJT) IMPLEMENTATION](#fs5-target-impl) >>> [RJT Line Type Definition](#fs5-def-rjt) >> [RELAY JOB EXAMPLES](#fs5-examples) > **[Sending a Text Message](#sending-messages)** > **[Country Codes](#country-codes)** > **[Emulation Programs and Test Files](#emulation)** > **[Appendix A: Copy-and-paste friendly {CALLTYPES} and {MSGTYPES}](#quick-ref-call-types)** > **[Appendix B: Index of line type definitions](#index-line-types)** > **[Appendix C: Quick Reference List of all server configuration settings](#quick-ref-serv-config)** > **[Appendix D: More info about modem MESG hexadecimal characters](#modem-mesg-hex)** > **[Appendix E: SMS Relay Job sequence diagram (new in API 1.4)](#ncidpop-sms-relay)** > **[API Version Change History](#api-history-top)** >> [Release Summary](#api-release-summary) >> [Version 1.10](#api-history-1.10) >> [Version 1.9](#api-history-1.9) >> [Version 1.8](#api-history-1.8) >> [Version 1.7](#api-history-1.7) >> [Version 1.6](#api-history-1.6) >> [Version 1.5](#api-history-1.5) >> [Version 1.4](#api-history-1.4) >> [Version 1.3](#api-history-1.3) >> [Version 1.2](#api-history-1.2) >> [Version 1.1](#api-history-1.1) >> [Version 1.0](#api-history-1.0) > **[Documentation Change History](#doc-history-top)** >> [April 24, 2019](#doc-history-2019-04-24) >> [October 25, 2018](#doc-history-2018-10-25) >> [August 17, 2018](#doc-history-2018-08-17) >> [May 31, 2018](#doc-history-2018-05-31) >> [November 5, 2017](#doc-history-2017-11-05) >> [November 6, 2016](#doc-history-2016-11-06) >> [September 30, 2016](#doc-history-2016-09-30) >> [July 23, 2016](#doc-history-2016-07-23) >> [May 7, 2016](#doc-history-2016-05-07) >> [December 29, 2015](#doc-history-2015-12-29) ## Before you begin > ### ABOUT CONFIGURATION OPTIONS FOR SERVER IMPLEMENTATIONS >> This API document attempts to describe server interactions with gateways, clients, extensions, etc. without regard to a specific operating system or specific programming methods and conventions. However, for the purpose of reading this document we will reference configuration options using the following convention: >>**<configuration file name::setting name>** >> In the case of the official NCID distribution for Unix/Linux platforms, there are several configuration files. Here are just a few of them: >>> Purpose | Unix/Linux File Name | Convention used in this API --------------------------|----------------------|:--------------------------- Server settings | ncidd.conf | **<ncidd.conf::setting name>** Alias mappings | ncidd.alias | **<ncidd.alias::alias definition>** Blacklist | ncidd.blacklist | **<ncidd.blacklist::call name or number>** Whitelist | ncidd.whitelist | **<ncidd.whitelist::call name or number>** Universal Client settings | ncid.conf | **<ncid.conf::setting name>** SIP Gateway settings | sip2ncid.conf | **<sip2ncid.conf::setting name>** YAC Gateway settings | yac2ncid.conf | **<yac2ncid.conf::setting name>** XDMF Gateway settings | xdmf2ncid.conf | **<xdmf2ncid.conf::setting name>** >> An example of a setting name in the server configuration file would be `lockfile`. Within this document you would see the setting referenced as **ncidd.conf::lockfile**. >> If a developer wishes to create his or her own NCID server, any configuration file name and setting name convention desired can be used. For example, an NCID server for Windows might use a file name called **ncid-server.ini** and a setting called **LockFile=**. >> Using the **<configuration file name::setting name>** convention allows a developer to correlate the setting names referenced in this API with the developer's own conventions. In this regard, you can think of **<configuration file name::setting name>** as a reference to a concept or definition. **ncidd.conf::lockfile** therefore refers to the path of the server's serial port lock file. An alphabetized summary of all server options, including a brief description, can be found in [Appendix C: Quick Reference List of all server configuration settings](#quick-ref-serv-config). > ### ABOUT END-OF-LINE TERMINATORS > >> Carriage return characters may appear in this document as <CR>, x0D, or \r. Line feeds a.k.a. new lines may appear as <LF>, <NL>, x0A, or \n. >> Because of NCID's Unix origin, generally speaking, line feeds are the preferred line terminator. This applies not only to client/server communications but also to reading files (e.g., **ncidd.conf**, **ncidd.alias**, **ncid.conf**, **ncid-mysql.conf**, etc.) as well as writing files (e.g., **ncidd.log**, **ncidd.alias**, **cidcall.log**, etc.). >> Even though line feeds are preferred, the Unix distributions of NCID will generally play it safe and look for both <CR> and <LF>, stripping these characters prior to storing data in memory or otherwise processing the read/received data. In other words, NCID does not enforce which end-of-line terminator is used when reading files or receiving data, it just requires a minimum of one (<CR> or <LF>) to be used. >> The exception is when NCID must *write* or *send* data to third party hardware, processes, or protocols. In these cases, third party requirements will dictate the end-of-line terminators to be used. NCID already takes this exception into account for all officially supported third party interactions. > ### ABOUT LINE TYPES AND FIELD PAIRS >> The reason for the following restrictions is to allow future NCID programs and scripts to be as backward compatible as possible. This is particularly important in the case of third party software that may not be updated at the same time as a new NCID release. >> ### Line Types >> - This document uses XXX, XXX:, XXXLOG:, etc. where XXX is a place holder when discussing something that applies to multiple line types. >> - It is very important for a program or script to ignore line types (e.g., 200, 210, CID:, HUP:, REQ: etc.) that it does not recognize. It should not trigger a fatal error. >> ### Field Pairs >> A field pair is defined as <field label><field data>, with zero or more delimiter characters between them. >> The very first field pair for a line **might** begin with the three characters \#\#\# to indicate the data is being sent TO the server, or begin with the three characters \*\*\* to indicate the data is being received FROM the server. >> **It is very important NOT to assume that the order of field pairs will always be the same across NCID versions.** >> For example, if today a hypothetical layout of field pairs looks like this: >>> `XYZ: ***DATE**TIME*