SS5: Special feature to mute only when also respoinding with a tone

This is quite useful for breaking and seizing line in backward
direction. (breaking an incomming call)
This commit is contained in:
Andreas Eversberg 2015-12-13 08:20:39 +01:00
parent 6642360dcf
commit cdee00aedd
3 changed files with 52 additions and 26 deletions

View File

@ -1100,9 +1100,11 @@ static int inter_ss5(struct interface *interface, char *filename, int line, char
if (!strcasecmp(element, "release"))
ifport->ss5 |= SS5_FEATURE_RELEASE;
else
if (!strcasecmp(element, "suppress")
|| !strcasecmp(element, "mute"))
ifport->ss5 |= SS5_FEATURE_MUTE;
if (!strcasecmp(element, "mute-rx"))
ifport->ss5 |= SS5_FEATURE_MUTE_RX;
else
if (!strcasecmp(element, "mute-tx"))
ifport->ss5 |= SS5_FEATURE_MUTE_TX;
else
if (!strcasecmp(element, "quality"))
ifport->ss5 |= SS5_FEATURE_QUALITY;
@ -1394,8 +1396,9 @@ struct interface_param interface_param[] = {
" bell - Allow releasing and pulse-dialing via 2600 Hz like old Bell systems.\n"
" pulsedialing - Use pulse dialing on outgoing exchange. (takes long!)\n"
" delay - Use on incomming exchange, to make you feel a delay when blueboxing.\n"
" starrelease - Pulse dialing a star (11 pulses per digit) clears current call.\n"
" suppress - Suppress received tones, as they will be recognized."},
" release - Pulse dialing a star (11 pulses per digit) clears current call.\n"
" mutes-rx - Mute received 2600 and 2400 Hz tones when detected. (more realistic)\n"
" mutes-tx - Mute received 2600 and 2400 Hz tones while transmitting reply tone. (more hackable)"},
#endif
{"remote", &inter_remote, "<application>",

54
ss5.cpp
View File

@ -531,6 +531,7 @@ void Pss5::inband_receive(unsigned char *buffer, int len)
int count = 0, tocopy, space;
char digit;
double quality;
int mute = 0;
again:
/* how much to copy ? */
@ -619,23 +620,6 @@ void Pss5::inband_receive(unsigned char *buffer, int len)
}
p_m_s_last_digit_used = digit;
/* update mute */
if ((p_m_mISDNport->ss5 & SS5_FEATURE_MUTE)) {
int mdigit;
memcpy(p_m_s_delay_mute, p_m_s_delay_mute+1, sizeof(p_m_s_delay_mute)-1);
p_m_s_delay_mute[sizeof(p_m_s_delay_mute)-1] = digit;
mdigit = p_m_s_delay_mute[0];
if (p_m_mute) {
/* mute is on */
if (mdigit != 'A' && mdigit != 'B' && mdigit != 'C')
mute_off();
} else {
/* mute is off */
if (mdigit == 'A' || mdigit == 'B' || mdigit == 'C')
mute_on();
}
}
/* delay decoded tones */
if ((p_m_mISDNport->ss5 & SS5_FEATURE_DELAY)) {
/* shift buffer */
@ -1053,6 +1037,42 @@ void Pss5::inband_receive(unsigned char *buffer, int len)
break;
}
/* update mute on RX */
if ((p_m_mISDNport->ss5 & SS5_FEATURE_MUTE_RX)) {
int mdigit;
memcpy(p_m_s_delay_mute, p_m_s_delay_mute+1, sizeof(p_m_s_delay_mute)-1);
p_m_s_delay_mute[sizeof(p_m_s_delay_mute)-1] = digit;
mdigit = p_m_s_delay_mute[0];
if (mdigit == 'A' || mdigit == 'B' || mdigit == 'C')
mute = 1;
}
/* mute when TX */
if ((p_m_mISDNport->ss5 & SS5_FEATURE_MUTE_TX)) {
switch(p_m_s_signal) {
case SS5_SIGNAL_SEND_ON_RECOG:
case SS5_SIGNAL_RECEIVE_RECOG:
if (p_m_s_recog > SS5_DELAY_MUTE)
mute = 1;
break;
case SS5_SIGNAL_SEND_OFF:
case SS5_SIGNAL_RECEIVE:
mute = 1;
break;
}
}
/* apply mute state */
if (p_m_mute) {
/* mute is on */
if (!mute)
mute_off();
} else {
/* mute is off */
if (mute)
mute_on();
}
/* something more to decode ? */
if (count != len)
goto again;

11
ss5.h
View File

@ -7,7 +7,9 @@
** **
** ss5-port header file **
** **
\*****************************************************************************/
\*****************************************************************************/
#define SS5_DELAY_MUTE 50*8 /* time to wait until multing */
#define SS5_ENABLE 0x00000001 /* if ccitt5 is defined in interface.conf */
#define SS5_FEATURE_CONNECT 0x00000002 /* send connect to originator of the call */
@ -17,8 +19,9 @@
#define SS5_FEATURE_PULSEDIALING 0x00000020 /* outgoing exchange sends 2600 Hz pulses instead of mf tones */
#define SS5_FEATURE_DELAY 0x00000040 /* simulate round trip delay by delaying decoder output */
#define SS5_FEATURE_RELEASE 0x00000080 /* release if incomming exchange disconnets */
#define SS5_FEATURE_MUTE 0x00000100 /* mute audio path while 2600/2400 Hz tones are detected */
#define SS5_FEATURE_QUALITY 0x00000200 /* indicate quality of received digits */
#define SS5_FEATURE_MUTE_RX 0x00000100 /* mute audio path when 2600/2400 Hz tones are detected */
#define SS5_FEATURE_MUTE_TX 0x00000200 /* mute audio path when 2600/2400 Hz tones are detected and reply tones are transmitted */
#define SS5_FEATURE_QUALITY 0x00000400 /* indicate quality of received digits */
/* SS5 port classes */
class Pss5 : public PmISDN
@ -40,7 +43,7 @@ class Pss5 : public PmISDN
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 */
unsigned char p_m_s_delay_digits[3000/SS5_DECODER_NPOINTS]; /* delay buffer for received digits */
unsigned char p_m_s_delay_mute[400/SS5_DECODER_NPOINTS]; /* 40 ms delay on mute, so a 'chirp' can be heared */
unsigned char p_m_s_delay_mute[SS5_DELAY_MUTE/SS5_DECODER_NPOINTS]; /* delay before mute, so a 'chirp' can be heared */
int p_m_s_sample_nr; /* decoder's sample number, counter */
double p_m_s_quality_value; /* quality report */
int p_m_s_quality_count; /* quality report */