obi2ncid man page

obi2ncid — Obihai device to NCID gateway


obi2ncid [--configfile               |-C <filename>]
         [--debug                    |-D]
         [--delay                    |-d <seconds>]
         [--help                     |-h]
         [--linefx                   |-f <string>]
         [--logfile-append           |-l <filename>]
         [--logfile-overwrite        |-L <filename>]
         [--man                      |-m]
         [--ncidhost                 |-n <[host][:port]>]
         [--no-filter                |-N]
         [--obiport                  |-o <port>]
         [--pidfile                  |-p <filename>]
         [--rawfile-append           |-r <filename>]
         [--rawfile-overwrite        |-R <filename>]
         [--test                     |-t]
         [--verbose                  |-v <1-9>]
         [--version                  |-V]


The obi2ncid gateway obtains Caller ID from an Obihai VOiP telephone adapter and sends it to the NCID server. The server then sends the CID information to the NCID clients.

The gateway was developed using Obi100, OBi110 and OBi200 devices that were available.

The obi2ncid gateway uses either GTALK, the Voice Service AuthUserName, or the configurable default name for a line identifier.

The line identifier(s) can be aliased by the NCID server so you can give each Voice Service a meaningful identification.

The obi2ncid configuration file is /etc/ncid/obi2ncid.conf. See the obi2ncid.conf man page for more details.

The obi2ncid gateway can run on any computer, but normally it is run on same box as the NCID server. If it is not run on the same box as the NCID server, you must configure the server IP address in the configuration file.


The obi2ncid gateway attempts to assign the lineid based on the following table. "SP" is an abbreviation for "Service Provider" and "PSTN" is an abbreviation for "Public Switched Telephone Network."

Call type                       Lineid assigned
=========                       ===============
Google Voice in or out              "GTALK"
VoIP in or out on default line   <AuthUserName>
Incoming PSTN                        "FXO"
Outgoing PSTN using ##<number>       "FXS"
Outgoing VoIP using **1<number>      "SP1"
Outgoing VoIP using **2<number>      "SP2"
Outgoing VoIP using **3<number>      "SP3"
Outgoing VoIP using **4<number>      "SP4"
Device setup  using **5<number>      "SP5"
Outgoing VoIP using **9<number>    "OBITALK"  (a.k.a. Obi-to-Obi)
NOTES: If line selected is the GTALK line, then GTALK replaces SP?.
       If line selected is **9, then OBITALK replaces SP9.
       PSTN requires an OBiLINE device connected to an Obi200.

For incoming/outgoing PSTN calls, see the description for --linefx.

If **[0-9] is dialed on the keypad to select a line, the lineid becomes SP[0-9].

The number of SP lines are 1 to 4 plus 5 and 9, depending on the device. The default lineid for SP1 to SP4 can be changed only in the obi2ncid.conf configuration file. Google Talk is special in that "GTALK" can be detected on which SP line is used for it. The other voice providers must have their linesp[0-4] variable set to their lineid.

SP9 has the reserved lineid of "OBITALK" and can not be changed.

In cases where the lineid cannot otherwise be determined, the default lineid becomes OBIHAI.


This gateway does not work properly with a OBILINE add-on accessory that connects to a phone line.


Obihai VoIP Telephone Adapter: Obi100, Obi110, Obi200, Obi202?
Google Voice or a SIP voice provider
(voip.ms, callcentric, others untested)
The NCID server

perl 5.6 or higher, perl(Config::Simple)


--configfile <filename>, -C <filename>
Specifies the configuration file to use. The program will still run if a configuration file is not found.

Default: /usr/local/etc/ncid/obi2ncid.conf
--debug, -D
Debug mode, displays all messages that go into the log file. Use this option to run interactively.
--delay <seconds>, -d <seconds>
If the connection to the NCID server is lost, try every <delay> seconds to reconnect.

Default: 30
--help, -h
Displays the help message and exits.
--linefx <string>, -f <string>
This option requires the OBiLINE FXO-to-USB Phone Line Adapter for the Obi2xx series. The Obi110 has it built in.

Normally "FXO" and "FXS" refer to line (telco) and phone (handset) respectively. OBiLINE changes the meaning of these to be "FXO" for incoming calls and "FXS" for outgoing calls, so by default "FXO" and "FXS" are used as the lineid and can not be changed.

However, if --linefx is given a value, it replaces both "FXO" and "FXS" with that value.

For example:
--linefx POTS will cause the lineid for incoming and outgoing calls to be POTS.

Default: no default
--logfile-append <filename>, -l <filename>
--logfile-overwrite <filename>, -L <filename>
Specifies the logfile name to write. The program will still run if it does not have permission to write to it.

If both options are present, --logfile-append takes precedence.

Default: Append to /var/log/obi2ncid.log
--man, -m
Displays the manual page and exits.
--ncidhost=<[host][:port]>, -n <[host][:port]>
Specifies the NCID server. Port may be specified by suffixing the hostname with :<port>.

Input must be <host> or <host:port>, or <:port>.

Default: localhost:3333
--no-filter, -N
Useful for development and troubleshooting purposes.

A list of zero or more filter lines is stored in obi2ncid.conf.

An Obihai device periodically sends out packets when it is doing its own internal "housekeeping." Such packets do not have anything to do with call activity, but they can clutter and confuse verbose output because of their sheer volume and frequency.

However, in unusual circumstances it may be necessary to use the --no-filter option to include all housekeeping packets.

Default: filtering is ON
--obiport <port>, -o <port>
Specifies the UDP port to listen on for Caller ID from an OBi device.

Default: 4335
--pidfile <filename>, -p <filename>
Specifies the pidfile name to write. The program will still run if it does not have permission to write a pidfile. The pid filename that should be used is /var/run/obi2ncid.pid.

Default: no pidfile
--rawfile-append <filename>, -r <filename>
--rawfile-overwrite <filename>, -R <filename>
Useful for development and troubleshooting purposes.

Writes packets to a file exactly as received from the gateway device. A filename extension of .data is suggested. The rawfile can be "played back" using test-obi-gw.

Raw packets from Obihai devices do not have a date/time stamp. When played back, the obi2ncid gateway script will treat the packets as arriving using the current date/time.

If both options are present, --rawfile-append takes precedence.

Default: no raw file
--test, -t
Test mode is a connection to the gateway device without a connection to the NCID server. It sets debug mode and verbose = 3. The verbose level can be changed on the command line.

Default: no test mode
--verbose <1-9>, -v <1-9>
Output information, used for the logfile and the debug option. Set the level to a higher number for more information. Levels range from 1 to 9, but not all levels are used.

Default: verbose = 1
--version, -V
Displays the version and exits.


Start obi2ncid in test mode at verbose level 3
obi2ncid --test
Start obi2ncid in test mode at verbose level 5 and keep a test log
obi2ncid -t -v5 -L test.log
Start obi2ncid in test mode and keep a file of the input data
obi2ncid -t -R test.data
Start obi2ncid in debug mode at verbose level 1
obi2ncid -D



See Also

ncidd.8, ncidd.conf.5, obi2ncid.conf.1 test-obi-gw (available in source distribution only)