p_m_s_digit_i = 0;
p_m_s_pulsecount = 0;
p_m_s_last_digit = ' ';
+ p_m_s_last_digit_used = ' ';
p_m_s_signal_loss = 0;
p_m_s_decoder_count = 0;
//p_m_s_decoder_buffer;
PDEBUG(DEBUG_SS5, "%s: detecting signal '%c' start (state=%s signal=%s)\n", p_name, digit, ss5_state_name[p_m_s_state], ss5_signal_name[p_m_s_signal]);
#endif
- /* ignore short loss of signal */
+ /* ignore short loss of signal, or change within one decode window */
if (p_m_s_signal_loss) {
if (digit == ' ') {
/* still lost */
p_m_s_last_digit = digit;
/* starting to loose signal */
p_m_s_signal_loss = SS5_DECODER_NPOINTS;
+ } else if (digit != p_m_s_last_digit) {
+ /* digit changes, but we keep old digit until it is detected twice */
+#ifdef DEBUG_DETECT
+ PDEBUG(DEBUG_SS5, "%s: signal '%c' changes to '%c'\n", p_name, p_m_s_last_digit, digit);
+#endif
+ p_m_s_last_digit = digit;
+ digit = p_m_s_last_digit_used;
} else {
/* storing last signal, in case it is lost */
p_m_s_last_digit = digit;
}
}
+ p_m_s_last_digit_used = digit;
/* update mute */
if ((p_m_mISDNport->ss5 & SS5_FEATURE_SUPPRESS)) {
{
struct lcr_msg *message;
+ p_m_s_timer = 0.0;
+
/* sending release to endpoint */
while(p_epointlist) {
message = message_create(p_serial, p_epointlist->epoint_id, PORT_TO_EPOINT, MESSAGE_RELEASE);
start_signal(SS5_STATE_CLEAR_BACK);
new_state(PORT_STATE_OUT_DISCONNECT);
+// p_m_s_timer_fn = &Pss5::register_timeout;
+// p_m_s_timer = now + 30.0;
}
/* MESSAGE_RELEASE */
do_release(param->disconnectinfo.cause, param->disconnectinfo.location);
}
+void Pss5::register_timeout(void)
+{
+ do_release(CAUSE_NORMAL, LOCATION_BEYOND);
+}
/*
* endpoint sends messages to the port
char p_m_s_dial[64]; /* current dialing register */
int p_m_s_digit_i; /* current digit of register counter */
int p_m_s_pulsecount; /* counts pule dialing half cycles */
- char p_m_s_last_digit; /* stores last digit to fill short signal losses */
+ char p_m_s_last_digit; /* stores last digit that was detected, to fill short signal losses */
+ char p_m_s_last_digit_used; /* stores last digit that was used, to ignore short changes of signal due to noise */
int p_m_s_signal_loss; /* sample counter for loss of signal check */
int p_m_s_decoder_count; /* samples currently decoded */
unsigned char p_m_s_decoder_buffer[SS5_DECODER_NPOINTS]; /* buffer for storing one goertzel window */
void message_disconnect(unsigned int epoint_id, int message_id, union parameter *param);
void message_release(unsigned int epoint_id, int message_id, union parameter *param);
+ void register_timeout(void);
+
};
#define new_ss5_state(a) _new_ss5_state(a, __FUNCTION__, __LINE__)