mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-08-13 09:36:46 +00:00
FreeTDM: Add trunk mode (NET/CPE) to span configuration in freetdm.conf and use it in ftmod_misdn and ftmod_libpri.
Some I/O implementations (e.g. mISDN) need this information to correctly set up the port configuration. In FreeTDM, the mode of a span has been. up until now, a part of the signalling module configuration ("node" or "mode" for libpri and isdn spans), which is parsed _after_ the I/O part of a span has been initialized. This limitation currently prevents us from using mISDN in NT mode. To work around this problem (without adding a lot of new tunk_type values like "E1_NET" etc.), add a new "trunk_mode" parameter to the span categories in freetdm.conf, which by default is "CPE" for all trunk types, except "FXS" (which defaults to "NET"). ftmod_misdn uses trunk_type + trunk_mode to correctly choose the d-channel protocol for a port. ftmod_libpri uses trunk_mode as a hint for the default "mode" setting. (NOTE: It will print a warning if trunk_mode and signalling mode do not match.) All other modules currently ignore the value of trunk_mode. Example freetdm.conf snippet for a mISDN span in NET/NT mode (using a HFC-S USB dongle): [span misdn MBRI_1] trunk_type => BRI_PTMP trunk_mode => NET b-channel => HFC-S_USB.1:1-2 d-channel => HFC-S_USB.1:3 Signed-off-by: Stefan Knoblich <stkn@openisdn.net>
This commit is contained in:
@@ -484,11 +484,23 @@ typedef enum {
|
||||
FTDM_TRUNK_GSM,
|
||||
FTDM_TRUNK_NONE
|
||||
} ftdm_trunk_type_t;
|
||||
#define TRUNK_STRINGS "E1", "T1", "J1", "BRI", "BRI_PTMP", "FXO", "FXS", "EM", "GSM", "NONE"
|
||||
#define TRUNK_TYPE_STRINGS "E1", "T1", "J1", "BRI", "BRI_PTMP", "FXO", "FXS", "EM", "GSM", "NONE"
|
||||
|
||||
/*! \brief Move from string to ftdm_trunk_type_t and viceversa */
|
||||
FTDM_STR2ENUM_P(ftdm_str2ftdm_trunk_type, ftdm_trunk_type2str, ftdm_trunk_type_t)
|
||||
|
||||
/*! \brief Span trunk modes */
|
||||
typedef enum {
|
||||
FTDM_TRUNK_MODE_CPE,
|
||||
FTDM_TRUNK_MODE_NET,
|
||||
FTDM_TRUNK_MODE_INVALID
|
||||
} ftdm_trunk_mode_t;
|
||||
#define TRUNK_MODE_STRINGS "CPE", "NET", "INVALID"
|
||||
|
||||
/*! \brief Move from string to ftdm_trunk_mode_t and viceversa */
|
||||
FTDM_STR2ENUM_P(ftdm_str2ftdm_trunk_mode, ftdm_trunk_mode2str, ftdm_trunk_mode_t)
|
||||
|
||||
|
||||
/*! \brief Basic channel configuration provided to ftdm_configure_span_channels */
|
||||
typedef struct ftdm_channel_config {
|
||||
char name[FTDM_MAX_NAME_STR_SZ];
|
||||
@@ -1744,6 +1756,28 @@ FT_DECLARE(ftdm_trunk_type_t) ftdm_span_get_trunk_type(const ftdm_span_t *span);
|
||||
/*! \brief For display debugging purposes you can display this string which describes the trunk type of a span */
|
||||
FT_DECLARE(const char *) ftdm_span_get_trunk_type_str(const ftdm_span_t *span);
|
||||
|
||||
/*!
|
||||
* Set the trunk mode for a span
|
||||
* \note This must be called before configuring any channels within the span!
|
||||
* \param[in] span The span
|
||||
* \param[in] type The trunk mode
|
||||
*/
|
||||
FT_DECLARE(void) ftdm_span_set_trunk_mode(ftdm_span_t *span, ftdm_trunk_mode_t mode);
|
||||
|
||||
/*!
|
||||
* Get the trunk mode for a span
|
||||
* \param[in] span The span
|
||||
* \return Span trunk mode
|
||||
*/
|
||||
FT_DECLARE(ftdm_trunk_mode_t) ftdm_span_get_trunk_mode(const ftdm_span_t *span);
|
||||
|
||||
/*!
|
||||
* Get the trunk mode of a span in textual form
|
||||
* \param[in] span The span
|
||||
* \return Span mode name as a string
|
||||
*/
|
||||
FT_DECLARE(const char *) ftdm_span_get_trunk_mode_str(const ftdm_span_t *span);
|
||||
|
||||
/*!
|
||||
* \brief Return the channel identified by the provided id
|
||||
*
|
||||
|
@@ -485,6 +485,7 @@ struct ftdm_span {
|
||||
fio_event_cb_t event_callback;
|
||||
ftdm_mutex_t *mutex;
|
||||
ftdm_trunk_type_t trunk_type;
|
||||
ftdm_trunk_mode_t trunk_mode;
|
||||
ftdm_analog_start_type_t start_type;
|
||||
ftdm_signal_type_t signal_type;
|
||||
uint32_t last_used_index;
|
||||
|
Reference in New Issue
Block a user