mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-08-14 01:49:05 +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:
@@ -2462,9 +2462,15 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_libpri_configure_span)
|
||||
memset(isdn_data, 0, sizeof(*isdn_data));
|
||||
|
||||
/* set some default values */
|
||||
isdn_data->mode = PRI_CPE;
|
||||
isdn_data->ton = PRI_UNKNOWN;
|
||||
|
||||
/* Use span's trunk_mode as a reference for the default libpri mode */
|
||||
if (ftdm_span_get_trunk_mode(span) == FTDM_TRUNK_MODE_NET) {
|
||||
isdn_data->mode = PRI_NETWORK;
|
||||
} else {
|
||||
isdn_data->mode = PRI_CPE;
|
||||
}
|
||||
|
||||
switch (ftdm_span_get_trunk_type(span)) {
|
||||
case FTDM_TRUNK_BRI:
|
||||
case FTDM_TRUNK_BRI_PTMP:
|
||||
@@ -2516,8 +2522,8 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_libpri_configure_span)
|
||||
|
||||
if (!strcasecmp(var, "node") || !strcasecmp(var, "mode")) {
|
||||
if ((isdn_data->mode = parse_mode(val)) == -1) {
|
||||
ftdm_log(FTDM_LOG_ERROR, "Unknown node type '%s', defaulting to CPE mode\n", val);
|
||||
isdn_data->mode = PRI_CPE;
|
||||
ftdm_log(FTDM_LOG_ERROR, "Unknown node type '%s'\n", val);
|
||||
goto error;
|
||||
}
|
||||
}
|
||||
else if (!strcasecmp(var, "switch") || !strcasecmp(var, "dialect")) {
|
||||
@@ -2563,6 +2569,16 @@ static FIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(ftdm_libpri_configure_span)
|
||||
}
|
||||
}
|
||||
|
||||
/* Check if modes match and log a message if they do not. Just to be on the safe side. */
|
||||
if (isdn_data->mode == PRI_CPE && ftdm_span_get_trunk_mode(span) == FTDM_TRUNK_MODE_NET) {
|
||||
ftdm_log(FTDM_LOG_WARNING, "Span '%s' signalling set up for TE/CPE/USER mode, while port is running in NT/NET mode. You may want to check your 'trunk_mode' settings.\n",
|
||||
ftdm_span_get_name(span));
|
||||
}
|
||||
else if (isdn_data->mode == PRI_NETWORK && ftdm_span_get_trunk_mode(span) == FTDM_TRUNK_MODE_CPE) {
|
||||
ftdm_log(FTDM_LOG_WARNING, "Span '%s' signalling set up for NT/NET mode, while port is running in TE/CPE/USER mode. You may want to check your 'trunk_mode' settings.\n",
|
||||
ftdm_span_get_name(span));
|
||||
}
|
||||
|
||||
span->start = ftdm_libpri_start;
|
||||
span->stop = ftdm_libpri_stop;
|
||||
span->signal_cb = sig_cb;
|
||||
|
Reference in New Issue
Block a user