Loading...
Searching...
No Matches
Port control
Public API functions » Port initialisation » Card information
Collaboration diagram for Port control:

## Topics

| Event handling

## Macros

#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

## Enumerations

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...

## Functions

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))

## Deprecated functions

| VT_DEPRECATED (int WINAPI vpb_bridge(int h1, int h2, BridgeMode mode, int resource))

## Detailed Description

## Enumeration Type Documentation

## BridgeMode

enum BridgeMode

Port bridging control flags.

Enumerator
VPB_BRIDGE_OFF | stop bridging
VPB_BRIDGE_ON | start bridging

## HookState

enum HookState

Symbolic hook states.

Enumerator
VPB_ONHOOK | Port on-hook.
VPB_OFFHOOK | Port off-hook.
VPB_FASTOFFHOOK | Port off-hook, no calibration.

## Function Documentation

## vpb_get_hookstate()

HookState WINAPI vpb_get_hookstate | ( | VPBPortHandle | handle | ) |

Return the hook state of a port.

Parameters

  handle | The handle of the port to query.

Returns
  `VPB_ONHOOK` or `VPB_OFFHOOK` if the query succeeds.

Exceptions

  VpbException | will be thrown in the event of an error.

Warning
  In environments where asynchronous operations may take place on handle, the real state of the port may have already changed again by the time this function returns. It is the responsibility of the user application to determine how much trust may be placed in the accuracy of this value at any point in the code where it is used.

References CheckHandle(), VTCore::hook_state(), vpb_c, VPB_OPCI, VPB_OSW, VPB_PRI, VPB_V4LOG, and VPB_V4PCI.

## vpb_ring_station_async()

void WINAPI vpb_ring_station_async | ( | VPBPortHandle | handle,
|  | int | cadence = -1 )

Start or stop a station port ringing.

Parameters

  handle | The handle of the port to control.
  cadence | The ring cadence value.

If the cadence parameter is not specified, the default cadence for a normal ring according to the port's country setting will be used. The valid cadence values are defined as follows:

- `0` - Stop ringing.
- `1` - Ring a guard tone cadence. Often used before sending caller id.
- `2` - Normal ring for Australian phone networks. (DR0)
- `3-9` - `DR1` to `DR7` of the `AS/ACIF` S002:2001 distinctive ring series.
- `10` - US ring cadence.

There is an additional special ring cadence `255`, which like `0`, stops the station ringing, but in addition will signal an OpenPCI `FXS` port to enter a mode where caller id information can be transmitted to a handset that is still on hook. ie. for US style caller id, you would generate one second of cadence `1` tone, stopped by a cadence `255` signal. The caller id tones can then be sent, and normal ringing commenced using cadence `2` - `10`. Convenience functions to do this are provided with the CTPort interface to ctserver.

Note
  Distinctive ring cadences are not supported by the OpenSwitch cards at the time of writing. Values `1` - `10` will all cause its normal ring cadence to be generated.

See also
  vpb_ring_with_cid()

References CheckHandle(), and ring_station_async().

Referenced by vpb_reset(), and vpb_ring_with_cid().

## vpb_set_flashtime()

void WINAPI vpb_set_flashtime | ( | VPBPortHandle | handle,
|  | uint16_t | min,
|  | uint16_t | max )

Set the window for detecting flash events on OpenPCI cards.

For FXS ports, this is automatically configured according to the locale specific values in the `Country` structure. For FXO ports, flash events are only generated if this function has been explicitly called (this is to maintain compatibility with older applications which manually processed the raw on/off hook events themselves).

Parameters

  handle | The handle of the port to configure.
  min | The minimum on-hook time for a valid flash signal in `ms`.
  max | The maximum on-hook time for a valid flash signal in `ms`.

References CheckHandle(), VPBREG::hostdsp, HostDSP::SetFlashTime(), and vpb_c.

## VT_DEPRECATED()

VT_DEPRECATED | ( | int WINAPI | vpb_bridgeint h1, int h2, BridgeMode mode, int resource | ) |

This function is deprecated. Use the more descriptively named and type-safe `vpb_get_card_type()` function instead.