Common internal helper functions.
More...
#include "comm.h"
#include "wobbly.h"
|
int | RunTimeError (const Wobbly &w, const char *api_function) |
|
void | CheckHandle (VPBPortHandle handle, const char *where) |
| Check for a valid device handle. More...
|
|
void | ValidHandleCheck (int handle) |
|
void | validate_digits (const char *digits) |
| Validate a NULL terminated string of DTMF digits. More...
|
|
int | putevt (VPB_EVENT *event, unsigned long mask=0) |
| Internal function to place an event on the API event queue. More...
|
|
void | apifunc_trace (char s[]) |
|
int | get_driver_type (int board) |
| Return the symbolic type of the driver for board.
|
|
VPB_MODEL | get_board_type (int board) |
| Return the symbolic VPB_MODEL type of a board.
|
|
void | get_board_model (int board, char *s) |
| Return a descriptive model name for board in s.
|
|
VPB_PORT | get_port_type (int board, int port) |
| Return the type of a port on some board. VPB_FXO or VPB_FXS .
|
|
size_t | get_total_port_count () |
| Return the total number of ports on all registered boards.
|
|
void | set_country (int board, int port, const Country *country) |
| Set the country data for port on board.
|
|
const Country * | get_country (int board, int port) |
| Return the country data for port on board.
|
|
void | ring_station_async (int board, int port, int cadence) |
| Internal function to control ringing on port of board.
|
|
void | set_codec_reg (int handle, unsigned short addr, unsigned short data, Comm *comm) |
| Write directly to a V4PCI codec register. More...
|
|
Common internal helper functions.
This file declares some commonly used functions that implement api features but which are not exposed to the application programmer.
void SetVDAAImpedance(int port, int impedance)
Override the default impedance for VDAA ports.
Definition: vtcore.cpp:974
void PadTxFrame(int port)
Pad a partial transmit frame for forwarding to the hardware.
Definition: openpri.cpp:2620
int WINAPI vpb_get_event_count()
Returns the number of events on the global event queue.
Definition: vpbapi.cpp:1927
float WINAPI vpb_record_get_hw_gain(VPBPortHandle handle)
Return the hardware record gain for a port.
Definition: playrec.cpp:1565
const char * what() const
Return the message associated with the exception.
Definition: vpbapi.h:1258
int16_t twist
Allowable difference in tone powers.
Definition: vpbapi.h:1618
virtual void SetHookState(int port, HookState hookstate)=0
Set the hook state of port.
void SetHookState(int port, HookState hookstate)
Set the hook state of port.
Definition: comm.cpp:317
VPBHANDLE(int boardnum, int port)
Convenience constructor.
Definition: vpbreg.h:104
size_t HowFull()
Return the number of words used in the DSP FIFO.
Definition: dspfifo.cpp:187
char c
The identifying character to map to this tone.
Definition: vpbdial.cpp:62
void validate_digits(const char *digits)
Validate a NULL terminated string of DTMF digits.
Definition: digits.cpp:115
virtual void PadTxFrame(int port)=0
Pad a partial transmit frame for forwarding to the hardware.
uint16_t ddmodel
VPB Device Driver model.
Definition: vpbreg.h:149
uint16_t chstat[MAXCH]
status of each channel
Definition: vpbreg.h:128
float linear_gain
linear gain
Definition: playrec.cpp:79
void WINAPI vpb_sethook_sync(VPBPortHandle handle, HookState hookstate)
Set the hook state of a port. Waits for it to change before returning.
Definition: vpbapi.cpp:2073
int WINAPI vpb_put_event(VPB_EVENT *event)
Places an event on the global and port specific event queues.
Definition: vpbapi.cpp:1900
Definition: vpbdial.cpp:80
uint16_t flash_time
Generated hook flash time in ms.
Definition: vpbapi.h:1739
Config()
Default constructor.
Definition: tonegen.h:242
const Cadence & GetNextCadence()
Return the next cadence timing in the sequence.
Definition: tonegen.h:468
VPBPortHandle WINAPI vpb_open(unsigned int board, unsigned int port, VPBOpenMode flags)
Open a port on some board for use.
Definition: vpbapi.cpp:1594
void WINAPI vpb_play_set_hw_gain(VPBPortHandle handle, float gain)
Set the hardware play gain component for a port.
Definition: playrec.cpp:997
virtual void ImplStop()
Called by Stop() for implementation specific operations.
Definition: tonegen.h:512
@ VPB_TONE_CONGESTION
Network congestion tone.
Definition: vpbapi.h:1430
unsigned int offms
Off time in ms.
Definition: tonegen.h:138
unsigned int GetCountryCode() const
Return the global country code from vpb.conf.
Definition: vpbreg.h:335
void Reset(unsigned int port)
Reset port to its default cold-start state.
Definition: vtcore.cpp:821
int WINAPI vpb_record_file_sync(VPBPortHandle handle, const string &file_name, AudioCompress mode)
Utility function to record a wav file from a port.
Definition: playrec.cpp:1513
void SetCountry(int port, const Country *country)
Configure the hardware for country on port of this board.
Definition: vtcore.cpp:857
Data storage for a ToneGen frequency component.
Definition: tonegen.h:114
uint16_t tmin
minimum tone on/off time (non timer) in ms
Definition: vpbapi.h:1600
#define VPB_RECORD_TIMEOUT
Set recording parameters for a port.
Definition: vpbapi.h:1225
The DSP program "registry" info for each board.
Definition: vpbreg.h:116
VPBPortHandle WINAPI vpb_open(unsigned int board, unsigned int port, VPBOpenMode flags=VPB_OPEN_DEFAULTS)
Open a port on some board for use.
Definition: vpbapi.cpp:1594
char date[16]
Manufacture Date.
Definition: vpbapi.h:209
std::vector< Play > List
Container type for a list of playback states.
Definition: playrec.cpp:113
State GetState() const
Return the current state of this ToneGen.
Definition: tonegen.h:651
void WINAPI vpb_wave_close_read(WFILE *wav)
Close a RIFF wave file after reading.
Definition: wave.cpp:406
uint16_t base
base address of VPB
Definition: vpbreg.h:143
HostDSP(bool, VPBREG ®)
Bare bones constructor for hardware DSP implementations.
Definition: vpbreg.h:204
Cadence state transition data for VPB_DETECT.
Definition: vpbapi.h:1592
uint16_t lv_onhook
On hook voltage threshhold in V.
Definition: vpbapi.h:1743
size_t get_total_port_count()
Return the total number of ports on all registered boards.
Definition: apifunc.cpp:140
uint16_t glitch
short transitions of glitch ms ignored
Definition: vpbapi.h:1623
int WINAPI vpb_get_event_count_ch(VPBPortHandle handle)
Returns the number of events on the port specific event queue for handle.
Definition: vpbapi.cpp:1922
Definition: vpbapi.h:2269
void(WINAPI * vpb_event_callback)(VPB_EVENT *e, void *context)
The callback function type for vpb_set_event_callback().
Definition: vpbapi.h:644
Status Write(uint16_t *buf, size_t len)
Write a block of words from the PC to a DSP FIFO.
Definition: dspfifo.cpp:110
Data for play_file_async_thread()
Definition: playrec.cpp:154
HostToneGen()
Default constructor.
Definition: tonegen.h:873
const VPBOpenMode VPB_OPEN_RESET
Reset the port state.
Definition: vpbapi.h:130
char cn[21]
Caller name.
Definition: vpbapi.h:2088
@ VPB_AUDIO_TERMINATE_SYNC
Sync terminate requested.
Definition: vpbapi.h:746
VPB_PORT
Analogue port types.
Definition: vpbapi.h:90
Definition: digits.cpp:51
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.
Definition: cid.cpp:615
const char * term_digits
A list of specific digits that may terminate collection.
Definition: vpbapi.h:1972
int board
listening board number
Definition: vpbreg.h:177
int putevt(VPB_EVENT *event, unsigned long mask=0)
Internal function to place an event on the API event queue.
Definition: vpbapi.cpp:1949
std::vector< List > ListList
Container type for a list of Freq::List structures.
Definition: tonegen.h:120
int WINAPI vpb_record_terminate(int handle)
Stop audio recording.
Definition: playrec.cpp:1631
void set_country(int board, int port, const Country *country)
Set the country data for port on board.
Definition: vpbapi.cpp:799
unsigned long WINAPI vpb_get_event_mask(VPBPortHandle handle)
Return the current event mask for handle.
Definition: vpbapi.cpp:1848
Container type for caller id data.
Definition: vpbapi.h:2082
int VPBOpenMode
Symbolic type for vpb_open() mode flags.
Definition: vpbapi.h:124
@ VPB_CID_CT_MW
Message waiting.
Definition: vpbapi.h:2076
#define VPB_MD
The maximum number of tone detectors per device.
Definition: vpbapi.h:1573
Freq()
Default constructor.
Definition: tonegen.h:126
void WINAPI vpb_cid_compose_wav(const char *dlp, int dlp_len, short *wav_buf, int *wav_len, const Country *country)
Encode a data link packet into CP-FSK wav data for type 1 CID.
Definition: cidg.cpp:297
int WINAPI vpb_disable_event(VPBPortHandle handle, unsigned long mask)
Disable the events specified by mask for handle.
Definition: vpbapi.cpp:1862
@ VPB_CID_RFA_CLDN
Reason for absence of caller number.
Definition: vpbapi.h:2172
uint16_t defSbal1
default codec balance register 1 for station
Definition: vpbreg.h:159
Record()
Default constructor.
Definition: playrec.cpp:139
const Country *WINAPI vpb_get_port_country(VPBPortHandle handle)
Get the current country data for port handle.
Definition: vpbapi.cpp:861
std::vector< const Country * > List
Container type for a list of pointers to Country structures.
Definition: vpbapi.h:1732
#define VPB_RINGBACK_AUS
ringback detected (Australia)
Definition: vpbapi.h:1640
Definition: hostvox.cpp:41
ToneStateTransition
Tone detector state transition types.
Definition: vpbapi.h:1581
double fsk_space
Coefficient for cid generation.
Definition: vpbapi.h:1751
bool MixTone(int16_t *buf, size_t samples)
Add the next samples of this tone to the signal in buf.
unsigned long evtmask
The current event mask.
Definition: vpbapi.cpp:113
void WaitForMessageVPB(unsigned short board, uint16_t *mess, unsigned short mtype, unsigned short wait)
Wait for a DSP message of a certain type.
Definition: comm.cpp:541
int cardtypnum
The number of the card of this type.
Definition: vpbreg.h:171
virtual void TapListen(unsigned int port, unsigned int srcboard, unsigned int srcport)
Create a full duplex tap to port of the audio from srcport on srcboard.
Definition: vpbreg.h:291
static int Init
Device initialisation flag.
Definition: vpbapi.cpp:165
int WINAPI vpb_get_card_info(int board, VPB_CARD_INFO *detail)
Return detail of the card model and revision for board.
Definition: vpbapi.cpp:3141
HostFifo APIQ
Per channel API event Q object.
Definition: vpbapi.cpp:125
short channel
Channel number.
Definition: vpbapi.h:1833
size_t vpb_wave_get_size(WFILE *wav)
Return the size of wave file data in bytes.
Definition: wave.cpp:509
const char *WINAPI vpb_get_driver_version()
Return the driver version as a string.
Definition: vpbapi.cpp:749
@ VPB_EVT_NONE
Definition: vpbapi.h:446
Definition: v4logagc.cpp:37
Audio playback state data
Definition: playrec.cpp:111
Base class for play/record state.
Definition: playrec.cpp:73
@ VPB_FXO
Trunk port.
Definition: vpbapi.h:92
void * v4log_agcstate
AGC state (V4LOG card only)
Definition: playrec.cpp:132
void WINAPI vpb_play_buf_finish_sync(VPBPortHandle handle)
Signal completion of audio playback and release a port for other users.
Definition: playrec.cpp:948
uint16_t type
VPB_TIMER, VPB_RISING, or VPB_FALLING
Definition: vpbapi.h:1598
DSP interface implementation for OpenLine cards.
Definition: comm.h:55
int WINAPI vpb_hostecho_off(int h)
Disable the host echo canceller for handle.
Definition: vpbapi.cpp:3209
@ VPB_BRIDGE_ON
start bridging
Definition: vpbapi.h:385
VPB_MODEL get_board_type(int board)
Return the symbolic VPB_MODEL type of a board.
Definition: vpbapi.cpp:2492
State
ToneGen state information
Definition: tonegen.h:92
float sw_gain
software gain parameter
Definition: playrec.cpp:78
uint16_t lv_offhook
Off hook voltage threshhold in V.
Definition: vpbapi.h:1744
Definition: utilfuncs.h:128
int WINAPI vpb_get_event_async(VPB_EVENT *event)
Fetch the next event from the global event queue.
Definition: vpbapi.cpp:2006
void BeginSequence(Config *tone, bool sync=false)
Prepare the tone generator for playing a sequence of related tones.
Definition: tonegen.h:696
@ VPB_AUDIO_IDLE
No port audio playing.
Definition: vpbapi.h:742
std::vector< Record > List
Container type for a list of recording states.
Definition: playrec.cpp:124
vpb_event_callback event_callback
Optional event callback.
Definition: vpbapi.cpp:119
int WINAPI vpb_echo_canc_get_sup_thresh(int handle, short *thresh)
Get the current echo suppressor threshold.
Definition: vpbapi.cpp:2425
HookState hook_state(int ch)
Get the hook state of a port.
Definition: vtcore.cpp:1296
void WINAPI vpb_wave_open_write(WFILE **wav, const std::string &filename, int mode)
Open a RIFF wave file for writing.
Definition: wave.cpp:151
int WINAPI vpb_loopback_on(int handle)
Turns on software loop-back of tx->rx in the kernel.
Definition: vpbapi.cpp:3158
@ VPB_MODEL_UNKNOWN
Placeholder for when card type is not yet known.
Definition: vpbapi.h:85
virtual void SetCountry(int port, const Country *country)=0
Configure the hardware for country on port of this board.
char pres[256]
Storage for presentation layer data.
Definition: vpbapi.h:2094
@ VPB_CID_CALL_TYPE
Call type indicator.
Definition: vpbapi.h:2175
float level1
first tone level in dB, -inf to 0dB
Definition: vpbapi.h:1468
unsigned short freq1
frequency of first tone in Hz
Definition: vpbapi.h:1465
char ra_cldn[2]
Reason for absence of cldn, O or P.
Definition: vpbapi.h:2087
#define DD_VTCORE
VTCore card driver.
Definition: vpbreg.h:89
virtual void SetPSImpedance(int port, int impedance)
Override the default impedance for ProSLIC ports.
Definition: vpbreg.h:232
void WINAPI vpb_gettonedet(VPBPortHandle handle, int id, VPB_DETECT *d)
Set or change the parameters for a tone to detect on some port.
Definition: vpbtoned.cpp:322
uint16_t szmess
size in words of message FIFOs
Definition: vpbreg.h:131
VPB_TONE * next
Pointer to the next tone in a sequence.
Definition: vpbapi.h:1483
@ VPB_RAW
Raw data, no encoding.
Definition: vpbapi.h:734
int get_driver_type(int board)
Return the symbolic type of the driver for board.
Definition: vpbapi.cpp:2486
DevState devstate
Flag to indicate if this device has been opened or not.
Definition: vpbapi.cpp:110
pthread_mutex_t mutex
global state protection
Definition: playrec.cpp:80
void WaitForTxEmpty(int port)
Block until the transmit buffers for port are empty.
Definition: vtcore.cpp:949
Host based tone generator implementation.
Definition: tonegen.h:816
char rev[8]
Revision.
Definition: vpbapi.h:210
~VPB_DEV()
Default destructor.
Definition: vpbapi.cpp:147
VPB_CID()
Default constructor.
Definition: vpbapi.h:2097
Definition: vpbapi.h:1383
@ VPB_CID_CALLED_DN
Called directory number.
Definition: vpbapi.h:2171
void WINAPI vpb_set_global_apiq_size(int size)
Set the maximum number of events the global APIQ may hold.
Definition: vpbapi.cpp:785
uint16_t nstates
number of cadence states
Definition: vpbapi.h:1609
#define VPB_MVOXOFF
The callback function type for vpb_set_event_callback().
Definition: vpbapi.h:515
virtual void UNListen(unsigned int port)
Remove a half duplex bridge or full duplex tap from port.
Definition: vpbreg.h:302
void WINAPI vpb_set_country(const Country *country)
Set the global default country specific information.
Definition: vpbapi.cpp:836
Definition: objtrack.cpp:41
void ClearTones()
Clear all frequency and cadence data from this Config.
Definition: tonegen.h:345
std::vector< ToneGen * > List
Container type for a list of pointers to ToneGen structures.
Definition: tonegen.h:86
Base type for the programmable tone generator interface.
Definition: tonegen.h:82
Definition: utilfuncs.h:115
VPB_MODEL WINAPI vpb_get_card_type(VPBPortHandle handle)
Return the board model type for handle.
Definition: vpbapi.cpp:2497
void WINAPI vpb_ring_station_async(VPBPortHandle handle, int cadence)
Start or stop a station port ringing.
Definition: vpbapi.cpp:2116
void UNListen(unsigned int port)
Remove a half duplex bridge or full duplex tap from port.
Definition: comm.cpp:371
int16_t snr
min signal to noise ratio to accept tone
Definition: vpbapi.h:1622
void WINAPI vpb_log_terminate(VPBPortHandle h)
Stop full duplex logging on handle h.
Definition: callmonitor.cpp:160
static List list
Container for a list of playback states.
Definition: playrec.cpp:116
unsigned long time_out
Maximum time in ms to record for.
Definition: playrec.cpp:129
@ VPB_AUDIO_TERMINATE
Async terminate requested.
Definition: vpbapi.h:745
~VTCore()
Destructor.
Definition: vtcore.cpp:816
@ VPB_CID_CT_VOICE
Voice Call.
Definition: vpbapi.h:2074
char cldn[19]
Calling line directory number.
Definition: vpbapi.h:2086
#define DD_PRI
OpenPri driver.
Definition: vpbreg.h:88
std::vector< Cadence > List
Container type for a list of Cadence structures.
Definition: tonegen.h:135
#define VPB_FINISH
return code for vpb_play_buf_sync() and vpb_record_buf_sync().
Definition: vpbapi.h:700
int WINAPI vpb_listen(VPBPortHandle h1, VPBPortHandle h2, BridgeMode mode)
Create a half duplex bridge routing audio from src to dest.
Definition: vpbapi.cpp:2982
void WINAPI vpb_wave_open_read(WFILE **wav, const std::string &filename)
Open a RIFF wave file for reading.
Definition: wave.cpp:262
void get_board_model(int board, char *s)
Return a descriptive model name for board in s.
Definition: vpbapi.cpp:2568
Definition: vpbapi.h:1796
int WINAPI vpb_tone_terminate(int handle)
Terminate a currently playing tone (user defined or dtmf).
Definition: vpbdial.cpp:554
int WINAPI vpb_enable_event(VPBPortHandle handle, unsigned long mask)
Enable the events specified by mask for handle.
Definition: vpbapi.cpp:1854
@ VPB_TONE_CALLWAITING
Call waiting signal.
Definition: vpbapi.h:1432
void ImplStop()
Called by Stop() for implementation specific operations.
Definition: comm.cpp:122
int WINAPI vpb_get_event_ch_sync(VPBPortHandle h, VPB_EVENT *e, unsigned int time_out)
Wait for an event on a port specific event queue.
Definition: vpbapi.cpp:2036
#define VPB_RINGBACK
ringback detected (US)
Definition: vpbapi.h:1633
int WINAPI vpb_wave_read(WFILE *wav, char *buf, unsigned long n)
Read a block of audio samples from a RIFF wave file.
Definition: wave.cpp:422
void * extra
Support for user defined event data.
Definition: vpbapi.h:502
V4PCIDspFifo(Hip *hip, unsigned short board, unsigned short fifo_addr)
Open a link to a DSP FIFO. Assumes the DSP has been booted.
Definition: dspfifo.cpp:46
float defRecordGainDown
record gain down control for better DTMF
Definition: vpbreg.h:167
Voicetronix programmable tone generator API.
VPB_TONE tone
The tone definition data.
Definition: vpbdial.cpp:65
AudioState state
current state
Definition: playrec.cpp:76
void WINAPI vpb_sethook_async(VPBPortHandle handle, HookState hookstate)
Signal a port to set its hook state. Returns immediately.
Definition: vpbapi.cpp:2062
CidDataType
Field type identifiers for CID data.
Definition: vpbapi.h:2166
Comm * vpb_c
Global Comm object.
Definition: vpbapi.cpp:160
int WINAPI vpb_set_tone_event_mask(VPBPortHandle handle, unsigned long mask)
Set the TONE event mask. The previous mask value will be overwritten.
Definition: vpbapi.cpp:1870
@ ONESHOT
One-shot tone generation in progress.
Definition: tonegen.h:96
VPB_PORT WINAPI vpb_get_port_type(VPBPortHandle handle)
Return the VPB_PORT type for handle.
Definition: vpbapi.cpp:2556
V4PCIToneGen(Comm *comm, unsigned int cardnum)
Constructor.
Definition: comm.cpp:140
Definition: utilfuncs.h:121
ToneGen::List toneg
Pointers to ToneGen instances for each port.
Definition: vpbreg.h:173
void WINAPI vpb_set_flashtime(VPBPortHandle handle, uint16_t min, uint16_t max)
Set the window for detecting flash events on OpenPCI cards.
Definition: vpbapi.cpp:2084
char term[64]
Termination reason TEXT ascii.
Definition: vpbapi.h:1840
int code
Country code.
Definition: vpbapi.h:1735
VPB_DEV()
Default constructor.
Definition: vpbapi.cpp:135
DevState
Device state flags.
Definition: vpbapi.cpp:98
Status Read(uint16_t *buf, size_t len)
Read a block of words from a DSP FIFO to the PC.
Definition: dspfifo.cpp:149
Definition: openpri.cpp:69
void playrec_new_digit_record(int handle, char digit)
Called by the MMQ when the DSP detects a digit event.
Definition: playrec.cpp:895
struct VPBREG::@0 listen_info[MAXCH]
Used to keep a track of the listens.
void playrec_open(unsigned int numch)
Initialise the playrec module.
Definition: playrec.cpp:257
int WINAPI vpb_record_buf_async(VPBPortHandle handle, char *buf, size_t len)
Record a buffer of audio samples from a port.
Definition: playrec.cpp:1496
#define VT_DEPRECATED(x)
Macro wrapper for deprecated symbols.
Definition: vt_deprecated.h:57
Container type for data returned by vpb_get_card_info().
Definition: vpbapi.h:207
ScopedMutex(pthread_mutex_t *mutex)
Lock mutex for the lifetime of this object.
Definition: scopedmutex.h:44
#define VPB_MLOOP_FLASH
The callback function type for vpb_set_event_callback().
Definition: vpbapi.h:526
unsigned int GetCountryCode() const
Return the global country code from vpb.conf.
Definition: comm.h:142
VPB_PORT WINAPI vpb_get_port_type(VPBPortHandle handle)
Return the VPB_PORT type for handle.
Definition: vpbapi.cpp:2556
int WINAPI vpb_get_ports_per_card(int board)
Return the number of ports on board.
Definition: vpbapi.cpp:2639
const char * what() const
Return the message associated with the exception.
Definition: tonegen.h:497
int WINAPI vpb_get_event_sync(VPB_EVENT *e, unsigned int time_out)
Wait for an event on the global event queue.
Definition: vpbapi.cpp:2018
@ IDLE
Tone generator is idle.
Definition: tonegen.h:93
@ VPB_CID_CT_UNKNOWN
Unknown call type.
Definition: vpbapi.h:2073
int WINAPI vpb_wave_set_vlog(WFILE *wav, VPB_VLOG *buf)
Set VPB_VLOG information for inclusion in a wave file.
Definition: wave.cpp:539
void WINAPI vpb_flush_events(VPBPortHandle handle)
Clear all unread events from the queue for handle.
Definition: vpbapi.cpp:1935
void Stop()
Stop tone generation.
Definition: tonegen.h:632
int WINAPI vpb_play_buf_async(VPBPortHandle handle, const char *buf, size_t len)
Play a buffer of audio samples to a port.
Definition: playrec.cpp:931
int WINAPI vpb_get_num_cards()
Return the number of cards in the system.
Definition: vpbapi.cpp:2628
virtual ~HostDSP()
Destructor.
Definition: vpbreg.h:213
@ VPB_FASTOFFHOOK
Port off-hook, no calibration.
Definition: vpbapi.h:303
#define VPB_MDIGIT
The callback function type for vpb_set_event_callback().
Definition: vpbapi.h:510
Config & GetConfig() const
Return the ToneGen::Config data.
Definition: tonegen.h:806
AudioCompress
Audio compression modes.
Definition: vpbapi.h:727
const char * term_digits
A string of DTMF digits that can terminate recording.
Definition: vpbapi.h:717
#define VPB_CID_MAX_DLP
Maximum size of CID dlp data.
Definition: vpbapi.h:2162
@ VPB_OFF
The device is not open.
Definition: vpbapi.cpp:99
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.
Definition: vpbapi.cpp:1824
int WINAPI vpb_set_event_mask(VPBPortHandle handle, unsigned long mask)
Set the event mask for handle.
Definition: vpbapi.cpp:1840
const char * term_digits
A string of DTMF digits that can terminate playback.
Definition: vpbapi.h:708
Definition: callmonitor.cpp:40
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.
Definition: playrec.cpp:1619
Lookup table element for mapping vpb handles to a port on boardnum.
Definition: vpbreg.h:96
~ScopedMutex()
Unlock the mutex again.
Definition: scopedmutex.h:51
int WINAPI vpb_enable_event(VPBPortHandle handle, unsigned long mask)
Enable the events specified by mask for handle.
Definition: vpbapi.cpp:1854
float level2
second tone level in dB, -inf to 0dB
Definition: vpbapi.h:1469
const VPBOpenMode VPB_OPEN_DEFAULTS
The default flags for vpb_open().
Definition: vpbapi.h:133
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.
Definition: playrec.cpp:1032
float rgaindown
Record Gain Down control for DTMF.
Definition: playrec.cpp:131
Definition: vpbapi.cpp:88
VPB_PORT get_port_type(int board, int port)
Return the type of a port on some board. VPB_FXO or VPB_FXS.
Definition: vpbapi.cpp:2539
void WINAPI vpb_wave_close_write(WFILE *wav)
Close a RIFF wave file after writing.
Definition: wave.cpp:390
uint16_t drop_min
Min valid loop drop time in ms.
Definition: vpbapi.h:1747
int chan_state(int ch)
Get the current state of a port.
Definition: vtcore.cpp:1282
Tone definition structure.
Definition: vpbapi.h:1463
#define VPB_FAX
fax CNG tone/preamble
Definition: vpbapi.h:1638
char endtime[16]
Record End Time yyyymmddHHMMSS.
Definition: vpbapi.h:1836
VPB_MODEL WINAPI vpb_get_card_type(VPBPortHandle handle)
Return the board model type for handle.
Definition: vpbapi.cpp:2497
void SetCompletionCallback(CompletionCallback callback)
Request asynchronous notification of normal tone completion.
Definition: tonegen.h:389
static List list
Container for a list of recording states.
Definition: playrec.cpp:127
Simple time tracking class.
Definition: timer.h:31
int board
The board number for this handle.
Definition: vpbreg.h:100
int NewHandle(int board, int port)
Return a new handle for a port on some board.
Definition: vpbreg.h:346
unsigned long WINAPI vpb_get_tone_event_mask(VPBPortHandle handle)
Return the current TONE event mask for handle.
Definition: vpbapi.cpp:1878
Country::List country
Pointers to country specific data for each port.
Definition: vpbreg.h:172
@ VPB_AUDIO_PLAYING
Port audio play in progress.
Definition: vpbapi.h:743
T & GetUserData(size_t slot) const
Retreive arbitrary, typed data from a user-data slot.
Definition: tonegen.h:427
char ra_cn[2]
Reason for absence of cn, O or P.
Definition: vpbapi.h:2089
void * context
User defined context info for event_callback.
Definition: vpbapi.cpp:122
@ VPB_TONE_DIAL
Normal dial tone.
Definition: vpbapi.h:1427
int handle
The handle of the port that generated the event.
Definition: vpbapi.h:496
Comm * vpb_c
Pointer to the global comm object.
Definition: vpbapi.cpp:160
int WINAPI vpb_get_event_ch_async(VPBPortHandle h, VPB_EVENT *e)
Fetch the next event from a port specific event queue.
Definition: vpbapi.cpp:2052
@ VPB_CID_CT_RBWF
Ring back When free.
Definition: vpbapi.h:2075
char inout[4]
Call Direction.
Definition: vpbapi.h:1834
char delay[REC_DLY]
delay line for rec with dtmf termination
Definition: playrec.cpp:133
int WINAPI vpb_echo_canc_get_sup_thresh(int handle, short *thresh)
Get the current echo suppressor threshold.
Definition: vpbapi.cpp:2425
int VPBPortHandle
Symbolic type for a handle to an open port on some card.
Definition: vpbapi.h:57
Definition: vpbvox.cpp:73
int nmss
Network message system status, (0-255 calls waiting)
Definition: vpbapi.h:2092
static unsigned short numboards
Total number of boards.
Definition: vpbapi.cpp:166
@ VPB_CID_RFA_CN
Reason for absence of caller name.
Definition: vpbapi.h:2174
void WINAPI vpb_set_mprintf(void(*func)(const char *format,...))
Specify a function to handle mprintf() logging output.
Definition: vpbapi.cpp:3597
int16_t minlevel2
min amp of 2nd tone ref 0dbm0
Definition: vpbapi.h:1617
void WINAPI vpb_record_set_gain(VPBPortHandle handle, float gain)
Set the software record gain component for a port.
Definition: playrec.cpp:1541
Definition: genericlinux.cpp:426
int WINAPI vpb_wave_write(WFILE *wav, const char *buf, long n)
Write a block of audio samples to a RIFF wave file.
Definition: wave.cpp:412
void CheckHandle(VPBPortHandle handle, const char *where)
Check for a valid device handle.
Definition: vpbapi.cpp:735
~Comm()
Closes down the comm link to the VPBs.
Definition: comm.cpp:430
void SetCadence(unsigned int onms, unsigned int offms=0, unsigned int tnum=0)
Set the on and off time in ms for a cadenced tone.
Definition: tonegen.h:302
void SetCountry(int port, const Country *country)
Configure the hardware for country on port of this board.
Definition: openpri.cpp:2583
@ VPB_AUDIO_RECORDING
Port audio record in progress.
Definition: vpbapi.h:744
VPB_PORT chan_type(int ch)
Get the type of a port.
Definition: vtcore.cpp:1289
uint16_t freq2
freq of first tone (Hz)
Definition: vpbapi.h:1614
void WINAPI vpb_sleep(long time)
Put the current thread to sleep for some number of milliseconds.
Definition: vpbapi.cpp:2126
@ VPB_CID_CALLER_NAME
Caller name.
Definition: vpbapi.h:2173
@ VPB_CID_EMPTY
Flag to clear CID data fields.
Definition: vpbapi.h:2168
void WINAPI vpb_record_set(VPBPortHandle handle, const VPB_RECORD &vpb_record)
Set recording parameters for a port.
Definition: playrec.cpp:1469
const char *WINAPI vpb_get_driver_version()
Return the driver version as a string.
Definition: vpbapi.cpp:749
#define VPB_MRING
The callback function type for vpb_set_event_callback().
Definition: vpbapi.h:509
void WINAPI vpb_play_set(VPBPortHandle handle, const VPB_PLAY &vpb_play)
Set playback parameters for a port.
Definition: playrec.cpp:908
int WINAPI vpb_loopback_off(int h)
Turns off software loop-back of tx->rx in the kernel.
Definition: vpbapi.cpp:3175
@ VPB_V4LOG
V4LOG 4 port PCI logging card.
Definition: vpbapi.h:77
Container for programmable tone detector parameters.
Definition: vpbapi.h:1607
void * cardinfo
Pointer to Conf Info section for this card.
Definition: vpbreg.h:183
int chan
listening port number
Definition: vpbreg.h:176
int WINAPI vpb_disable_tone_event(VPBPortHandle handle, unsigned long mask)
Disable the TONE events specified by mask for handle.
Definition: vpbapi.cpp:1892
Fifo * txdf[MAXCH]
ptrs to TX DSP FIFO info in PC
Definition: vpbreg.h:147
VPB_MODEL
VPB card model types.
Definition: vpbapi.h:73
Definition: vpbapi.h:1373
@ VPB_FXS
Station port.
Definition: vpbapi.h:93
VPB_TONE * tone_gen
Pointer to an array of VPB_TONE_ID_MAX tones.
Definition: vpbapi.h:1753
struct TD ** toned
Pointer to Tone detector state variables.
Definition: vpbreg.h:180
uint16_t a_upmess
addr of "up" message FIFO in DSP
Definition: vpbreg.h:130
Abstract base type for Fifo implementations.
Definition: fifo.h:43
#define VPB_MSTATION_ONHOOK
The callback function type for vpb_set_event_callback().
Definition: vpbapi.h:519
Definition: utilfuncs.h:65
void(* CompletionCallback)(ToneGen &)
Call back type for tone completion notification.
Definition: tonegen.h:89
#define VPB_BUSY
busy tone detected (US)
Definition: vpbapi.h:1634
void WINAPI vpb_set_global_apiq_size(int size)
Set the maximum number of events the global APIQ may hold.
Definition: vpbapi.cpp:785
#define VPB_MSTATION_OFFHOOK
The callback function type for vpb_set_event_callback().
Definition: vpbapi.h:518
@ VPB_TONE_UNOBTAINABLE
Invalid number signal.
Definition: vpbapi.h:1431
virtual ~ToneGen()
Virtual destructor.
Definition: tonegen.h:565
VPB api runtime exception type.
Definition: vpbapi.h:1239
Comm()
Constructor. The InitBoards() method actually opens the comm links.
Definition: comm.h:124
uint16_t a_rxdf[MAXCH]
addresses of RX FIFOs in DSP
Definition: vpbreg.h:132
int WINAPI vpb_play_terminate(int handle)
Stop audio playback.
Definition: playrec.cpp:1078
@ VPB_DIGIT_MAX
The specified maximum number of digits were collected.
Definition: vpbapi.h:1994
~VpbException()
Destructor.
Definition: vpbapi.h:1251
float defSPlayGain
default play (Rx) gain for station
Definition: vpbreg.h:154
void start()
Initialise the timer's starting time.
Definition: timer.cpp:30
@ VPB_OSW
OpenSwitch card using vtcore driver.
Definition: vpbapi.h:82
uint16_t tmax
maximum tone on/off time (non timer) in ms
Definition: vpbapi.h:1601
AudioState WINAPI vpb_record_state(int handle)
Return the current record state of a port.
Definition: playrec.cpp:1130
Fifo * rxdf[MAXCH]
ptrs to RX DSP FIFO info in PC
Definition: vpbreg.h:146
int WINAPI vpb_playtone_state(int handle)
Returns state of play tone (1= playing, 0 = not playing)
Definition: vpbdial.cpp:451
Definition: openpri.cpp:1024
@ VPB_LINEAR
128 kbit/s 16 bit linear
Definition: vpbapi.h:729
const char *WINAPI vpb_model_desc(VPB_MODEL model)
Return a descriptive string for a VPB_MODEL type.
Definition: vpbapi.cpp:3602
int WINAPI vpb_bridge(VPBPortHandle h1, VPBPortHandle h2, BridgeMode mode)
Create a full duplex bridge between ports h1 and h2.
Definition: vpbapi.cpp:2702
char sn[10]
Serial Number.
Definition: vpbapi.h:211
void SetHookState(int port, HookState hookstate)
Set the hook state of port.
Definition: openpri.cpp:2589
Support for cards using the vtcore driver.
Definition: vtcore.h:65
int WINAPI vpb_gettone(char ident, VPB_TONE *tone)
Get the parameters of the tone represented in dial strings by ident.
Definition: vpbdial.cpp:405
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.
Definition: vpbapi.cpp:2036
int WINAPI vpb_disable_tone_event(VPBPortHandle handle, unsigned long mask)
Disable the TONE events specified by mask for handle.
Definition: vpbapi.cpp:1892
@ SEQUENCE
Tone generator is handling a sequence of tones.
Definition: tonegen.h:94
static unsigned short sleepms
sleep period for threads
Definition: vpbapi.cpp:168
uint16_t defSbal3
default codec balance register 3 for station
Definition: vpbreg.h:161
uint16_t lsf
length of superframe in words
Definition: vpbreg.h:136
@ VPB_BRIDGE_OFF
stop bridging
Definition: vpbapi.h:384
Definition: vpbapi.h:2404
int WINAPI vpb_enable_tone_event(VPBPortHandle handle, unsigned long mask)
Enable the TONE events specified by mask for handle.
Definition: vpbapi.cpp:1884
void Reset(unsigned int port)
Reset port to its default cold-start state.
Definition: openpri.h:110
void PadTxFrame(int port)
Pad a partial transmit frame for forwarding to the hardware.
Definition: vtcore.cpp:941
Data for record_file_async_thread()
Definition: playrec.cpp:164
Data storage for a ToneGen cadence component.
Definition: tonegen.h:132
unsigned long WINAPI vpb_get_tone_event_mask(VPBPortHandle handle)
Return the current TONE event mask for handle.
Definition: vpbapi.cpp:1878
float WINAPI vpb_play_get_gain(VPBPortHandle handle)
Return the software play gain for a port.
Definition: playrec.cpp:990
int WINAPI vpb_flush_digits(int handle)
Clears the internal digit buffer for handle.
Definition: digits.cpp:282
VPB_EVT_TYPE type
The event type.
Definition: vpbapi.h:495
int WINAPI vpb_get_ports_per_card(int board)
Return the number of ports on board.
Definition: vpbapi.cpp:2639
CollectEndReason WINAPI vpb_get_digits_sync(int handle, VPB_DIGITS *newdig, char *buf)
Get a buffer of DTMF digits.
Definition: digits.cpp:198
const int VPB_EXCEPTION
API function error throws a exception.
Definition: vpbapi.h:1282
int WINAPI vpb_cid_decode(char *number, const short *in, int n)
Attempt to extract a caller's number from a buffer of samples.
Definition: cid.cpp:585
void WINAPI vpb_record_set_hw_gain(VPBPortHandle handle, float gain)
Set the hardware record gain component for a port.
Definition: playrec.cpp:1558
const char * vpb_model_desc(VPB_MODEL model)
Return a descriptive string for a VPB_MODEL type.
Definition: vpbapi.cpp:3602
void WINAPI vpb_sethook_sync(VPBPortHandle handle, HookState hookstate)
Set the hook state of a port. Waits for it to change before returning.
Definition: vpbapi.cpp:2073
void WINAPI vpb_play_buf_finish(VPBPortHandle handle)
Signal completion of audio playback and release a port for other users.
Definition: playrec.cpp:940
int WINAPI vpb_play_buf_sync(VPBPortHandle handle, const char *buf, size_t len)
Play a buffer of audio samples to a port.
Definition: playrec.cpp:922
int WINAPI vpb_playtone_async(int handle, const VPB_TONE &vpb_tone)
Start a user defined tone playing and return immediately.
Definition: vpbdial.cpp:478
Definition: vtcore_ioctl.h:23
void SetFreq(unsigned int hz, float db=0.0, unsigned int fnum=0, unsigned int tnum=0)
Set one of the component frequencies for a tone.
Definition: tonegen.h:272
HookState WINAPI vpb_get_hookstate(VPBPortHandle handle)
Return the hook state of a port.
Definition: vpbapi.cpp:2513
char cidn[128]
CID number ascii.
Definition: vpbapi.h:1838
float defSRecordGain
default record (Tx) gain for station
Definition: vpbreg.h:153
std::vector< VPBREG > List
Container type for all registered boards.
Definition: vpbreg.h:119
char serial_n[10]
Serial Number.
Definition: vpbreg.h:165
Host fifo implementation.
Definition: fifo.h:74
int WINAPI vpb_hostecho_off(int handle)
Disable the host echo canceller for handle.
Definition: vpbapi.cpp:3209
std::vector< VPBHANDLE > List
Container type for the lookup table.
Definition: vpbreg.h:98
#define VPB_DIAL
dial tone detected (US/Aust/sudio308)
Definition: vpbapi.h:1632
Simple exception safe mutex sentinel.
Definition: scopedmutex.h:35
#define VPB_CID_MAX_BUF
Maximum size of CID wav data.
Definition: vpbapi.h:2159
char model[10]
Model.
Definition: vpbapi.h:208
int WINAPI vpb_close(VPBPortHandle handle=VPB_PORTHANDLE_NULL)
Close a previously opened port using the handle returned by vpb_open().
Definition: vpbapi.cpp:1748
uint16_t a_dnmess
addr of "down" message FIFO in DSP
Definition: vpbreg.h:129
Structure to map tones to an identifying character in a dial string.
Definition: vpbdial.cpp:57
virtual void SetVDAAImpedance(int port, int impedance)
Override the default impedance for VDAA ports.
Definition: vpbreg.h:239
void WINAPI vpb_set_channel_apiq_size(int size)
Set the maximum number of events per-channel APIQ's may hold.
Definition: vpbapi.cpp:791
int WINAPI vpb_echo_canc_set_sup_thresh(int handle, short *thresh)
Set the echo suppressor threshold.
Definition: vpbapi.cpp:2463
#define VPB_MDROP
The callback function type for vpb_set_event_callback().
Definition: vpbapi.h:521
VpbException(const char *format,...) __attribute__((format(printf
Construct an exception object with a printf format message string.
Definition: vpbapi.cpp:717
virtual void Reset(unsigned int port)=0
Reset port to its default cold-start state.
float defRecordGain
default record (Tx) gain
Definition: vpbreg.h:151
float WINAPI vpb_play_get_hw_gain(VPBPortHandle handle)
Return the hardware play gain for a port.
Definition: playrec.cpp:1004
void Reset(unsigned int)
Reset port to its default cold-start state.
Definition: comm.h:87
void WINAPI vpb_set_channel_apiq_size(int size)
Set the maximum number of events per-channel APIQ's may hold.
Definition: vpbapi.cpp:791
char filename[256]
Original Filename.
Definition: vpbapi.h:1837
float hw_gain
hardware gain parameter
Definition: playrec.cpp:77
int GetMessageVPB(unsigned short board, uint16_t *mess)
Gets a message from the DSP message queue.
Definition: comm.cpp:511
Audio recording state data
Definition: playrec.cpp:122
char mdate[12]
Manufacture Date.
Definition: vpbreg.h:163
void WINAPI vpb_set_mprintf(void(*func)(const char *format,...))
Specify a function to handle mprintf() logging output.
Definition: vpbapi.cpp:3597
@ VPB_DIGIT_TERM
A termination digit was collected.
Definition: vpbapi.h:1991
@ VPB_TONE_BUSY
Called number busy tone.
Definition: vpbapi.h:1429
Base class for host processor based card types.
Definition: vpbreg.h:197
unsigned int hz
Frequency in Hz.
Definition: tonegen.h:122
float level3
third tone level in dB, -inf to 0dB
Definition: vpbapi.h:1470
uint16_t tfire
timer mode only
Definition: vpbapi.h:1599
AudioState WINAPI vpb_play_state(int handle)
Return the current play state of a port.
Definition: playrec.cpp:1076
Fifo * dnmess
ptr to down message DSP FIFO in PC
Definition: vpbreg.h:144
@ VPB_OPCI
OpenPCI card.
Definition: vpbapi.h:81
int NewHandle(int board, int port)
Return a new handle for a port on some board.
Definition: comm.h:191
AudioCompress WINAPI vpb_wave_get_mode(WFILE *wav)
Return the compression mode of wav.
Definition: wave.cpp:486
char date_time[9]
Time of call.
Definition: vpbapi.h:2091
@ VPB_TONE_STUTTERDIAL
Voicemail pending signal.
Definition: vpbapi.h:1433
pthread_cond_t cond
state change signalling
Definition: playrec.cpp:81
double fsk_mark
Coefficient for cid generation.
Definition: vpbapi.h:1750
HookState
Symbolic hook states.
Definition: vpbapi.h:299
unsigned short freq2
frequency of second tone in Hz
Definition: vpbapi.h:1466
#define VPB_RING_STATION_OFF
Stop station port ringing.
Definition: vpbapi.h:344
uint16_t defbal1
default codec balance register 1
Definition: vpbreg.h:156
~Audio()
Default destructor.
Definition: playrec.cpp:99
@ VPB_DIGIT_INTER_DIGIT_TIME_OUT
The specified time for collecting further digits expired.
Definition: vpbapi.h:2000
Common internal helper functions.
#define VPB_VLOG_CHUNK
May be added to the Wave file mode to include a VPB_VLOG chunk when recording.
Definition: vpbapi.h:1828
static VPB_DEV * vpb_dev
Global VPB_DEV array.
Definition: vpbapi.cpp:161
std::string WINAPI vpb_get_model(VPBPortHandle handle)
Return a string indicating the board model.
Definition: vpbapi.cpp:2597
void ring_station_async(int board, int port, int cadence)
Internal function to control ringing on port of board.
Definition: vpbapi.cpp:2096
void SetFlashTime(int port, uint16_t min, uint16_t max)
Configure the hook-flash detection window.
Definition: vtcore.cpp:981
void WINAPI vpb_record_buf_finish(VPBPortHandle handle)
Signal completion of audio recording and release a port for other users.
Definition: playrec.cpp:1505
const Country *WINAPI vpb_get_port_country(VPBPortHandle handle)
Get the current country data for port handle.
Definition: vpbapi.cpp:861
int WINAPI vpb_hostecho_on(int handle)
Enable the host echo canceller for handle.
Definition: vpbapi.cpp:3192
VTCore(VPBREG ®)
Constructor.
Definition: vtcore.cpp:810
virtual State ImplStart()=0
Called by Start() for implementation specific operations.
int WINAPI vpb_enable_tone_event(VPBPortHandle handle, unsigned long mask)
Enable the TONE events specified by mask for handle.
Definition: vpbapi.cpp:1884
int WINAPI vpb_dial_async(int handle, const std::string &dialstr)
Dials a string of digits on the port for handle.
Definition: vpbdial.cpp:338
int WINAPI vpb_get_event_async(VPB_EVENT *e)
Fetch the next event from the global event queue.
Definition: vpbapi.cpp:2006
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.
Definition: playrec.cpp:1591
VPBREG & m_reg
Reference to the VPBREG structure for this HostDSP.
Definition: vpbreg.h:201
const VPBHANDLE & LookupHandle(int handle) const
Look up the VPBHANDLE entry for handle.
Definition: comm.h:185
int WINAPI vpb_cid_set(VPB_CID *cid, CidDataType field, void *value)
Set a field in the cid data structure.
Definition: cidg.cpp:45
Additional data that may be included in a wav file.
Definition: vpbapi.h:1832
int WINAPI vpb_playtone_sync(int handle, const VPB_TONE &vpb_tone)
Play a user defined tone, return when playback completes.
Definition: vpbdial.cpp:517
HostDSP * hostdsp
Pointer to the Host DSP object.
Definition: vpbreg.h:182
AudioState
play/record state flags
Definition: vpbapi.h:740
uint16_t defSbal2
default codec balance register 2 for station
Definition: vpbreg.h:160
VPB_MODEL get_board_type(int board)
Return the symbolic VPB_MODEL type of a board.
Definition: vpbapi.cpp:2492
std::vector< TONE > List
Container type for a list of TONE's.
Definition: vpbdial.cpp:59
int WINAPI vpb_disable_event(VPBPortHandle handle, unsigned long mask)
Disable the events specified by mask for handle.
Definition: vpbapi.cpp:1862
VPB_TONE_ID
Symbolic identifiers for predefined, localised tones.
Definition: vpbapi.h:1426
float db
Magnitude in dB, from -inf to 0dB.
Definition: tonegen.h:123
void SetUserData(size_t slot, T data)
Store arbitrary, typed data into a user-data slot.
Definition: tonegen.h:405
void UNListen(unsigned int port)
Remove a half duplex bridge or full duplex tap from port.
Definition: vtcore.cpp:1041
Internal functions for audio playback and recording.
#define VPB_MTONEDETECT
The callback function type for vpb_set_event_callback().
Definition: vpbapi.h:512
int WINAPI vpb_play_file_sync(VPBPortHandle handle, const string &file_name)
Utility function to play a wav file to a port.
Definition: playrec.cpp:956
int WINAPI vpb_get_card_info(int board, VPB_CARD_INFO *detail)
Return detail of the card model and revision for board.
Definition: vpbapi.cpp:3141
#define MAXCH
max channels per VPB
Definition: vpbreg.h:74
void WINAPI vpb_settonedet(VPBPortHandle handle, const VPB_DETECT &d)
Set or change the parameters for a tone to detect on some port.
Definition: vpbtoned.cpp:306
void PadTxFrame(int port)
Pad a partial transmit frame for forwarding to the hardware.
Definition: comm.cpp:349
int WINAPI vpb_set_tone_event_mask(VPBPortHandle handle, unsigned long mask)
Set the TONE event mask. The previous mask value will be overwritten.
Definition: vpbapi.cpp:1870
void SetRepeat(bool repeat=true)
Set this (sequence of) tone(s) to play once, or loop continuously.
Definition: tonegen.h:328
int channel
The port number for this handle.
Definition: vpbreg.h:101
int get_driver_type(int board)
Return the symbolic type of the driver for board.
Definition: vpbapi.cpp:2486
void WINAPI vpb_cid_debug_on(const char *debug_file_name)
Enable debugging of the CID decoder.
Definition: cid.cpp:109
@ VPB_PRI
Sangoma PRI card.
Definition: vpbapi.h:80
Definition: utilfuncs.h:152
CidCallType
Symbolic CID call types.
Definition: vpbapi.h:2071
void WINAPI vpb_play_buf_start(VPBPortHandle handle, AudioCompress mode)
Prepare and seize a port for playing audio from a buffer.
Definition: playrec.cpp:915
uint16_t numch
number of channels
Definition: vpbreg.h:127
Definition: openpri.cpp:74
bool check_timeout_ms(unsigned long elapsedms)
Return true if some number of milliseconds have elapsed since timer_start().
Definition: timer.cpp:41
Definition: utilfuncs.h:136
uint16_t drop_max
Max valid loop drop time in ms.
Definition: vpbapi.h:1748
string term_digits
digits which terminate collection
Definition: playrec.cpp:74
Definition: utilfuncs.h:92
@ VPB_USER_EVT
Definition: vpbapi.h:488
@ VPB_OKIADPCM24
24 kbit/s OKI ADPCM
Definition: vpbapi.h:733
#define VPB_BUSY_AUST
busy/disconnect tone detected (Australia)
Definition: vpbapi.h:1639
Port recording parameters.
Definition: vpbapi.h:714
ToneGen configuration data structure.
Definition: tonegen.h:107
uint16_t tone_id
unique ID number for this tone
Definition: vpbapi.h:1610
@ VPB_DIGIT_TIME_OUT
The specified time for collecting digits expired.
Definition: vpbapi.h:1997
unsigned long tonemask
The current tone event mask.
Definition: vpbapi.cpp:116
~Config()
Destructor.
Definition: tonegen.h:250
#define VPB_MSTATION_FLASH
The callback function type for vpb_set_event_callback().
Definition: vpbapi.h:522
void WINAPI vpb_play_set_gain(VPBPortHandle handle, float gain)
Set the software play gain component for a port.
Definition: playrec.cpp:980
#define VPB_MDTMF_DOWN
The callback function type for vpb_set_event_callback().
Definition: vpbapi.h:527
void TapListen(unsigned int port, unsigned int srcboard, unsigned int srcport)
Create a full duplex tap to port of the audio from srcport on srcboard.
Definition: vtcore.cpp:1024
VPB hardware registry implementation.
static soft_bridge_info * soft_bridges
Global soft bridge list head.
Definition: vpbapi.cpp:163
int WINAPI vpb_get_num_cards()
Return the number of cards in the system.
Definition: vpbapi.cpp:2628
uint16_t bandwidth2
bandwidth of second tone (Hz)
Definition: vpbapi.h:1615
void SetHookState(int port, HookState hookstate)
Set the hook state of port.
Definition: vtcore.cpp:915
char cdn[19]
Called directory number.
Definition: vpbapi.h:2090
void clear()
Clear all data members their initialisation state.
Definition: vpbapi.h:2100
#define VPB_GRUNT
grunt detected
Definition: vpbapi.h:1635
VPB_EVT_TYPE
VPB_EVENT type values
Definition: vpbapi.h:442
int WINAPI vpb_dial_sync(int handle, const std::string &dialstr)
Dials a string of digits on the port for handle.
Definition: vpbdial.cpp:350
#define VPB_BUSY_308
busy tone detected (studio 308)
Definition: vpbapi.h:1637
Definition: utilfuncs.h:172
int WINAPI vpb_get_event_count_ch(VPBPortHandle handle)
Returns the number of events on the port specific event queue for handle.
Definition: vpbapi.cpp:1922
bool useconf
Flag true if a config file was read.
Definition: vpbreg.h:185
void play_reset_hw_gain(int handle)
Reset the hardware play gain to the configured default value.
Definition: playrec.cpp:217
unsigned long toff
off time in ms
Definition: vpbapi.h:1472
unsigned short freq3
frequency of third tone in Hz
Definition: vpbapi.h:1467
@ VPB_ONHOOK
Port on-hook.
Definition: vpbapi.h:301
Container for VPB event data.
Definition: vpbapi.h:494
const int VPB_DEVELOPMENT
API function error causes program abort. DON'T USE THIS.
Definition: vpbapi.h:1276
int WINAPI vpb_play_file_async(VPBPortHandle handle, const string &file_name, int data)
Utility function to play a wav file to a port.
Definition: playrec.cpp:968
Cadence()
Default constructor.
Definition: tonegen.h:141
void WINAPI vpb_wave_set_sample_rate(WFILE *wav, unsigned short rate)
Change the sample rate of a wav file.
Definition: wave.cpp:479
const char * name
Country name.
Definition: vpbapi.h:1734
bool check_timeout(unsigned int elapsed)
Return true if some number of seconds have elapsed since timer_start().
Definition: timer.cpp:35
unsigned long inter_digit_time_out
The maximum time in ms to wait for further digits once collection begins.
Definition: vpbapi.h:1981
uint16_t ntones
number of tones (1 or 2)
Definition: vpbapi.h:1611
Definition: wobbly.cpp:47
int WINAPI vpb_put_event(VPB_EVENT *e)
Places an event on the global and port specific event queues.
Definition: vpbapi.cpp:1900
uint16_t defbal2
default codec balance register 2
Definition: vpbreg.h:157
Definition: vpb_ioctl.h:39
void EndSequence()
Signal the completion of an atomic sequence of tones.
Definition: tonegen.h:745
void WINAPI vpb_cid_t2_compose_wav(const char *dlp, int dlp_len, short *wav_buf, int *wav_len, const Country *country)
Encode a data link packet into CP-FSK wav data for type 2 CID.
Definition: cidg.cpp:337
unsigned long time_start
Starting time for measuring time_out.
Definition: playrec.cpp:130
std::string WINAPI vpb_get_model(VPBPortHandle handle)
Return a string indicating the board model.
Definition: vpbapi.cpp:2597
int WINAPI vpb_wave_get_vlog(WFILE *wav, VPB_VLOG *buf)
Get VPB_VLOG information from a wave file.
Definition: wave.cpp:604
unsigned long WINAPI vpb_get_event_mask(VPBPortHandle handle)
Return the current event mask for handle.
Definition: vpbapi.cpp:1848
int WINAPI vpb_close(VPBPortHandle handle)
Close a previously opened port using the handle returned by vpb_open().
Definition: vpbapi.cpp:1748
Definition: loopmon.cpp:66
int WINAPI vpb_loopback_on(int h)
Turns on software loop-back of tx->rx in the kernel.
Definition: vpbapi.cpp:3158
Voicetronix voice processing board public API.
int WINAPI vpb_get_event_ch_async(VPBPortHandle handle, VPB_EVENT *event)
Fetch the next event from a port specific event queue.
Definition: vpbapi.cpp:2052
void WINAPI vpb_log_to_file(VPBPortHandle h, const std::string &filename)
Log full duplex audio from handle h to filename.
Definition: callmonitor.cpp:134
#define VPB_MRING_OFF
The callback function type for vpb_set_event_callback().
Definition: vpbapi.h:520
const Freq::List & GetNextFreqs()
Return the next frequency component in the sequence.
Definition: tonegen.h:456
Definition: vpbtimer.cpp:48
int WINAPI vpb_set_event_mask(VPBPortHandle handle, unsigned long mask)
Set the event mask for handle.
Definition: vpbapi.cpp:1840
int cardnum
The number of the card as opened by the driver.
Definition: vpbreg.h:170
void get_board_model(int board, char *s)
Return a descriptive model name for board in s.
Definition: vpbapi.cpp:2568
uint16_t szrxdf[MAXCH]
size of RX FIFOs in DSP
Definition: vpbreg.h:134
Definition: utilfuncs.h:165
virtual void SetFlashTime(int port, uint16_t min, uint16_t max)
Configure the hook-flash detection window.
Definition: vpbreg.h:246
void UNListen(unsigned int port)
Remove a half duplex bridge or full duplex tap from port.
Definition: openpri.cpp:2648
int WINAPI vpb_get_event_sync(VPB_EVENT *event, unsigned int time_out=0)
Wait for an event on the global event queue.
Definition: vpbapi.cpp:2018
virtual void WaitForTxEmpty(int port)=0
Block until the transmit buffers for port are empty.
unsigned long digit_time_out
The maximum time in ms to wait for digits.
Definition: vpbapi.h:1978
void InitBoards()
Second stage initialisation.
Definition: comm.cpp:449
VPBREG * vpbreg(unsigned short board)
Return a pointer to the VPBREG structure for some board.
Definition: comm.cpp:571
std::vector< int > handles
lookup table of the handles for each port.
Definition: vpbreg.h:169
@ VPB_TONE_RINGING
Normal ringing tone.
Definition: vpbapi.h:1428
unsigned int onms
On time is ms.
Definition: tonegen.h:137
@ VPB_PORT_UNKNOWN
Placeholder for an unknown port type.
Definition: vpbapi.h:91
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.
Definition: playrec.cpp:1061
unsigned int GetBoardCount() const
Return the number of boards registered.
Definition: vpbreg.h:330
char statime[16]
Record Start Time yyyymmddHHMMSS.
Definition: vpbapi.h:1835
int WINAPI vpb_record_buf_sync(VPBPortHandle handle, char *buf, size_t len)
Record a buffer of audio samples from a port.
Definition: playrec.cpp:1487
int WINAPI vpb_record_file_async(VPBPortHandle handle, const string &file_name, AudioCompress mode)
Utility function to record a wav file from a port.
Definition: playrec.cpp:1527
const Country *WINAPI vpb_get_country_data(const std::string &name)
Get country specific data by name.
Definition: vpbapi.cpp:867
State ImplStart()
Called by Start() for implementation specific operations.
void SetCountry(int, const Country *)
Configure the hardware for country on port of this board.
Definition: comm.h:88
void set_codec_reg(int handle, unsigned short addr, unsigned short data, Comm *c)
Write directly to a V4PCI codec register.
Definition: vpbapi.cpp:2657
int WINAPI vpb_hostecho_on(int h)
Enable the host echo canceller for handle.
Definition: vpbapi.cpp:3192
VTCore HostDSP implementation
VPB_STRAN stran[VPB_MS]
cadence state transition table
Definition: vpbapi.h:1625
uint16_t flash_min
Min valid hook flash time in ms.
Definition: vpbapi.h:1740
void set_country(int board, int port, const Country *country)
Set the country data for port on board.
Definition: vpbapi.cpp:799
void record_reset_hw_gain(int handle)
Reset the hardware record gain to the configured default value.
Definition: playrec.cpp:251
const Country * get_country(int board, int port)
Return the country data for port on board.
Definition: vpbapi.cpp:818
int WINAPI vpb_bridge(VPBPortHandle h1, VPBPortHandle h2, BridgeMode mode)
Create a full duplex bridge between ports h1 and h2.
Definition: vpbapi.cpp:2702
void WINAPI vpb_reset(VPBPortHandle handle=VPB_PORTHANDLE_NULL)
Reset a port back to its idle state (on-hook, not ringing etc.)
Definition: vpbapi.cpp:1652
int WINAPI vpb_set_event_callback(VPBPortHandle handle, vpb_event_callback callback, void *context)
Sets an event callback function to use instead of the APIQ.
Definition: vpbapi.cpp:1824
CidCallType call_type
Call type designator.
Definition: vpbapi.h:2084
VT_DEPRECATED(int WINAPI vpb_get_type(int h))
Audio()
Default constructor.
Definition: playrec.cpp:87
@ VPB_CID_NMSS
Network message system status.
Definition: vpbapi.h:2176
void playrec_new_digit_play(int handle, char digit)
Called by the MMQ when the DSP detects a digit event.
Definition: playrec.cpp:882
AudioCompress mode
current play mode
Definition: playrec.cpp:75
void WINAPI vpb_reset(VPBPortHandle handle)
Reset a port back to its idle state (on-hook, not ringing etc.)
Definition: vpbapi.cpp:1652
int ring_cadence
Default ring cadence.
Definition: vpbapi.h:1737
@ VPB_CID_CALLING_LINE_DN
Caller directory number.
Definition: vpbapi.h:2170
void SetPSImpedance(int port, int impedance)
Override the default impedance for ProSLIC ports.
Definition: vtcore.cpp:967
const Country *WINAPI vpb_get_country_data(const std::string &name)
Get country specific data by name.
Definition: vpbapi.cpp:867
void WINAPI vpb_send_cid_t2_sync(int handle, const VPB_CID &cid)
Send type 2 caller id information to handle.
Definition: cidg.cpp:399
int WINAPI vpb_loopback_off(int handle)
Turns off software loop-back of tx->rx in the kernel.
Definition: vpbapi.cpp:3175
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.
Definition: vpbtoned.cpp:451
Definition: utilfuncs.h:73
unsigned short max_digits
The maximum number of digits to collect.
Definition: vpbapi.h:1975
void WINAPI vpb_set_country(const Country *country)
Set the global default country specific information.
Definition: vpbapi.cpp:836
@ VPB_ALAW
64 kbit/s A-law companded
Definition: vpbapi.h:730
void WINAPI vpb_monitor_audio(VPBPortHandle dest, VPBPortHandle src)
Tap full duplex audio from src to dest.
Definition: callmonitor.cpp:169
Container type for device information.
Definition: vpbapi.cpp:108
#define VPB_MDTMF
The callback function type for vpb_set_event_callback().
Definition: vpbapi.h:511
@ VPB_V4PCI
V4PCI 4 port PCI CT card.
Definition: vpbapi.h:76
unsigned long ton
on time in ms, if 0 tone is continuous
Definition: vpbapi.h:1471
pthread_mutex_t callback_mutex
Mutex for atomic access to event_callback and context.
Definition: vpbapi.cpp:128
uint16_t bandwidth1
bandwidth of first tone (Hz)
Definition: vpbapi.h:1613
static HostFifo * APIQ
Global API event Q object.
Definition: vpbapi.cpp:164
void WINAPI vpb_sleep(long time_ms)
Put the current thread to sleep for some number of milliseconds.
Definition: vpbapi.cpp:2126
int WINAPI vpb_get_event_count(void)
Returns the number of events on the global event queue.
Definition: vpbapi.cpp:1927
State ImplStart()
Called by Start() for implementation specific operations.
Definition: comm.cpp:71
V4PCI tone generator specialisation
Definition: comm.cpp:58
Fifo * upmess
ptr to down message DSP FIFO in PC
Definition: vpbreg.h:145
const int VPB_ERROR_CODE
API function error returns error code. DON'T USE THIS.
Definition: vpbapi.h:1279
int16_t minlevel1
min amp of 1st tone ref 0dBm0
Definition: vpbapi.h:1616
Digit collection parameters.
Definition: vpbapi.h:1969
int putevt(VPB_EVENT *e, unsigned long mask)
Internal function to place an event on the API event queue.
Definition: vpbapi.cpp:1949
void ContinueSequence()
Begin the next discrete tone in an atomic sequence.
Definition: tonegen.h:729
ToneGen runtime exception type
Definition: tonegen.h:479
unsigned int time_out
Max ms to record for. If 0, recording will not time out.
Definition: vpbapi.h:720
@ VPB_CID_DATE_TIME
Timestamp.
Definition: vpbapi.h:2169
float defPlayGain
default play (Rx) gain
Definition: vpbreg.h:152
@ VPB_ON
The device is open.
Definition: vpbapi.cpp:100
void WaitForTxEmpty(int port)
Block until the transmit buffers for port are empty.
Definition: comm.cpp:357
int WINAPI vpb_get_digits_async(int handle, VPB_DIGITS *newdig, char *buf)
Get a buffer of DTMF digits.
Definition: digits.cpp:166
@ VPB_OKIADPCM
32 kbit/s OKI ADPCM
Definition: vpbapi.h:732
#define VPB_RINGBACK_308
ringback detected (studio 308)
Definition: vpbapi.h:1636
#define DD_PCI
PCI driver.
Definition: vpbreg.h:85
void WINAPI vpb_sethook_async(VPBPortHandle handle, HookState hookstate)
Signal a port to set its hook state. Returns immediately.
Definition: vpbapi.cpp:2062
uint16_t a_txdf[MAXCH]
addresses of TX FIFOs in DSP
Definition: vpbreg.h:133
int WINAPI vpb_cid_compose_dlp(const VPB_CID &cid, char *dlp)
Create a data link packet from a VPB_CID structure.
Definition: cidg.cpp:183
std::vector< Freq > List
Container type for a list of Freq structures.
Definition: tonegen.h:117
Definition: utilfuncs.h:106
void WINAPI vpb_monitor_terminate(VPBPortHandle h)
Cancel a tap to handle h created with vpb_monitor_audio().
Definition: callmonitor.cpp:182
int WINAPI vpb_record_terminate_sync(int handle)
Stop audio recording.
Definition: playrec.cpp:1648
void set_codec_reg(int handle, unsigned short addr, unsigned short data, Comm *comm)
Write directly to a V4PCI codec register.
Definition: vpbapi.cpp:2657
const Country * get_country(int board, int port)
Return the country data for port on board.
Definition: vpbapi.cpp:818
float WINAPI vpb_record_get_gain(VPBPortHandle handle)
Return the software record gain for a port.
Definition: playrec.cpp:1551
uint16_t sztxdf[MAXCH]
size of TX FIFOs in DSP
Definition: vpbreg.h:135
int WINAPI vpb_wave_seek(WFILE *wav, long offset)
Move the wave pointer to a specified location in the samples.
Definition: wave.cpp:459
void CheckHandle(VPBPortHandle handle, const char *where)
Check for a valid device handle.
Definition: vpbapi.cpp:735
void PutMessageVPB(unsigned short board, uint16_t *mess)
Send a message to the DSP message queue.
Definition: comm.cpp:485
@ VPB_OFFHOOK
Port off-hook.
Definition: vpbapi.h:302
~Exception()
Destructor.
Definition: tonegen.h:490
int WINAPI vpb_play_terminate_sync(int handle)
Stop audio playback.
Definition: playrec.cpp:1095
Deprecated symbol handling.
char revision[8]
Revision number.
Definition: vpbreg.h:164
void WaitForTxEmpty(int port)
Block until the transmit buffers for port are empty.
Definition: openpri.cpp:2631
void ring_station_async(int board, int port, int cadence)
Internal function to control ringing on port of board.
Definition: vpbapi.cpp:2096
void playrec_close()
Closes the playrec module.
Definition: playrec.cpp:505
size_t HowEmpty()
Returns the number of words free in the DSP FIFO.
Definition: dspfifo.cpp:201
#define VPB_MVOXON
The callback function type for vpb_set_event_callback().
Definition: vpbapi.h:514
int WINAPI vpb_settone(char ident, const VPB_TONE *tone)
Enables user to (re)define the tone associated with a dial string character.
Definition: vpbdial.cpp:374
int WINAPI vpb_echo_canc_set_sup_thresh(int handle, short *thresh)
Set the echo suppressor threshold.
Definition: vpbapi.cpp:2463
void WINAPI vpb_set_flashtime(VPBPortHandle handle, uint16_t min, uint16_t max)
Set the window for detecting flash events on OpenPCI cards.
Definition: vpbapi.cpp:2084
BridgeMode
Port bridging control flags.
Definition: vpbapi.h:382
char cidt[128]
CID TEXT ascii.
Definition: vpbapi.h:1839
unsigned int GetBoardCount() const
Return the total number of VPB boards currently registered.
Definition: comm.h:137
void WINAPI vpb_ring_station_async(VPBPortHandle handle, int cadence=-1)
Start or stop a station port ringing.
Definition: vpbapi.cpp:2116
VPB_MODEL model
VPB model.
Definition: vpbreg.h:148
void WINAPI vpb_translate_event(VPB_EVENT *event, char *str)
Converts a given event into a string describing it.
Definition: vtcore_ioctl.h:16
void * chans
Pointer to Channel state variables.
Definition: vpbreg.h:181
void WINAPI vpb_flush_events(VPBPortHandle handle)
Clear all unread events from the queue for handle.
Definition: vpbapi.cpp:1935
uint16_t data
data reg for PC-DSP comms
Definition: vpbreg.h:126
@ VPB_TONE_ID_MAX
Indicates the number of defined tone id's.
Definition: vpbapi.h:1435
@ CONTINUOUS
Continuous tone generation in progress.
Definition: tonegen.h:95
unsigned long data1
Optional long data.
Definition: vpbapi.h:499
void SignalCompletion()
Notify the tone generator of an external completion event.
Definition: tonegen.h:764
int lenextra
Support for user defined event data.
Definition: vpbapi.h:501
uint16_t drop_time
Generated loop drop time in ms.
Definition: vpbapi.h:1746
void WINAPI vpb_deltonedet(VPBPortHandle handle, const VPB_DETECT &d)
Revove a tone detector from some port.
Definition: vpbtoned.cpp:364
ToneGen()
Default constructor.
Definition: tonegen.h:554
static unsigned short Totalchans
Total number of ports on all boards.
Definition: vpbapi.cpp:167
uint16_t defbal3
default codec balance register 3
Definition: vpbreg.h:158
int WINAPI vpb_listen(VPBPortHandle dest, VPBPortHandle src, BridgeMode mode)
Create a half duplex bridge routing audio from src to dest.
Definition: vpbapi.cpp:2982
HookState WINAPI vpb_get_hookstate(VPBPortHandle handle)
Return the hook state of a port.
Definition: vpbapi.cpp:2513
const VPBHANDLE & LookupHandle(int handle) const
Look up the VPBHANDLE entry for handle.
Definition: vpbreg.h:340
void WINAPI vpb_record_buf_start(VPBPortHandle handle, AudioCompress mode)
Prepare and seize a port for recording audio from a buffer.
Definition: playrec.cpp:1480
#define VPB_MALL_TONES
Set or change the parameters for a tone to detect on some port.
Definition: vpbapi.h:1658
void WINAPI vpb_ring_with_cid(int handle, const VPB_CID &cid, int cadence)
Start handle ringing and send type 1 caller id information.
Definition: cidg.cpp:369
void stop()
Disable the the timer reporting a time out.
Definition: timer.h:45
CollectEndReason
The termination reason passed in the VPB_EVENT::data field of a VPB_DIGIT event.
Definition: vpbapi.h:1988
Exception(const std::string &message)
Construct an exception object with a simple message string.
Definition: tonegen.h:487
void Start(Config *tone, bool sync=false)
Begin generation of a single tone.
Definition: tonegen.h:600
const VPBOpenMode VPB_OPEN_NONE
Just open the port.
Definition: vpbapi.h:129
VPB_PORT get_port_type(int board, int port)
Return the type of a port on some board. VPB_FXO or VPB_FXS.
Definition: vpbapi.cpp:2539
@ VPB_MULAW
64 kbit/s mu-law companded
Definition: vpbapi.h:731
#define VPB_MS
The maximum number of cadence states to match.
Definition: vpbapi.h:1574
void CheckForAssert(unsigned short board)
Definition: comm.cpp:377
uint16_t freq1
freq of first tone (Hz)
Definition: vpbapi.h:1612
int data
Optional data.
Definition: vpbapi.h:498
#define VPB_MALL_EVENTS
The callback function type for vpb_set_event_callback().
Definition: vpbapi.h:528
Port playback parameters.
Definition: vpbapi.h:705
Container type for country specific data.
Definition: vpbapi.h:1730
uint16_t flash_max
Max valid hook flash time in ms.
Definition: vpbapi.h:1741