now gives warning if mISDN branch is wrong.
[lcr.git] / dss1.cpp
index e64ccce..7021860 100644 (file)
--- a/dss1.cpp
+++ b/dss1.cpp
@@ -25,8 +25,6 @@ extern "C" {
 #include <mISDNuser/net_l2.h>
 }
 
-//#define CENTREX
-
 #include "q931.h"
 #include "ie.cpp"
 
@@ -330,7 +328,7 @@ int Pdss1::received_first_reply_to_setup(unsigned long prim, int channel, int ex
 
 
 /*
- * hunt bchannel for incomming setup or retrieve or resume
+ * hunt bchannel for incoming setup or retrieve or resume
  */
 int Pdss1::hunt_bchannel(int channel, int exclusive)
 {
@@ -501,11 +499,9 @@ void Pdss1::setup_ind(unsigned long prim, unsigned long dinfo, void *data)
        dec_ie_calling_pn(setup->CALLING_PN, (Q931_info_t *)((unsigned long)data+headerlen), &calling_type, &calling_plan, &calling_present, &calling_screen, (unsigned char *)p_callerinfo.id, sizeof(p_callerinfo.id));
        dec_ie_called_pn(setup->CALLED_PN, (Q931_info_t *)((unsigned long)data+headerlen), &called_type, &called_plan, (unsigned char *)p_dialinginfo.id, sizeof(p_dialinginfo.id));
        dec_ie_keypad(setup->KEYPAD, (Q931_info_t *)((unsigned long)data+headerlen), (unsigned char *)keypad, sizeof(keypad));
-#ifdef CENTREX
        /* te-mode: CNIP (calling name identification presentation) */
        if (!p_m_d_ntmode)
                dec_facility_centrex(setup->FACILITY, (Q931_info_t *)((unsigned long)data+headerlen), (unsigned char *)p_callerinfo.name, sizeof(p_callerinfo.name));
-#endif
        dec_ie_useruser(setup->USER_USER, (Q931_info_t *)((unsigned long)data+headerlen), &useruser_protocol, useruser, &useruser_len);
        dec_ie_complete(setup->COMPLETE, (Q931_info_t *)((unsigned long)data+headerlen), &p_dialinginfo.sending_complete);
        dec_ie_redir_nr(setup->REDIR_NR, (Q931_info_t *)((unsigned long)data+headerlen), &redir_type, &redir_plan, &redir_present, &redir_screen, &redir_reason, (unsigned char *)p_redirinfo.id, sizeof(p_redirinfo.id));
@@ -738,7 +734,7 @@ void Pdss1::setup_ind(unsigned long prim, unsigned long dinfo, void *data)
                FATAL("Incoming call but already got an endpoint.\n");
        if (!(epoint = new Endpoint(p_serial, 0)))
                FATAL("No memory for Endpoint instance\n");
-       if (!(epoint->ep_app = new DEFAULT_ENDPOINT_APP(epoint, 0))) //incomming
+       if (!(epoint->ep_app = new DEFAULT_ENDPOINT_APP(epoint, 0))) //incoming
                FATAL("No memory for Endpoint Application instance\n");
        epointlist_new(epoint->ep_serial);
 
@@ -1016,11 +1012,9 @@ void Pdss1::connect_ind(unsigned long prim, unsigned long dinfo, void *data)
        l1l2l3_trace_header(p_m_mISDNport, this, prim, DIRECTION_IN);
        dec_ie_channel_id(connect->CHANNEL_ID, (Q931_info_t *)((unsigned long)data+headerlen), &exclusive, &channel);
        dec_ie_connected_pn(connect->CONNECT_PN, (Q931_info_t *)((unsigned long)data+headerlen), &type, &plan, &present, &screen, (unsigned char *)p_connectinfo.id, sizeof(p_connectinfo.id));
-#ifdef CENTREX
        /* te-mode: CONP (connected name identification presentation) */
        if (!p_m_d_ntmode)
                dec_facility_centrex(connect->FACILITY, (Q931_info_t *)((unsigned long)data+headerlen), (unsigned char *)p_connectinfo.name, sizeof(p_connectinfo.name));
-#endif
        end_trace();
 
        /* select channel */
@@ -1926,45 +1920,43 @@ void Pdss1::new_state(int state)
        class Endpoint *epoint;
 
        /* set timeout */
-       epoint = find_epoint_id(ACTIVE_EPOINT(p_epointlist));
-       if (epoint && p_m_d_ntmode)
+       if (state == PORT_STATE_IN_OVERLAP)
+       {
+               p_m_timeout = p_m_mISDNport->ifport->tout_dialing;
+               time(&p_m_timer);
+       }
+       if (state != p_state)
        {
-               if (state == PORT_STATE_IN_OVERLAP)
+               if (state == PORT_STATE_IN_SETUP
+                || state == PORT_STATE_OUT_SETUP
+                || state == PORT_STATE_IN_OVERLAP
+                || state == PORT_STATE_OUT_OVERLAP)
                {
-                       p_m_timeout = p_settings.tout_dialing;
+                       p_m_timeout = p_m_mISDNport->ifport->tout_setup;
                        time(&p_m_timer);
                }
-               if (state != p_state)
+               if (state == PORT_STATE_IN_PROCEEDING
+                || state == PORT_STATE_OUT_PROCEEDING)
                {
-                       if (state == PORT_STATE_IN_SETUP
-                        || state == PORT_STATE_IN_OVERLAP)
-                       {
-                               p_m_timeout = p_settings.tout_setup;
-                               time(&p_m_timer);
-                       }
-                       if (state == PORT_STATE_IN_PROCEEDING
-                        || state == PORT_STATE_OUT_PROCEEDING)
-                       {
-                               p_m_timeout = p_settings.tout_proceeding;
-                               time(&p_m_timer);
-                       }
-                       if (state == PORT_STATE_IN_ALERTING
-                        || state == PORT_STATE_OUT_ALERTING)
-                       {
-                               p_m_timeout = p_settings.tout_alerting;
-                               time(&p_m_timer);
-                       }
-                       if (state == PORT_STATE_CONNECT
-                        || state == PORT_STATE_CONNECT_WAITING)
-                       {
-                               p_m_timeout = 0;
-                       }
-                       if (state == PORT_STATE_IN_DISCONNECT
-                        || state == PORT_STATE_OUT_DISCONNECT)
-                       {
-                               p_m_timeout = p_settings.tout_disconnect;
-                               time(&p_m_timer);
-                       }
+                       p_m_timeout = p_m_mISDNport->ifport->tout_proceeding;
+                       time(&p_m_timer);
+               }
+               if (state == PORT_STATE_IN_ALERTING
+                || state == PORT_STATE_OUT_ALERTING)
+               {
+                       p_m_timeout = p_m_mISDNport->ifport->tout_alerting;
+                       time(&p_m_timer);
+               }
+               if (state == PORT_STATE_CONNECT
+                || state == PORT_STATE_CONNECT_WAITING)
+               {
+                       p_m_timeout = 0;
+               }
+               if (state == PORT_STATE_IN_DISCONNECT
+                || state == PORT_STATE_OUT_DISCONNECT)
+               {
+                       p_m_timeout = p_m_mISDNport->ifport->tout_disconnect;
+                       time(&p_m_timer);
                }
        }
        
@@ -2312,11 +2304,9 @@ void Pdss1::message_setup(unsigned long epoint_id, int message_id, union paramet
        /* display */
        if (p_callerinfo.display[0] && p_m_d_ntmode)
                enc_ie_display(&setup->DISPLAY, dmsg, (unsigned char *)p_callerinfo.display);
-#ifdef CENTREX
        /* nt-mode: CNIP (calling name identification presentation) */
-       if (p_callerinfo.name[0] && p_m_d_ntmode)
-               enc_facility_centrex(&setup->FACILITY, dmsg, (unsigned char *)p_callerinfo.name, 1);
-#endif
+//     if (p_callerinfo.name[0] && p_m_d_ntmode)
+//             enc_facility_centrex(&setup->FACILITY, dmsg, (unsigned char *)p_callerinfo.name, 1);
        end_trace();
 
        /* send setup message now */
@@ -2652,11 +2642,9 @@ void Pdss1::message_connect(unsigned long epoint_id, int message_id, union param
        /* display */
        if (p_connectinfo.display[0] && p_m_d_ntmode)
                enc_ie_display(&connect->DISPLAY, dmsg, (unsigned char *)p_connectinfo.display);
-#ifdef CENTREX
        /* nt-mode: CONP (connected name identification presentation) */
-       if (p_connectinfo.name[0] && p_m_d_ntmode)
-               enc_facility_centrex(&connect->FACILITY, dmsg, (unsigned char *)p_connectinfo.name, 0);
-#endif
+//     if (p_connectinfo.name[0] && p_m_d_ntmode)
+//             enc_facility_centrex(&connect->FACILITY, dmsg, (unsigned char *)p_connectinfo.name, 0);
        /* date & time */
        if (p_m_d_ntmode)
        {
@@ -2766,10 +2754,11 @@ void Pdss1::message_release(unsigned long epoint_id, int message_id, union param
        char *p = NULL;
 
        /*
-        * we may only release during incomming disconnect state.
+        * we may only release during incoming disconnect state.
         * this means that the endpoint doesnt require audio anymore
         */
-       if (p_state == PORT_STATE_IN_DISCONNECT)
+       if (p_state == PORT_STATE_IN_DISCONNECT
+        || p_state == PORT_STATE_OUT_DISCONNECT)
        {
                /* sending release */
                dmsg = create_l3msg(CC_RELEASE | REQUEST, MT_RELEASE, p_m_d_l3id, sizeof(RELEASE_t), p_m_d_ntmode);
@@ -3272,7 +3261,7 @@ int stack2manager_te(struct mISDNport *mISDNport, msg_t *msg)
 
        if (frm->prim == (CC_RELEASE_CR | INDICATION))
        {
-               PERROR("unhandled message from stack: call ref released (l3id=0x%x)\n", frm->dinfo);
+               PDEBUG(DEBUG_ISDN, "unhandled message from stack: call ref released (l3id=0x%x)\n", frm->dinfo);
                free_msg(msg);
                return(0);
        }