提交 687dae10 authored 作者: Stefan Knoblich's avatar Stefan Knoblich 提交者: Ken Rice

ftmod_libpri: Improve RESTART handling, add PTP NT idle channel restart and T316.

Do not try to send RESTART on BRI PTMP spans, libpri will just print
an error and do nothing, causing the channels to be stuck in RESTART
forever.

Add T316 (RESTART ACK timeout), which is not implemented by libpri.
The default timeout is 30 seconds (Q.931 recommends 2 minutes, but
that is a little long and libpri layer 2 is being stupid) and the
restart attempt limit to 3 (instead of 2).

Periodically send RESTART on idle b-channels in PTP NT mode.
Default interval is 15 minutes, feature can be disabled by setting
"idle_restart_interval" to 0 in the span configuration.

Allow timeout / interval values to have an additional time unit
suffix for convenience reasons, the default (no unit specified)
is milliseconds, valid units include:

	w (week), d (day), h (hour), m (minute), s (second)

Only full integers are accepted, no fractional numbers, valid examples:

	2w   = two weeks
	37m  = 37 minutes
	1h   = 1 hour

Combinations of multiple numbers and units (e.g. "1w5d") are not supported.

New span configuration parameters:

	idle_restart_interval		(milliseconds / time unit suffix /
					 0 = disabled)

	t316 / restart_timeout		(milliseconds / time unit suffix)
	t316_limit / restart_attempts	(number of max. attempts)
Signed-off-by: 's avatarStefan Knoblich <stkn@openisdn.net>
上级 372330ac
......@@ -35,10 +35,27 @@
#include "freetdm.h"
#include "lpwrap_pri.h"
/* T302 Overlap receiving inter-digit timeout */
#define OVERLAP_TIMEOUT_MS_DEFAULT 5000 /* 5 sec */
#define OVERLAP_TIMEOUT_MS_MIN 3000 /* 3 sec */
#define OVERLAP_TIMEOUT_MS_MAX 30000 /* 30 sec */
/* NT-mode idle b-channel restart timer */
#define IDLE_RESTART_TIMEOUT_MS_DEFAULT 900000 /* 15 min */
#define IDLE_RESTART_TIMEOUT_MS_MIN 10000 /* 10 sec */
#define IDLE_RESTART_TIMEOUT_MS_MAX 86400000 /* 1 day */
/* T316 RESTART ACK wait timer */
#define T316_TIMEOUT_MS_DEFAULT 30000 /* 30 sec */
#define T316_TIMEOUT_MS_MIN 10000 /* 10 sec */
#define T316_TIMEOUT_MS_MAX 300000 /* 5 min */
/* T316 restart attempts until channel is suspended */
#define T316_ATTEMPT_LIMIT_DEFAULT 3
#define T316_ATTEMPT_LIMIT_MIN 1
#define T316_ATTEMPT_LIMIT_MAX 10
typedef enum {
SERVICE_CHANGE_STATUS_INSERVICE = 0,
SERVICE_CHANGE_STATUS_MAINTENANCE,
......@@ -76,6 +93,9 @@ struct ftdm_libpri_data {
int dialect;
int overlap; /*!< Overlap dial flags */
int overlap_timeout_ms; /*!< Overlap dial timeout */
int idle_restart_timeout_ms; /*!< NT-mode idle b-channel restart */
int t316_timeout_ms; /*!< T316 RESTART ACK timeout */
int t316_max_attempts; /*!< T316 timeout limit */
unsigned int layer1;
unsigned int ton;
unsigned int service_message_support;
......@@ -85,6 +105,9 @@ struct ftdm_libpri_data {
/* MSN filter */
ftdm_hash_t *msn_hash;
ftdm_mutex_t *msn_mutex;
/* NT-mode idle restart timer */
struct lpwrap_timer t3xx;
};
typedef struct ftdm_libpri_data ftdm_libpri_data_t;
......@@ -103,9 +126,11 @@ enum {
*/
struct ftdm_libpri_b_chan {
struct lpwrap_timer t302; /*!< T302 overlap receive timer */
struct lpwrap_timer t316; /*!< T316 restart ack timer */
ftdm_channel_t *channel; /*!< back-pointer to b-channel */
q931_call *call; /*!< libpri opaque call handle */
uint32_t flags; /*!< channel flags */
uint32_t t316_timeout_cnt; /*!< T316 timeout counter */
};
typedef struct ftdm_libpri_b_chan ftdm_libpri_b_chan_t;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论