Merge branch 'master' of ssh://jolly@www.mISDN.org/var/git/lcr
[lcr.git] / ss5.cpp
diff --git a/ss5.cpp b/ss5.cpp
index d038769..164ef0c 100644 (file)
--- a/ss5.cpp
+++ b/ss5.cpp
@@ -35,6 +35,8 @@
 
 #include "main.h"
 
+//#define DEBUG_DETECT
+
 /* ss5 signal states */
 enum {
        SS5_STATE_IDLE,                 /* no signal */
@@ -225,13 +227,13 @@ static void ss5_trace_header(struct mISDNport *mISDNport, class PmISDN *port, un
 
 
 /*
- * changes release tone int busy signal
- * this makes the line more authentic
+ * changes release tone into silence
+ * this makes the line sound more authentic
  */
 void Pss5::set_tone(const char *dir, const char *name)
 {
        if (name && !strcmp(name, "cause_10"))
-               name = "busy";
+               name = NULL;
 
        PmISDN::set_tone(dir, name);
 }
@@ -504,7 +506,6 @@ void Pss5::inband_receive(unsigned char *buffer, int len)
                        PDEBUG(DEBUG_SS5, "%s: received clear-forward in idle state, waiting for recognition\n", p_name);
                        break;
                }
-               new_state(PORT_STATE_RELEASE);
                new_ss5_state(SS5_STATE_RELEASE_GUARD);
                new_ss5_signal(SS5_SIGNAL_RECEIVE_RECOG);
                p_m_s_recog = 0;
@@ -795,6 +796,7 @@ void Pss5::inband_receive(unsigned char *buffer, int len)
                                PDEBUG(DEBUG_SS5, "%s: incomming release-guard is recognized, responding...\n", p_name);
                        else
                                PDEBUG(DEBUG_SS5, "%s: incomming clear-forward is recognized, responding...\n", p_name);
+                       new_state(PORT_STATE_RELEASE);
                        new_ss5_signal(SS5_SIGNAL_RECEIVE);
                        p_m_s_sample_nr = 0;
                        inband_send_on();
@@ -1264,6 +1266,7 @@ void Pss5::seizing_ind(void)
        end_trace();
 
        new_state(PORT_STATE_IN_SETUP);
+       set_tone("", "noise");
 }
 
 void Pss5::digit_ind(char digit)
@@ -1344,7 +1347,7 @@ void Pss5::digit_ind(char digit)
        end_trace();
        new_ss5_state(SS5_STATE_IDLE);
 
-       do_setup(dial);
+       do_setup(dial, 1);
        new_state(PORT_STATE_IN_PROCEEDING);
 }
 
@@ -1389,7 +1392,7 @@ void Pss5::pulse_ind(int on)
                        }
                        if (p_state == PORT_STATE_IN_SETUP) {
                                /* sending digit as setup */
-                               do_setup(dial); /* include 'a' == KP1 */
+                               do_setup(dial, 0); /* include 'a' == KP1 */
                                new_state(PORT_STATE_IN_OVERLAP);
                        } else {
                                /* sending digit as information */
@@ -1615,13 +1618,13 @@ void Pss5::do_release(int cause, int location)
 /*
  * create endpoint and send setup
  */
-void Pss5::do_setup(char *dial)
+void Pss5::do_setup(char *dial, int complete)
 {
        class Endpoint *epoint;
        struct lcr_msg *message;
 
        SCPY(p_dialinginfo.id, dial);
-       p_dialinginfo.sending_complete = 1;
+       p_dialinginfo.sending_complete = complete;
        p_callerinfo.present = INFO_PRESENT_NOTAVAIL;
        p_callerinfo.screen = INFO_SCREEN_NETWORK;
        p_callerinfo.ntype = INFO_NTYPE_NOTPRESENT;