moved timeout settings from extenion to interface.conf
[lcr.git] / dss1.cpp
index cd6a41e..82b09bb 100644 (file)
--- a/dss1.cpp
+++ b/dss1.cpp
@@ -353,9 +353,9 @@ int Pdss1::hunt_bchannel(int channel, int exclusive)
        }
        if (channel <= 0) /* not given, no channel, whatever.. */
                channel = CHANNEL_ANY; /* any channel */
+       add_trace("channel", "reserved", "%d", p_m_mISDNport->b_reserved);
        if (p_m_mISDNport->b_reserved >= p_m_mISDNport->b_num) // of out chan..
        {
-               add_trace("channel", "reserved", "%d", p_m_mISDNport->b_reserved);
                add_trace("conclusion", NULL, "all channels are reserved");
                end_trace();
                return(-34); // no channel
@@ -738,7 +738,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)))
+       if (!(epoint->ep_app = new DEFAULT_ENDPOINT_APP(epoint, 0))) //incomming
                FATAL("No memory for Endpoint Application instance\n");
        epointlist_new(epoint->ep_serial);
 
@@ -1877,8 +1877,8 @@ void Pdss1::message_isdn(unsigned long prim, unsigned long dinfo, void *data)
                }
                p_m_d_l3id = 0;
                p_m_delete = 1;
-#warning remove me
-PDEBUG(DEBUG_LOG, "JOLLY release cr %d\n", p_serial);
+//#warning remove me
+//PDEBUG(DEBUG_LOG, "JOLLY release cr %d\n", p_serial);
                /* sending release to endpoint in case we still have an endpoint
                 * this is because we don't get any response if a release_complete is received (or a release in release state)
                 */
@@ -1926,45 +1926,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)
        {
-               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_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);
                }
        }
        
@@ -1987,8 +1985,8 @@ int Pdss1::handler(void)
        /* handle destruction */
        if (p_m_delete && p_m_d_l3id==0)
        {
-#warning remove 
-PDEBUG(DEBUG_LOG, "JOLLY destroy object %d\n", p_serial);
+//#warning remove 
+//PDEBUG(DEBUG_LOG, "JOLLY destroy object %d\n", p_serial);
 
                delete this;
                return(-1);
@@ -2056,6 +2054,8 @@ void Pdss1::message_setup(unsigned long epoint_id, int message_id, union paramet
        memcpy(&p_capainfo, &param->setup.capainfo, sizeof(p_capainfo));
        memcpy(&p_redirinfo, &param->setup.redirinfo, sizeof(p_redirinfo));
 //             SCPY(&p_m_tones_dir, param->setup.ext.tones_dir);
+       /* screen outgoing caller id */
+       do_screen(1, p_callerinfo.id, sizeof(p_callerinfo.id), &p_callerinfo.ntype, &p_callerinfo.present, p_m_mISDNport->ifport->interface);
 
        /* only display at connect state: this case happens if endpoint is in connected mode */
        if (p_state==PORT_STATE_CONNECT)
@@ -2573,6 +2573,8 @@ void Pdss1::message_connect(unsigned long epoint_id, int message_id, union param
 
        /* copy connected information */
        memcpy(&p_connectinfo, &param->connectinfo, sizeof(p_connectinfo));
+       /* screen outgoing caller id */
+       do_screen(1, p_connectinfo.id, sizeof(p_connectinfo.id), &p_connectinfo.ntype, &p_connectinfo.present, p_m_mISDNport->ifport->interface);
 
        /* only display at connect state */
        if (p_state == PORT_STATE_CONNECT)
@@ -2765,7 +2767,8 @@ void Pdss1::message_release(unsigned long epoint_id, int message_id, union param
         * we may only release during incomming 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);
@@ -2791,8 +2794,8 @@ void Pdss1::message_release(unsigned long epoint_id, int message_id, union param
 // // NOTE: a bug in mISDNuser (see disconnect_req_out !!!)
 //      || p_state==PORT_STATE_OUT_DISCO)
        {
-#warning remove me
-PDEBUG(DEBUG_LOG, "JOLLY sending release complete %d\n", p_serial);
+//#warning remove me
+//PDEBUG(DEBUG_LOG, "JOLLY sending release complete %d\n", p_serial);
                /* sending release complete */
                dmsg = create_l3msg(CC_RELEASE_COMPLETE | REQUEST, MT_RELEASE_COMPLETE, p_m_d_l3id, sizeof(RELEASE_COMPLETE_t), p_m_d_ntmode);
                release_complete = (RELEASE_COMPLETE_t *)(dmsg->data + headerlen);
@@ -2868,8 +2871,8 @@ wirklich erst proceeding?:
        /* remove epoint */
        free_epointid(epoint_id);
        // wait for release and callref to be released
-#warning remove me
-PDEBUG(DEBUG_LOG, "JOLLY sending disconnect %d\n", p_serial);
+//#warning remove me
+//PDEBUG(DEBUG_LOG, "JOLLY sending disconnect %d\n", p_serial);
 }
 
 
@@ -3159,8 +3162,8 @@ int stack2manager_nt(void *dat, void *arg)
                        time(&mISDNport->l2establish);
                        PDEBUG(DEBUG_ISDN, "because we are ptp, we set a l2establish timer.\n");
                }
-#warning debugging usleep crash
-               printf("JOLLY release port %d\n", mISDNport->portnum);
+//#warning debugging usleep crash
+//             printf("JOLLY release port %d\n", mISDNport->portnum);
                usleep(1);
                break;
 
@@ -3188,6 +3191,9 @@ int stack2manager_nt(void *dat, void *arg)
                case CC_RELEASE_COMPLETE | INDICATION:
                break;
 
+               case CC_FACILITY | INDICATION:
+               break;
+
                default:
                PERROR("unhandled message: prim(0x%x) dinfo(0x%x) msg->len(%d)\n", hh->prim, hh->dinfo, msg->len);
                port = port_first;