Prosody FMP processing: API

The following functions are provided by the Prosody FMP processing API:

API call W Description
sm_fmprx_create()   Create a FMP[rx] endpoint
sm_fmprx_destroy()   Destroy a previously allocated FMP[rx]
sm_fmprx_get_datafeed()   Obtain a data feed from a FMP[rx]
sm_fmprx_get_event()   Obtain an event for a FMP[rx]
sm_fmprx_status()   Determine FMP[rx] status
sm_fmprx_stop()   Instructs a FMP[rx] to stop processing T.38
sm_fmptx_config()   Configure the basic options for FMP[tx] to use IPv4
sm_fmptx_config_ipv6()   Configure the basic options for a FMP[tx] to use IPv6
sm_fmptx_create()   Create a FMP[tx] endpoint
sm_fmptx_datafeed_connect()   Connect a datafeed to an FMP[tx]
sm_fmptx_destroy()   Destroy a previously allocated FMP[tx]
sm_fmptx_get_event()   Obtain an event for a FMP[tx]
sm_fmptx_status()   Determine FMP[tx] status
sm_fmptx_stop()   Instructs a FMP[tx] to stop sending T.38

This document is also available as separate pages for each function.


Prosody FMP processing: API: sm_fmprx_create

Prototype Definition

int sm_fmprx_create(struct sm_fmprx_create_parms *fmprxp)

Parameters

*fmprxp
a structure of the following type:
typedef struct sm_fmprx_create_parms {
	tSMFMPrxId fmprx;					/* out */
	tSMModuleId module;					/* in */
	enum kSMFMPrxType {
		kSMFMPrxTypeIPv4,
		kSMFMPrxTypeIPv6,
	} type;							/* in */
	struct in_addr address;					/* in */
	struct in6_addr ipv6_address;				/* in */
} SM_FMPRX_CREATE_PARMS;

Description

Allocates, on a specific module, a new FMP[rx] to receive incoming T.38 data. If the call completes successfully, the parameter fmprx will be set to the identifier for that fmprx.

A FMP[rx] is automatically allocated a port number for incoming RTP data, this information may be obtained by waiting for sm_fmprx_status() to return the port information. The FMP[rx] will discard any incoming packets that do not match it's current configuration settings.

Requires the module fmprx to have been downloaded.

Fields

fmprx
The newly created FMP[rx].
module
A value obtained from sm_open_module() which indicates the module where the FMP[rx] is to be allocated.
type
One of these values:
kSMFMPrxTypeIPv4
The FMP[rx] is to receive IPv4 packets
kSMFMPrxTypeIPv6
The FMP[rx] is to receive IPv6 packets
address
The address on which this FMP[rx] is to listen if type is kSMFMPrxTypeIPv4.
ipv6_address
The address on which this FMP[rx] is to listen if type is kSMFMPrxTypeIPv6.

Returns

0 if call completed successfully, otherwise a standard error such as:


Prosody FMP processing: API: sm_fmprx_destroy

Prototype Definition

int sm_fmprx_destroy(tSMFMPrxId fmprx)

Parameters

fmprx
A tSMFMPrxId that has been prevously created by a call to sm_fmprx_create().

Description

Destroys fmprx and invalidates the tSMFMPrxId.

Returns

0 if call completed successfully, otherwise a standard error such as:


Prosody FMP processing: API: sm_fmprx_get_datafeed

Prototype Definition

int sm_fmprx_get_datafeed(struct sm_fmprx_datafeed_parms *datafeedp)

Parameters

*datafeedp
a structure of the following type:
typedef struct sm_fmprx_datafeed_parms {
	tSMFMPrxId fmprx;					/* in */
	tSMDatafeedId datafeed;					/* out */
} SM_FMPRX_DATAFEED_PARMS;

Description

Request a datafeed identifier from a FMP[rx]. This identifer can subsequently be used in a call to sm_channel_datafeed_connect() or sm_fmptx_datafeed_connect() to connect a FMP[rx] to a speech channel (tSMChannelId) or a FMP[tx] respectively. Datafeed connections can only be made between objects allocated on the same tSMModuleId.

Requires the modules datafeed fmprx to have been downloaded.

Fields

fmprx
The fmp[rx] from which to obtain a datafeed
datafeed
The datafeed object associated with the FMP[rx]

Returns

0 if call completed successfully, otherwise a standard error such as:


Prosody FMP processing: API: sm_fmprx_get_event

Prototype Definition

int sm_fmprx_get_event(struct sm_fmprx_event_parms *eventp)

Parameters

*eventp
a structure of the following type:
typedef struct sm_fmprx_event_parms {
	tSMFMPrxId fmprx;					/* in */
	tSMEventId event;					/* out */
} SM_FMPRX_EVENT_PARMS;

Description

If the call completes successfully event will hold a pointer to the tSMEventId belonging to fmprx. The tSMEventId is valid until the FMP[rx] is destroyed using sm_fmprx_destroy(). This event will be signalled when a status change occurs on the FMP[rx]. When the event is signalled the user must call sm_fmprx_status() to discover the nature of the status change.

Fields

fmprx
The FMP[rx]
event
The event identifier

Returns

0 if call completed successfully, otherwise a standard error such as:


Prosody FMP processing: API: sm_fmprx_status

Prototype Definition

int sm_fmprx_status(struct sm_fmprx_status_parms *statusp)

Parameters

*statusp
a structure of the following type:
typedef struct sm_fmprx_status_parms {
	tSMFMPrxId fmprx;					/* in */
	enum kSMFMPrxStatus {
		kSMFMPrxStatusRunning,
		kSMFMPrxStatusStopped,
		kSMFMPrxStatusGotPorts,
		kSMFMPrxStatusSource,
		kSMFMPrxStatusGotPortsIPv6,
		kSMFMPrxStatusSourceIPv6,
	} status;						/* out */
	union {
		struct {
			int T38_port;				/* out */
			struct in_addr address;			/* out */
		} port;						/* out */
		struct {
			struct in_addr address;			/* out */
			int port;				/* out */
		} source;					/* out */
		struct {
			int T38_port;				/* out */
			struct in6_addr address;		/* out */
		} port_ipv6;					/* out */
		struct {
			struct in6_addr address;		/* out */
			int port;				/* out */
		} source_ipv6;					/* out */
	} u;							/* out */
} SM_FMPRX_STATUS_PARMS;

Description

Returns the current status of the FMP[rx] or an error to indicate that an error has occurred.

When the event, obtained from sm_fmprx_get_event(), is signalled the user must call this function to determine the nature of the status change. The change in status may indicate that an error occurred whilst processing a user request or it may be notifiying the user of a change to the previous state of the FMP[rx].

Fields

fmprx
The FMP[rx] to interrogate
status
One of these values:
kSMFMPrxStatusRunning
Indicates that there is nothing significant to report
kSMFMPrxStatusStopped
Indicates that the FMP[rx] has stopped processing T.38 and that it can be safely destroyed
kSMFMPrxStatusGotPorts
Indicates that IPv4 port information is available.
kSMFMPrxStatusSource
Indicates that IPv4 source address and port information is available.
kSMFMPrxStatusGotPortsIPv6
Indicates that IPv6 port information is available.
kSMFMPrxStatusSourceIPv6
Indicates that IPv6 source address and port information is available.
u
port
This field is only valid if the status is kSMFMPrxStatusGotPorts.
T38_port
The UDP port number on which this FMP[rx] is listening for T.38 packets
address
The IPv4 address on which this FMP[rx] is listening
source
This field is only valid if the status is kSMFMPrxStatusSource.
address
The IPv4 address from which the T.38 data is being received.
port
The UDP port number from which the T.38 data is being received.
port_ipv6
This field is only valid if the status is kSMFMPrxStatusGotPortsIPv6.
T38_port
The UDP port number on which this FMP[rx] is listening for T.38 packets
address
The IPv6 address on which this FMP[rx] is listening
source_ipv6
This field is only valid if the status is kSMFMPrxStatusSourceIPv6.
address
The IPv6 address from which the T.38 data is being received.
port
The UDP port number from which the T.38 data is being received.

Returns

0 if call completed successfully, otherwise a standard error such as:


Prosody FMP processing: API: sm_fmprx_stop

Prototype Definition

int sm_fmprx_stop(struct sm_fmprx_stop_parms *stopp)

Parameters

*stopp
a structure of the following type:
typedef struct sm_fmprx_stop_parms {
	tSMFMPrxId fmprx;					/* in */
} SM_FMPRX_STOP_PARMS;

Description

Requests that a FMP[rx] stops executing. The user will be notified that a FMP[rx] has terminated by a final status event. Once the final status notification has been received the FMP[rx] can be destroyed using sm_fmprx_destroy().

Once the FMP[rx] has stopped the event should no longer be used to wait for status notifications as it will be signalled permanently. The event is invalidated when sm_fmprx_destroy() is called.

Fields

fmprx
A tSMFMPrxId that has been previously created by a call to sm_fmprx_create().

Returns

0 if call completed successfully, otherwise a standard error such as:


Prosody FMP processing: API: sm_fmptx_config

Prototype Definition

int sm_fmptx_config(struct sm_fmptx_config_parms *configp)

Parameters

*configp
a structure of the following type:
typedef struct sm_fmptx_config_parms {
	tSMFMPtxId fmptx;					/* in */
	SOCKADDR_IN destination;				/* in */
	SOCKADDR_IN source;					/* in */
	enum kSMFMPRecoveryType {
		kSMFMPRecoveryTypeRED,
		kSMFMPRecoveryTypeFEC,
		kSMFMPRecoveryTypeRTP,
	} Recovery;						/* in */
	tSM_UT32 RecoveryLevel;					/* in */
} SM_FMPTX_CONFIG_PARMS;

Description

Configures a FMP[tx] to send T.38 data to a device with the specified IPv4 address.

Fields

fmptx
The FMP[tx] to configure
destination
The SOCKADDR_IN structure specifying the destination IP address and port for the T38 data. A struct SOCKADDR_IN must be configured with an address family, an IP address and a port. Note that most operating systems define this structure such that fields are in network byte order. The structure must be correctly cast such that an IP V4 address is specified.
source
The SOCKADDR_IN structure allows you to specify the source IP address and port for the T.38 data. A struct SOCKADDR_IN must be configured with an address family. The IP address may be specified, or the value INADDR_ANY may be used to indicate that any suitable address may be used. The port number may be specified, or the value zero may be used to indicate that a suitable port number is to be automatically allocated and used. Note that most operating systems define this structure such that fields are in network byte order. The structure must be correctly cast such that an IP V4 address is specified.
Recovery
The type of error protection to use One of these values:
kSMFMPRecoveryTypeRED
Indicates that Redundancy is to be used
kSMFMPRecoveryTypeFEC
Indicates that Forward Error Correction is to be used, (not currently supported)
kSMFMPRecoveryTypeRTP
Indicates the Redundancy over RTP is to be used, (not currently supported)
RecoveryLevel
Indicates the level of Redundancy to apply to packets. This is the number of secondaries to include in each packet.

Returns

0 if call completed successfully, otherwise a standard error such as:


Prosody FMP processing: API: sm_fmptx_config_ipv6

Prototype Definition

int sm_fmptx_config_ipv6(struct sm_fmptx_config_ipv6_parms *configp)

Parameters

*configp
a structure of the following type:
typedef struct sm_fmptx_config_ipv6_parms {
	tSMFMPtxId fmptx;					/* in */
	SOCKADDR_IN6 destination;				/* in */
	SOCKADDR_IN6 source;					/* in */
	enum kSMFMPRecoveryType {
		kSMFMPRecoveryTypeRED,
		kSMFMPRecoveryTypeFEC,
		kSMFMPRecoveryTypeRTP,
	} Recovery;						/* in */
	tSM_UT32 RecoveryLevel;					/* in */
} SM_FMPTX_CONFIG_IPV6_PARMS;

Description

Configures a FMP[tx] to send T.38 data to a device with the specified IPv6 address.

Fields

fmptx
The FMP[tx] to configure
destination
The SOCKADDR_IN6 structure specifying the destination IP address and port for the T38 data. A struct SOCKADDR_IN6 must be configured with an address family, an IPv6 address and a port. Note that most operating systems define this structure such that fields are in network byte order.
source
The SOCKADDR_IN6 structure allows you to specify the source IPv6 address and port for the T.38 data. A struct SOCKADDR_IN6 must be configured with an address family. The IPv6 address may be specified, or the value INADDR_ANY may be used to indicate that any suitable address may be used. The port number may be specified, or the value zero may be used to indicate that a suitable port number is to be automatically allocated and used. Note that most operating systems define this structure such that fields are in network byte order.
Recovery
The type of error protection to use One of these values:
kSMFMPRecoveryTypeRED
Indicates that Redundancy is to be used
kSMFMPRecoveryTypeFEC
Indicates that Forward Error Correction is to be used, (not currently supported)
kSMFMPRecoveryTypeRTP
Indicates the Redundancy over RTP is to be used, (not currently supported)
RecoveryLevel
Indicates the level of Redundancy to apply to packets. This is the number of secondaries to include in each packet.

Returns

0 if call completed successfully, otherwise a standard error such as:


Prosody FMP processing: API: sm_fmptx_create

Prototype Definition

int sm_fmptx_create(struct sm_fmptx_create_parms *fmptxp)

Parameters

*fmptxp
a structure of the following type:
typedef struct sm_fmptx_create_parms {
	tSMFMPtxId fmptx;					/* out */
	tSMModuleId module;					/* in */
} SM_FMPTX_CREATE_PARMS;

Description

Allocates, on a specific module, a new FMP[tx] to transmit T.38 data to a remote device.

If the call completes successfully, the parameter fmptx will be set to the identifier for that FMP[tx].

Requires the module fmptx to have been downloaded.

Fields

fmptx
The newly created FMP[tx].
module
A value obtained from sm_open_module() which indicates the module where the FMP[tx] is to be allocated.

Returns

0 if call completed successfully, otherwise a standard error such as:


Prosody FMP processing: API: sm_fmptx_datafeed_connect

Prototype Definition

int sm_fmptx_datafeed_connect(struct sm_fmptx_datafeed_connect_parms *datafeedp)

Parameters

*datafeedp
a structure of the following type:
typedef struct sm_fmptx_datafeed_connect_parms {
	tSMDatafeedId data_source;				/* in */
	tSMFMPtxId data_dest;					/* in */
} SM_FMPTX_DATAFEED_CONNECT_PARMS;

Description

Connects a datafeed to a FMP[tx]. The data_source must be a datafeed obtained from sm_channel_get_datafeed() or sm_fmprx_get_datafeed(). The channel data_dest will recieve any data that is generated by the output task from which data_source was derived.

To disconnect a FMP[tx] from a datafeed, specify kSMNullDatafeedId as the tSMDatafeedId in data_source.

Requires the modules datafeed fmptx to have been downloaded.

Fields

data_source
The datafeed acting as a source of data
data_dest
The FMP[tx] that will receive the data

Returns

0 if call completed successfully, otherwise a standard error.


Prosody FMP processing: API: sm_fmptx_destroy

Prototype Definition

int sm_fmptx_destroy(tSMFMPtxId fmptx)

Parameters

fmptx
A tSMFMPtxId that has been prevously created by a call to sm_fmptx_create().

Description

Destroys fmptx and invalidates the tSMFMPtxId.

Returns

0 if call completed successfully, otherwise a standard error such as:


Prosody FMP processing: API: sm_fmptx_get_event

Prototype Definition

int sm_fmptx_get_event(struct sm_fmptx_event_parms *eventp)

Parameters

*eventp
a structure of the following type:
typedef struct sm_fmptx_event_parms {
	tSMFMPtxId fmptx;					/* in */
	tSMEventId event;					/* out */
} SM_FMPTX_EVENT_PARMS;

Description

If the call completes successfully event will hold a pointer to the tSMEventId belonging to fmptx. The tSMEventId is valid until the FMP[tx] is destroyed using sm_fmptx_destroy(). This event will be signalled when a status change occurs on the FMP[tx]. When the event is signalled the user must call sm_fmptx_status() to discover the nature of the status change.

Fields

fmptx
The FMP[tx]
event
The event identifier

Returns

0 if call completed successfully, otherwise a standard error such as:


Prosody FMP processing: API: sm_fmptx_status

Prototype Definition

int sm_fmptx_status(struct sm_fmptx_status_parms *statusp)

Parameters

*statusp
a structure of the following type:
typedef struct sm_fmptx_status_parms {
	tSMFMPtxId fmptx;					/* in */
	enum kSMFMPtxStatus {
		kSMFMPtxStatusRunning,
		kSMFMPtxStatusStopped,
	} status;						/* out */
} SM_FMPTX_STATUS_PARMS;

Description

Returns the current status of the FMP[tx] or an error to indicate that a problem occurred during start-up.

Fields

fmptx
The FMP[tx] to interrogate
status
One of these values:
kSMFMPtxStatusRunning
Indicates that there is nothing significant to report
kSMFMPtxStatusStopped
Indicates that the FMP[tx] has stopped transmitting T.38 and that it is safe to destroy

Returns

0 if call completed successfully, otherwise a standard error such as:


Prosody FMP processing: API: sm_fmptx_stop

Prototype Definition

int sm_fmptx_stop(struct sm_fmptx_stop_parms *stopp)

Parameters

*stopp
a structure of the following type:
typedef struct sm_fmptx_stop_parms {
	tSMFMPtxId fmptx;					/* in */
} SM_FMPTX_STOP_PARMS;

Description

Requests that a FMP[tx] stops executing. The user will be notified that a FMP[tx] has terminated by a final status event. Once the final status notification has been received the FMP[tx] can be destroyed using sm_fmptx_destroy().

Once the FMP[tx] has stopped the event should no longer be used to wait for status notifications as it will be signalled permanently. The event is invalidated when sm_fmptx_destroy() is called.

Fields

fmptx
A tSMFMPtxId that has been previously created by a call to sm_fmptx_create().

Returns

0 if call completed successfully, otherwise a standard error such as:


These functions constitute the Prosody FMP processing API.