Loading...
Searching...
No Matches
vpbapi.h File Reference
Public API functions

Voicetronix voice processing board public API. More...

`#include <exception>`
`#include <string>`
`#include <vector>`
`#include <stdint.h>`
`#include <vt_deprecated.h>`
Include dependency graph for vpbapi.h:
This graph shows which files directly or indirectly include this file:

## Classes

struct | VPB_CARD_INFO
| Container type for data returned by `vpb_get_card_info()`. More...
struct | VPB_EVENT
| Container for VPB event data. More...
struct | VPB_PLAY
| Port playback parameters. More...
struct | VPB_RECORD
| Port recording parameters. More...
class | VpbException
| VPB api runtime exception type. More...
struct | VPB_TONE_MAP
struct | VPB_CALL
struct | VPB_TONE
| Tone definition structure. More...
struct | VPB_STRAN
| Cadence state transition data for `VPB_DETECT`. More...
struct | VPB_DETECT
| Container for programmable tone detector parameters. More...
struct | Country
| Container type for country specific data. More...
struct | VPB_VOX
struct | VPB_VLOG
| Additional data that may be included in a wav file. More...
struct | VPB_DIGITS
| Digit collection parameters. More...
struct | VPB_CID
| Container type for caller id data. More...
struct | VPB_CID_JP
struct | VPB_CALL_INFO

## Macros

#define | WINAPI
#define | VPB_OK 0
#define | VPB_NO_EVENTS -1
#define | VPB_TIME_OUT -2
#define | VPB_MAX_STR 256
#define | VPB_RING_STATION_ON -1
| Ring station port with default cadence.
#define | VPB_RING_STATION_OFF 0
| Stop station port ringing.
#define | VPB_CONF_JOIN 1
#define | VPB_CONF_LEAVE 0
#define | VPB_FINISH 1
| return code for `vpb_play_buf_sync()` and `vpb_record_buf_sync()`.
#define | VPB_CALL_DISCONNECT 0
#define | VPB_CALL_DIALTONE 1
#define | VPB_CALL_RINGBACK 2
#define | VPB_CALL_BUSY 3
#define | VPB_CALL_GRUNT 4
#define | VPB_MAX_TONE_MAP 10
#define | VPB_CALL_CONNECTED 0
#define | VPB_CALL_NO_DIAL_TONE 1
#define | VPB_CALL_NO_RING_BACK 2
#define | VPB_CALL_NO_ANSWER 4
#define | VPB_CALL_DISCONNECTED 5
#define | VPB_VLOG_CHUNK 0x4000
| May be added to the Wave file mode to include a `VPB_VLOG` chunk when recording.
#define | VPB_CID_MAX_BUF 20400
| Maximum size of CID wav data.
#define | VPB_CID_MAX_DLP 256
| Maximum size of CID dlp data.
#define | VPB_DID_OTN 2
#define | VPB_DID_OTNRA 4
#define | VPB_DID_OTNEXP 0x21
#define | VPB_DID_CND 9
#define | VPB_DID_CNDEXP 0x22
Built in tone dectector ID's
#define | VPB_DIAL 0
| dial tone detected (US/Aust/sudio308)
#define | VPB_RINGBACK 1
| ringback detected (US)
#define | VPB_BUSY 2
| busy tone detected (US)
#define | VPB_GRUNT 3
| grunt detected
#define | VPB_RINGBACK_308 4
| ringback detected (studio 308)
#define | VPB_BUSY_308 5
| busy tone detected (studio 308)
#define | VPB_FAX 6
| fax CNG tone/preamble
#define | VPB_BUSY_AUST 7
| busy/disconnect tone detected (Australia)
#define | VPB_RINGBACK_AUS 8
| ringback detected (Australia)
#define | VPB_SPARE9 9
| Spare.

## Typedefs

typedef int | VPBPortHandle
| Symbolic type for a handle to an open port on some card.
typedef int | VPBOpenMode
| Symbolic type for `vpb_open()` mode flags.

## Enumerations

enum | VPB_MODEL { VPB_V4PCI = 2 , VPB_V4LOG = 3 , VPB_PRI = 6 , VPB_OPCI = 7 , VPB_OSW = 8 , VPB_MODEL_UNKNOWN = -1 }
| VPB card model types. More...
enum | VPB_PORT { VPB_PORT_UNKNOWN = 0 , VPB_FXO = 1 , VPB_FXS = 2 }
| Analogue port types. More...
enum | HookState { VPB_ONHOOK = 0 , VPB_OFFHOOK = 1 , VPB_FASTOFFHOOK = 2 }
| Symbolic hook states. More...
enum | BridgeMode { VPB_BRIDGE_OFF = 0 , VPB_BRIDGE_ON = 1 }
| Port bridging control flags. More...

enum

VPB_EVT_TYPE {
VPB_EVT_NONE = -1 , VPB_RING = 0 , VPB_DIGIT = 1 , VPB_TONEDETECT = 2 ,
VPB_TIMEREXP = 3 , VPB_VOXON = 4 , VPB_VOXOFF = 5 , VPB_DTMF = 8 ,
VPB_STATION_OFFHOOK = 9 , VPB_STATION_ONHOOK = 10 , VPB_RING_OFF = 11 , VPB_DROP = 12 ,
VPB_STATION_FLASH = 13 , VPB_LOOP_OFFHOOK = 14 , VPB_LOOP_ONHOOK = 15 , VPB_LOOP_POLARITY = 16 ,
VPB_DTMF_DOWN = 17 , VPB_LOOP_FLASH = 18 , VPB_PLAYEND = 100 , VPB_RECORDEND = 101 ,
VPB_DIALEND = 102 , VPB_TONE_DEBUG_END = 103 , VPB_CALLEND = 104 , VPB_ISDN_ANS = 110 ,
VPB_ISDN_BUSY = 111 , VPB_ISDN_CINFO = 112 , VPB_ISDN_CALL_FAIL = 113 , VPB_ISDN_ANS_FAIL = 114 ,
VPB_ISDN_PROCEEDING = 115 , VPB_ISDN_RINGING = 116 , VPB_USER_EVT = 255
}

| `VPB_EVENT` type values More...
enum | AudioCompress { VPB_LINEAR , VPB_ALAW , VPB_MULAW , VPB_OKIADPCM , VPB_OKIADPCM24 , VPB_RAW }
| Audio compression modes. More...
enum | AudioState { VPB_AUDIO_IDLE , VPB_AUDIO_PLAYING , VPB_AUDIO_RECORDING , VPB_AUDIO_TERMINATE , VPB_AUDIO_TERMINATE_SYNC }
| play/record state flags More...
enum | VPB_TONE_ID { VPB_TONE_DIAL , VPB_TONE_RINGING , VPB_TONE_BUSY , VPB_TONE_CONGESTION , VPB_TONE_UNOBTAINABLE , VPB_TONE_CALLWAITING , VPB_TONE_STUTTERDIAL , VPB_TONE_ID_MAX }
| Symbolic identifiers for predefined, localised tones. More...
enum | CollectEndReason { VPB_DIGIT_TERM = 0 , VPB_DIGIT_MAX = 1 , VPB_DIGIT_TIME_OUT = 2 , VPB_DIGIT_INTER_DIGIT_TIME_OUT = 3 }
| The termination reason passed in the `VPB_EVENT::data` field of a `VPB_DIGIT` event. More...
enum | CidCallType { VPB_CID_CT_UNKNOWN = 0x00 , VPB_CID_CT_VOICE = 0x01 , VPB_CID_CT_RBWF = 0x02 , VPB_CID_CT_MW = 0x81 }
| Symbolic CID call types. More...
enum | CidDataType { VPB_CID_EMPTY = 0 , VPB_CID_DATE_TIME = 1 , VPB_CID_CALLING_LINE_DN = 2 , VPB_CID_CALLED_DN = 3 , VPB_CID_RFA_CLDN = 4 , VPB_CID_CALLER_NAME = 7 , VPB_CID_RFA_CN = 8 , VPB_CID_CALL_TYPE = 0x11 , VPB_CID_NMSS = 0x13 }
| Field type identifiers for CID data. More...

## Functions

void WINAPI | vpb_set_global_apiq_size (int size)
| Set the maximum number of events the global `APIQ` may hold.
void WINAPI | vpb_set_channel_apiq_size (int size)
| Set the maximum number of events per-channel `APIQ's` may hold.
const char *WINAPI | vpb_get_driver_version ()
| Return the driver version as a string.
void WINAPI | vpb_get_driver_version (int *major, int *minor, int *patchlevel)
| Return the driver version as major, minor, and patchlevel components.
int WINAPI | vpb_get_num_cards ()
| Return the number of cards in the system.
int WINAPI | vpb_get_ports_per_card (int board)
| Return the number of ports on board.
int WINAPI | vpb_get_card_info (int board, VPB_CARD_INFO *detail)
| Return detail of the card model and revision for board.
std::string WINAPI | vpb_get_model (VPBPortHandle handle)
| Return a string indicating the board model.
int WINAPI | vpb_get_model (VPBPortHandle handle, char *str)
| Return a string indicating the board model.
const char *WINAPI | vpb_model_desc (VPB_MODEL model)
| Return a descriptive string for a `VPB_MODEL` type.
VPB_MODEL WINAPI | vpb_get_card_type (VPBPortHandle handle)
| Return the board model type for handle.
VPB_PORT WINAPI | vpb_get_port_type (VPBPortHandle handle)
| Return the `VPB_PORT` type for handle.
HookState WINAPI | vpb_get_hookstate (VPBPortHandle handle)
| Return the hook state of a port.
void WINAPI | vpb_sethook_async (VPBPortHandle handle, HookState hookstate)
| Signal a port to set its hook state. Returns immediately.
void WINAPI | vpb_sethook_sync (VPBPortHandle handle, HookState hookstate)
| Set the hook state of a port. Waits for it to change before returning.
void WINAPI | vpb_set_flashtime (VPBPortHandle handle, uint16_t min, uint16_t max)
| Set the window for detecting flash events on OpenPCI cards.
void WINAPI | vpb_ring_station_async (VPBPortHandle handle, int cadence=-1)
| Start or stop a station port ringing.
int WINAPI | vpb_bridge (VPBPortHandle h1, VPBPortHandle h2, BridgeMode mode)
| Create a full duplex bridge between ports h1 and h2.
int WINAPI | vpb_listen (VPBPortHandle dest, VPBPortHandle src, BridgeMode mode)
| Create a half duplex bridge routing audio from src to dest.
int WINAPI | vpb_soft_bridge (int h1, int h2, int mode)
void WINAPI | vpb_set_codec_reg (VPBPortHandle handle, uint16_t addr, uint16_t value)
| VT_DEPRECATED (int WINAPI vpb_conf(int h1, int resource, int mode))
void WINAPI | vpb_set_mprintf (void(*func)(const char *format,...))
| Specify a function to handle `mprintf()` logging output.
int WINAPI | vpb_dial_sync (int handle, const std::string &dialstr)
| Dials a string of digits on the port for handle.
int WINAPI | vpb_dial_async (int handle, const std::string &dialstr)
| Dials a string of digits on the port for handle.
int WINAPI | vpb_get_call (int handle, VPB_CALL *vpb_call)
int WINAPI | vpb_set_call (int handle, VPB_CALL *vpb_call)
int WINAPI | vpb_call_sync (int handle, char *dialstr)
int WINAPI | vpb_call_async (int handle, char *dialstr)
int WINAPI | vpb_call_async_jp (int handle, char *dialstr)
int WINAPI | vpb_call_sync_jp (int handle, char *dialstr)
int WINAPI | vpb_timer_open (void **timer, int handle, int id, unsigned long period)
int WINAPI | vpb_timer_close (void *timer)
int WINAPI | vpb_timer_start (void *timer)
int WINAPI | vpb_timer_stop (void *timer)
int WINAPI | vpb_timer_restart (void *timer)
int WINAPI | vpb_timer_get_unique_timer_id ()
int WINAPI | vpb_timer_change_period (void *timer, unsigned long newperiod)
void WINAPI | vpb_sleep (long time_ms)
| Put the current thread to sleep for some number of milliseconds.
void WINAPI | vpb_set_country (const Country *country)
| Set the global default country specific information.
int WINAPI | vpb_set_country (VPBPortHandle handle, const Country *country)
| Set the country specific information for an individual port.
const Country *WINAPI | vpb_get_port_country (VPBPortHandle handle)
| Get the current country data for port handle.
const Country *WINAPI | vpb_get_country_data (const std::string &name)
| Get country specific data by name.
const Country *WINAPI | vpb_get_country_data (int code)
| Get country specific data by numeric country code.
int WINAPI | vpb_setvox (int handle, VPB_VOX *vox)
int WINAPI | vpb_getvox (int handle, VPB_VOX *vox)
int WINAPI | vpb_adpcm_open (void **adpcm)
void WINAPI | vpb_adpcm_reset (void *adpcm)
void WINAPI | vpb_adpcm_close (void *adpcm)
int WINAPI | vpb_adpcm_encode (void *adpcm, char adpcmbuf[], unsigned short *nadpcmbytes, short linearbuf[], unsigned short nlinear)
int WINAPI | vpb_adpcm_decode (void *adpcm, short linearbuf[], unsigned short *nlinear, char adpcmbuf[], unsigned short nadpcmbytes)
int WINAPI | vpb_flush_digits (int handle)
| Clears the internal digit buffer for handle.
int WINAPI | vpb_get_digits_async (int handle, VPB_DIGITS *digits, char *digbuf)
| Get a buffer of `DTMF` digits.
CollectEndReason WINAPI | vpb_get_digits_sync (int handle, VPB_DIGITS *digits, char *digbuf)
| Get a buffer of `DTMF` digits.
int WINAPI | vpb_cid_decode (char *cid_number, const short *in, int n)
| Attempt to extract a caller's number from a buffer of samples.
int WINAPI | vpb_cid_decode2 (VPB_CID *cli_struct, const short *in, int n)
| Attempt to extract all caller id information from a buffer of samples.
void WINAPI | vpb_cid_debug_on (const char *debug_file_name)
| Enable debugging of the CID decoder.
int WINAPI | vpb_cid_jp_decode (VPB_CID_JP *jpcid, short *in, int n)
void WINAPI | vpb_log_to_file (VPBPortHandle h, const std::string &filename)
| Log full duplex audio from handle h to filename.
void WINAPI | vpb_log_terminate (VPBPortHandle h)
| Stop full duplex logging on handle h.
void WINAPI | vpb_monitor_audio (VPBPortHandle dest, VPBPortHandle src)
| Tap full duplex audio from src to dest.
void WINAPI | vpb_monitor_terminate (VPBPortHandle h)
| Cancel a tap to handle h created with `vpb_monitor_audio()`.
int WINAPI | vpb_loopback_on (int handle)
| Turns on software loop-back of tx->rx in the kernel.
int WINAPI | vpb_loopback_off (int handle)
| Turns off software loop-back of tx->rx in the kernel.
int WINAPI | vpb_hostecho_on (int handle)
| Enable the host echo canceller for handle.
int WINAPI | vpb_hostecho_off (int handle)
| Disable the host echo canceller for handle.
int WINAPI | vpb_echo_canc_force_adapt_on ()
int WINAPI | vpb_echo_canc_force_adapt_off ()
int WINAPI | vpb_echo_canc_enable ()
int WINAPI | vpb_echo_canc_disable ()
int WINAPI | vpb_echo_canc_get_sup_thresh (int handle, short *thresh)
| Get the current echo suppressor threshold.
int WINAPI | vpb_echo_canc_set_sup_thresh (int handle, short *thresh)
| Set the echo suppressor threshold.
int WINAPI | vpb_loopvolt_get (int h, short *volts)
int WINAPI | vpb_loopvolt_get_threshold (int h, short *volts)
int WINAPI | vpb_loopvolt_set_threshold (int h, short volts)
int WINAPI | vpb_loopvolt_get_lowlimit (int h, short *volts)
int WINAPI | vpb_loopvolt_set_lowlimit (int h, short volts)
int WINAPI | vpb_loop_get_onhookwindow (int h, int *ms)
int WINAPI | vpb_loop_set_onhookwindow (int h, int ms)
int WINAPI | vpb_loop_get_offhookwindow (int h, int *ms)
int WINAPI | vpb_loop_set_offhookwindow (int h, int ms)
int WINAPI | vpb_isdn_call (int h, char *number, char *cid, int layer1, int transcap, unsigned char *lowlayercompatibility=NULL)
int WINAPI | vpb_isdn_get_cinfo (int h, VPB_CALL_INFO *cinfo)
int WINAPI | vpb_isdn_get_layer1 (int h)
int WINAPI | vpb_isdn_get_transcap (int h)
int WINAPI | vpb_isdn_get_lowlayercompatibility (int h, unsigned char *lowlayercompatibility)
int WINAPI | vpb_isdn_get_cause (int h)
int WINAPI | vpb_isdn_proceeding (int h)
Deprecated functions
| VT_DEPRECATED (int WINAPI vpb_get_type(int h))
| VT_DEPRECATED (int WINAPI vpb_get_ports_per_card())
| VT_DEPRECATED (int WINAPI vpb_get_model(char *s))
| VT_DEPRECATED (int WINAPI vpb_is_station(int handle))
| VT_DEPRECATED (int WINAPI vpb_bridge(int h1, int h2, BridgeMode mode, int resource))
File playback
int WINAPI | vpb_play_file_sync (VPBPortHandle handle, const std::string &file_name)
| Utility function to play a wav file to a port.
int WINAPI | vpb_play_file_async (VPBPortHandle handle, const std::string &file_name, int data)
| Utility function to play a wav file to a port.
int WINAPI | vpb_play_voxfile_sync (int handle, const std::string &file_name, AudioCompress mode)
| Utility function to play a wav file to a port.
int WINAPI | vpb_play_voxfile_async (int handle, const std::string &file_name, AudioCompress mode, int data)
| Utility function to play a wav file to a port.
Buffer playback
void WINAPI | vpb_play_buf_start (VPBPortHandle handle, AudioCompress mode)
| Prepare and seize a port for playing audio from a buffer.
int WINAPI | vpb_play_buf_sync (VPBPortHandle handle, const char *buf, size_t len)
| Play a buffer of audio samples to a port.
int WINAPI | vpb_play_buf_async (VPBPortHandle handle, const char *buf, size_t len)
| Play a buffer of audio samples to a port.
void WINAPI | vpb_play_buf_finish (VPBPortHandle handle)
| Signal completion of audio playback and release a port for other users.
void WINAPI | vpb_play_buf_finish_sync (VPBPortHandle handle)
| Signal completion of audio playback and release a port for other users.
Playback termination
int WINAPI | vpb_play_terminate (int handle)
| Stop audio playback.
int WINAPI | vpb_play_terminate_sync (int handle)
| Stop audio playback.
Playback configuration
void WINAPI | vpb_play_set (VPBPortHandle handle, const VPB_PLAY &vpb_play)
| Set playback parameters for a port.
void WINAPI | vpb_play_set (VPBPortHandle handle, const VPB_PLAY *vpb_play)
| Set playback parameters for a port.
AudioState WINAPI | vpb_play_state (int handle)
| Return the current play state of a port.
void WINAPI | vpb_play_set_gain (VPBPortHandle handle, float gain)
| Set the software play gain component for a port.
float WINAPI | vpb_play_get_gain (VPBPortHandle handle)
| Return the software play gain for a port.
void WINAPI | vpb_play_get_gain (VPBPortHandle handle, float *gain)
| Set playback parameters for a port.
void WINAPI | vpb_play_set_hw_gain (VPBPortHandle handle, float gain)
| Set the hardware play gain component for a port.
float WINAPI | vpb_play_get_hw_gain (VPBPortHandle handle)
| Return the hardware play gain for a port.
File recording
int WINAPI | vpb_record_file_sync (VPBPortHandle handle, const std::string &file_name, AudioCompress mode)
| Utility function to record a wav file from a port.
int WINAPI | vpb_record_file_async (VPBPortHandle handle, const std::string &file_name, AudioCompress mode)
| Utility function to record a wav file from a port.
int WINAPI | vpb_record_voxfile_sync (int handle, const std::string &file_name, AudioCompress mode)
| Utility function to record a wav file from a port.
int WINAPI | vpb_record_voxfile_async (int handle, const std::string &file_name, AudioCompress mode)
| Utility function to record a wav file from a port.
Buffer recording
void WINAPI | vpb_record_buf_start (VPBPortHandle handle, AudioCompress mode)
| Prepare and seize a port for recording audio from a buffer.
int WINAPI | vpb_record_buf_sync (VPBPortHandle handle, char *buf, size_t len)
| Record a buffer of audio samples from a port.
int WINAPI | vpb_record_buf_async (VPBPortHandle handle, char *buf, size_t len)
| Record a buffer of audio samples from a port.
void WINAPI | vpb_record_buf_finish (VPBPortHandle handle)
| Signal completion of audio recording and release a port for other users.
Recording termination
int WINAPI | vpb_record_terminate (int handle)
| Stop audio recording.
int WINAPI | vpb_record_terminate_sync (int handle)
| Stop audio recording.
Tone generation
int WINAPI | vpb_playtone_async (int handle, const VPB_TONE &vpb_tone)
| Start a user defined tone playing and return immediately.
int WINAPI | vpb_playtone_async (int handle, const VPB_TONE *vpb_tone)
| Start a user defined tone playing and return immediately.
int WINAPI | vpb_playtone_async (int handle, VPB_TONE_ID tone_id)
| Start a locale specific predefined tone playing and return immediately.
int WINAPI | vpb_playtone_sync (int handle, const VPB_TONE &vpb_tone)
| Play a user defined tone, return when playback completes.
int WINAPI | vpb_playtone_sync (int handle, const VPB_TONE *vpb_tone)
| Play a user defined tone, return when playback completes.
int WINAPI | vpb_playtone_sync (int handle, VPB_TONE_ID tone_id)
| Play a locale specific predefined tone, return when playback completes.
int WINAPI | vpb_tone_terminate (int handle)
| Terminate a currently playing tone (user defined or dtmf).
Dial string aliases
int WINAPI | vpb_settone (char ident, const VPB_TONE *tone)
| Enables user to (re)define the tone associated with a dial string character.
int WINAPI | vpb_gettone (char ident, VPB_TONE *tone)
| Get the parameters of the tone represented in dial strings by ident.
int WINAPI | vpb_playtone_state (int handle)
| Returns state of play tone (1= playing, 0 = not playing).
Wave file output
void WINAPI | vpb_wave_open_write (WFILE **wav, const std::string &filename, int mode)
| Open a `RIFF` wave file for writing.
int WINAPI | vpb_wave_write (WFILE *wav, const char *buf, long n)
| Write a block of audio samples to a `RIFF` wave file.
void WINAPI | vpb_wave_close_write (WFILE *wav)
| Close a `RIFF` wave file after writing.
Wave file input
void WINAPI | vpb_wave_open_read (WFILE **wav, const std::string &filename)
| Open a `RIFF` wave file for reading.
int WINAPI | vpb_wave_read (WFILE *wav, char *buf, unsigned long n)
| Read a block of audio samples from a `RIFF` wave file.
void WINAPI | vpb_wave_close_read (WFILE *wav)
| Close a `RIFF` wave file after reading.
Miscellaneous wave file operations
size_t | vpb_wave_get_size (WFILE *wav)
| Return the size of wave file data in bytes.
AudioCompress WINAPI | vpb_wave_get_mode (WFILE *wav)
| Return the compression mode of wav.
void WINAPI | vpb_wave_set_sample_rate (WFILE *wav, unsigned short rate)
| Change the sample rate of a wav file.
int WINAPI | vpb_wave_seek (WFILE *wav, long offset)
| Move the wave pointer to a specified location in the samples.
Wave file VLOG data
int WINAPI | vpb_wave_set_vlog (WFILE *wav, VPB_VLOG *buf)
| Set `VPB_VLOG` information for inclusion in a wave file.
int WINAPI | vpb_wave_get_vlog (WFILE *wav, VPB_VLOG *buf)
| Get `VPB_VLOG` information from a wave file.
High level functions
int WINAPI | vpb_cid_set (VPB_CID *cid, CidDataType field, void *value)
| Set a field in the cid data structure.
void WINAPI | vpb_ring_with_cid (int handle, const VPB_CID &cid, int cadence=-1)
| Start handle ringing and send type 1 caller id information.
void WINAPI | vpb_send_cid_t2_sync (int handle, const VPB_CID &cid)
| Send type 2 caller id information to handle.
Low level functions
int WINAPI | vpb_cid_compose_dlp (const VPB_CID &cid, char *dlp)
| Create a data link packet from a `VPB_CID` structure.
int WINAPI | vpb_cid_compose_dlp (const VPB_CID *cid, char *dlp)
| Create a data link packet from a `VPB_CID` structure.
void WINAPI | vpb_cid_compose_wav (const char *dlp, int dlp_len, short *wav_buf, int *wav_len, const Country *country=NULL)
| Encode a data link packet into CP-FSK wav data for type 1 CID.
void WINAPI | vpb_cid_t2_compose_wav (const char *dlp, int dlp_len, short *wav_buf, int *wav_len, const Country *country=NULL)
| Encode a data link packet into CP-FSK wav data for type 2 CID.

## Variables

const VPBPortHandle | VPB_PORTHANDLE_NULL = -1

## Event mask values

#define | VPB_MRING (1<<VPB_RING)
| The callback function type for `vpb_set_event_callback()`.
#define | VPB_MDIGIT (1<<VPB_DIGIT)
| The callback function type for `vpb_set_event_callback()`.
#define | VPB_MDTMF (1<<VPB_DTMF)
| The callback function type for `vpb_set_event_callback()`.
#define | VPB_MTONEDETECT (1<<VPB_TONEDETECT)
| The callback function type for `vpb_set_event_callback()`.
#define | VPB_MTIMEREXP (1<<VPB_TIMEREXP)
| The callback function type for `vpb_set_event_callback()`.
#define | VPB_MVOXON (1<<VPB_VOXON)
| The callback function type for `vpb_set_event_callback()`.
#define | VPB_MVOXOFF (1<<VPB_VOXOFF)
| The callback function type for `vpb_set_event_callback()`.
#define | VPB_MSTATION_OFFHOOK (1<<VPB_STATION_OFFHOOK)
| The callback function type for `vpb_set_event_callback()`.
#define | VPB_MSTATION_ONHOOK (1<<VPB_STATION_ONHOOK)
| The callback function type for `vpb_set_event_callback()`.
#define | VPB_MRING_OFF (1<<VPB_RING_OFF)
| The callback function type for `vpb_set_event_callback()`.
#define | VPB_MDROP (1<<VPB_DROP)
| The callback function type for `vpb_set_event_callback()`.
#define | VPB_MSTATION_FLASH (1<<VPB_STATION_FLASH)
| The callback function type for `vpb_set_event_callback()`.
#define | VPB_MLOOP_OFFHOOK (1<<VPB_LOOP_OFFHOOK)
| The callback function type for `vpb_set_event_callback()`.
#define | VPB_MLOOP_ONHOOK (1<<VPB_LOOP_ONHOOK)
| The callback function type for `vpb_set_event_callback()`.
#define | VPB_MLOOP_POLARITY (1<<VPB_LOOP_POLARITY)
| The callback function type for `vpb_set_event_callback()`.
#define | VPB_MLOOP_FLASH (1<<VPB_LOOP_FLASH)
| The callback function type for `vpb_set_event_callback()`.
#define | VPB_MDTMF_DOWN (1<<VPB_DTMF_DOWN)
| The callback function type for `vpb_set_event_callback()`.
#define | VPB_MALL_EVENTS ((unsigned long)-1)
| The callback function type for `vpb_set_event_callback()`.
typedef void(WINAPI * | vpb_event_callback) (VPB_EVENT *e, void *context)
| The callback function type for `vpb_set_event_callback()`.
int WINAPI | vpb_enable_event (VPBPortHandle handle, unsigned long mask)
| Enable the events specified by mask for handle.
int WINAPI | vpb_disable_event (VPBPortHandle handle, unsigned long mask)
| Disable the events specified by mask for handle.
unsigned long WINAPI | vpb_get_event_mask (VPBPortHandle handle)
| Return the current event mask for handle.
int WINAPI | vpb_set_event_mask (VPBPortHandle handle, unsigned long mask)
| Set the event mask for handle.
int WINAPI | vpb_get_event_async (VPB_EVENT *event)
| Fetch the next event from the global event queue.
int WINAPI | vpb_get_event_ch_async (VPBPortHandle handle, VPB_EVENT *event)
| Fetch the next event from a port specific event queue.
int WINAPI | vpb_get_event_sync (VPB_EVENT *event, unsigned int time_out=0)
| Wait for an event on the global event queue.
int WINAPI | vpb_get_event_ch_sync (VPBPortHandle handle, VPB_EVENT *event, unsigned int time_out=0)
| Wait for an event on a port specific event queue.
int WINAPI | vpb_put_event (VPB_EVENT *event)
| Places an event on the global and port specific event queues.
void WINAPI | vpb_translate_event (VPB_EVENT *event, char *str)
| Converts a given event into a string describing it.
int WINAPI | vpb_set_event_callback (VPBPortHandle handle, vpb_event_callback callback, void *context=NULL)
| Sets an event callback function to use instead of the `APIQ`.
int WINAPI | vpb_get_event_count (void)
| Returns the number of events on the global event queue.
int WINAPI | vpb_get_event_count_ch (VPBPortHandle handle)
| Returns the number of events on the port specific event queue for handle.
void WINAPI | vpb_flush_events (VPBPortHandle handle)
| Clear all unread events from the queue for handle.
void WINAPI | vpb_flush_events ()
| Clear all unread events from the global event queue.

## Recording configuration

#define | VPB_RECORD_DIGIT 1
| Set recording parameters for a port.
#define | VPB_RECORD_TIMEOUT 2
| Set recording parameters for a port.
#define | VPB_RECORD_ENDOFDATA 3
| Set recording parameters for a port.
#define | VPB_RECORD_MAXDIGIT 4
| Set recording parameters for a port.
void WINAPI | vpb_record_set (VPBPortHandle handle, const VPB_RECORD &vpb_record)
| Set recording parameters for a port.
void WINAPI | vpb_record_set (VPBPortHandle handle, const VPB_RECORD *vpb_record)
| Set recording parameters for a port.
AudioState WINAPI | vpb_record_state (int handle)
| Return the current record state of a port.
void WINAPI | vpb_record_set_gain (VPBPortHandle handle, float gain)
| Set the software record gain component for a port.
float WINAPI | vpb_record_get_gain (VPBPortHandle handle)
| Return the software record gain for a port.
void WINAPI | vpb_record_get_gain (VPBPortHandle handle, float *gain)
| Set recording parameters for a port.
void WINAPI | vpb_record_set_hw_gain (VPBPortHandle handle, float gain)
| Set the hardware record gain component for a port.
float WINAPI | vpb_record_get_hw_gain (VPBPortHandle handle)
| Return the hardware record gain for a port.

## General limits

#define | VPB_MD 10
| The maximum number of tone detectors per device.
#define | VPB_MS 10
| The maximum number of cadence states to match.
enum | ToneStateTransition { VPB_TIMER = 0 , VPB_RISING = 1 , VPB_FALLING = 2 , VPB_DELAY = 3 }
| Tone detector state transition types.

## Tone masks

#define | VPB_MDIAL (1<<VPB_DIAL)
| Set or change the parameters for a tone to detect on some port.
#define | VPB_MRINGBACK (1<<VPB_RINGBACK)
| Set or change the parameters for a tone to detect on some port.
#define | VPB_MBUSY (1<<VPB_BUSY)
| Set or change the parameters for a tone to detect on some port.
#define | VPB_MGRUNT (1<<VPB_GRUNT)
| Set or change the parameters for a tone to detect on some port.
#define | VPB_MRINGBACK_308 (1<<VPB_RINGBACK_308)
| Set or change the parameters for a tone to detect on some port.
#define | VPB_MBUSY_308 (1<<VPB_BUSY_308)
| Set or change the parameters for a tone to detect on some port.
#define | VPB_MFAX (1<<VPB_FAX)
| Set or change the parameters for a tone to detect on some port.
#define | VPB_MBUSY_AUST (1<<VPB_BUSY_AUST)
| Set or change the parameters for a tone to detect on some port.
#define | VPB_MRINGBACK_AUS (1<<VPB_RINGBACK_AUS)
| Set or change the parameters for a tone to detect on some port.
#define | VPB_MSPARE9 (1<<VPB_SPARE9)
| Set or change the parameters for a tone to detect on some port.
#define | VPB_MALL_TONES ((unsigned long)-1)
| Set or change the parameters for a tone to detect on some port.
void WINAPI | vpb_settonedet (VPBPortHandle handle, const VPB_DETECT &d)
| Set or change the parameters for a tone to detect on some port.
void WINAPI | vpb_settonedet (VPBPortHandle handle, const VPB_DETECT *d)
| Set or change the parameters for a tone to detect on some port.
void WINAPI | vpb_gettonedet (VPBPortHandle handle, int id, VPB_DETECT *d)
| Set or change the parameters for a tone to detect on some port.
void WINAPI | vpb_deltonedet (VPBPortHandle handle, const VPB_DETECT &d)
| Revove a tone detector from some port.
void WINAPI | vpb_deltonedet (VPBPortHandle handle, const VPB_DETECT *d)
| Set or change the parameters for a tone to detect on some port.
int WINAPI | vpb_debug_tonedet (VPBPortHandle handle, int id, char file_name[], int sec)
| Set or change the parameters for a tone to detect on some port.
int WINAPI | vpb_enable_tone_event (VPBPortHandle handle, unsigned long mask)
| Enable the `TONE` events specified by mask for handle.
int WINAPI | vpb_disable_tone_event (VPBPortHandle handle, unsigned long mask)
| Disable the `TONE` events specified by mask for handle.
unsigned long WINAPI | vpb_get_tone_event_mask (VPBPortHandle handle)
| Return the current `TONE` event mask for handle.
int WINAPI | vpb_set_tone_event_mask (VPBPortHandle handle, unsigned long mask)
| Set the `TONE` event mask. The previous mask value will be overwritten.

## mode flags for vpb_open()

const VPBOpenMode | VPB_OPEN_NONE = 0x00
| Just open the port.
const VPBOpenMode | VPB_OPEN_RESET = 0x10
| Reset the port state.
const VPBOpenMode | VPB_OPEN_DEFAULTS = VPB_OPEN_RESET
| The default flags for `vpb_open()`.
VPBPortHandle WINAPI | vpb_open (unsigned int board, unsigned int port, VPBOpenMode flags=VPB_OPEN_DEFAULTS)
| Open a port on some board for use.
void WINAPI | vpb_reset (VPBPortHandle handle=VPB_PORTHANDLE_NULL)
| Reset a port back to its idle state (on-hook, not ringing etc.).
int WINAPI | vpb_close (VPBPortHandle handle=VPB_PORTHANDLE_NULL)
| Close a previously opened port using the handle returned by `vpb_open()`.

## Run time error manager modes

const int | VPB_DEVELOPMENT = 0
| API function error causes program abort. DON'T USE THIS.
const int | VPB_ERROR_CODE = 1
| API function error returns error code. DON'T USE THIS.
const int | VPB_EXCEPTION = 2
| API function error throws a exception.
| VT_DEPRECATED (extern const int VPB_DEVELOPMENT)
| API function error causes program abort. DON'T USE THIS.
| VT_DEPRECATED (int WINAPI vpb_seterrormode(int mode))
| API function error causes program abort. DON'T USE THIS.

## Detailed Description

Voicetronix voice processing board public API.

This file contains the public API functions for interfacing to `libvpb`.