1 /*****************************************************************************\
5 **---------------------------------------------------------------------------**
6 ** Copyright: Andreas Eversberg **
8 ** ss5-port header file **
10 \*****************************************************************************/
12 #define SS5_DELAY_MUTE 50*8 /* time to wait until multing */
14 #define SS5_ENABLE 0x00000001 /* if ccitt5 is defined in interface.conf */
15 #define SS5_FEATURE_CONNECT 0x00000002 /* send connect to originator of the call */
16 #define SS5_FEATURE_NODISCONNECT 0x00000004 /* do not send disconnect to originator of call */
17 #define SS5_FEATURE_RELEASEGUARDTIMER 0x00000008 /* prevent blueboxing by forcing long duration of releas guard signal */
18 #define SS5_FEATURE_BELL 0x00000010 /* allow breaking and pulse dialing using 2600 Hz */
19 #define SS5_FEATURE_PULSEDIALING 0x00000020 /* outgoing exchange sends 2600 Hz pulses instead of mf tones */
20 #define SS5_FEATURE_DELAY 0x00000040 /* simulate round trip delay by delaying decoder output */
21 #define SS5_FEATURE_RELEASE 0x00000080 /* release if incomming exchange disconnets */
22 #define SS5_FEATURE_MUTE_RX 0x00000100 /* mute audio path when 2600/2400 Hz tones are detected */
23 #define SS5_FEATURE_MUTE_TX 0x00000200 /* mute audio path when 2600/2400 Hz tones are detected and reply tones are transmitted */
24 #define SS5_FEATURE_QUALITY 0x00000400 /* indicate quality of received digits */
26 /* SS5 port classes */
27 class Pss5 : public PmISDN
30 Pss5(int type, struct mISDNport *mISDNport, char *portname, struct port_settings *settings, struct interface *interface, int channel, int exclusive, int mode);
32 int message_epoint(unsigned int epoint_id, int message, union parameter *param);
33 void set_tone(const char *dir, const char *name);
35 int p_m_s_state; /* current signalling state */
36 int p_m_s_signal; /* current state of current signal */
37 char p_m_s_dial[64]; /* current dialing register */
38 int p_m_s_digit_i; /* current digit of register counter */
39 int p_m_s_pulsecount; /* counts pule dialing half cycles */
40 char p_m_s_last_digit; /* stores last digit that was detected, to fill short signal losses */
41 char p_m_s_last_digit_used; /* stores last digit that was used, to ignore short changes of signal due to noise */
42 int p_m_s_signal_loss; /* sample counter for loss of signal check */
43 int p_m_s_decoder_count; /* samples currently decoded */
44 unsigned char p_m_s_decoder_buffer[SS5_DECODER_NPOINTS]; /* buffer for storing one goertzel window */
45 unsigned char p_m_s_delay_digits[3000/SS5_DECODER_NPOINTS]; /* delay buffer for received digits */
46 unsigned char p_m_s_delay_mute[SS5_DELAY_MUTE/SS5_DECODER_NPOINTS]; /* delay before mute, so a 'chirp' can be heared */
47 int p_m_s_sample_nr; /* decoder's sample number, counter */
48 double p_m_s_quality_value; /* quality report */
49 int p_m_s_quality_count; /* quality report */
50 int p_m_s_recog; /* sample counter to wait for signal recognition time */
51 struct lcr_work p_m_s_queue;
52 int p_m_s_queued_signal; /* queued signal */
53 struct lcr_timer p_m_s_timer; /* dialing timeout */
55 void new_state(int state); /* set new state */
56 void _new_ss5_state(int state, const char *func, int line);
57 void _new_ss5_signal(int signal, const char *func, int line);
58 void inband_receive(unsigned char *buffer, int len);
59 int inband_send(unsigned char *buffer, int len);
60 int inband_dial_mf(unsigned char *buffer, int len, int count);
61 int inband_dial_pulse(unsigned char *buffer, int len, int count);
62 void start_signal(int);
63 void start_outgoing(void);
64 void do_release(int cause, int location, int signal);
65 void do_setup(char *digit, int complete);
67 void seizing_ind(void);
68 void digit_ind(char digit);
69 void pulse_ind(int on);
70 void proceed_to_send_ind(void);
71 void busy_flash_ind(void);
72 void answer_ind(void);
73 void forward_ind(void);
74 void clear_back_ind(void);
75 void clear_forward_ind(void);
76 void release_guard_ind(void);
77 void double_seizure_ind(void);
78 void forward_transfer_ind(void);
79 void message_setup(unsigned int epoint_id, int message_id, union parameter *param);
80 void message_connect(unsigned int epoint_id, int message_id, union parameter *param);
81 void message_disconnect(unsigned int epoint_id, int message_id, union parameter *param);
82 void message_release(unsigned int epoint_id, int message_id, union parameter *param);
84 void register_timeout(void);
85 void process_queue(void);
89 #define new_ss5_state(a) _new_ss5_state(a, __FUNCTION__, __LINE__)
90 #define new_ss5_signal(a) _new_ss5_signal(a, __FUNCTION__, __LINE__)
92 void ss5_create_channel(struct mISDNport *mISDNport, int i);
93 class Pss5 *ss5_hunt_line(struct mISDNport *mISDNport);