Added processing of second caller id.
[lcr.git] / dss1.cpp
index 06bb203..3b14332 100644 (file)
--- a/dss1.cpp
+++ b/dss1.cpp
@@ -23,10 +23,11 @@ extern unsigned int mt_assign_pid;
 /*
  * constructor
  */
-Pdss1::Pdss1(int type, struct mISDNport *mISDNport, char *portname, struct port_settings *settings, int channel, int exclusive) : PmISDN(type, mISDNport, portname, settings, channel, exclusive)
+Pdss1::Pdss1(int type, struct mISDNport *mISDNport, char *portname, struct port_settings *settings, int channel, int exclusive, int mode) : PmISDN(type, mISDNport, portname, settings, channel, exclusive, mode)
 {
        p_callerinfo.itype = (mISDNport->ifport->interface->extension)?INFO_ITYPE_ISDN_EXTENSION:INFO_ITYPE_ISDN;
        p_m_d_ntmode = mISDNport->ntmode;
+       p_m_d_tespecial = mISDNport->tespecial;
        p_m_d_l3id = 0;
        p_m_d_ces = -1;
        p_m_d_queue = NULL;
@@ -34,7 +35,7 @@ Pdss1::Pdss1(int type, struct mISDNport *mISDNport, char *portname, struct port_
        p_m_d_collect_cause = 0;
        p_m_d_collect_location = 0;
 
-       PDEBUG(DEBUG_ISDN, "Created new mISDNPort(%s). Currently %d objects use, %s port #%d\n", portname, mISDNport->use, (mISDNport->ntmode)?"NT":"TE", p_m_portnum);
+       PDEBUG(DEBUG_ISDN, "Created new mISDNPort(%s). Currently %d objects use, %s%s port #%d\n", portname, mISDNport->use, (mISDNport->ntmode)?"NT":"TE", (mISDNport->tespecial)?" (special)":"", p_m_portnum);
 }
 
 
@@ -427,6 +428,7 @@ use_channel:
 void Pdss1::setup_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3m)
 {
        int calling_type, calling_plan, calling_present, calling_screen;
+       int calling_type2, calling_plan2, calling_present2, calling_screen2;
        int called_type, called_plan;
        int redir_type, redir_plan, redir_present, redir_screen, redir_reason;
        int hlc_coding, hlc_presentation, hlc_interpretation, hlc_hlc, hlc_exthlc;
@@ -462,12 +464,11 @@ void Pdss1::setup_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3m)
        end_trace();
 
        l1l2l3_trace_header(p_m_mISDNport, this, L3_SETUP_IND, DIRECTION_IN);
-       dec_ie_calling_pn(l3m, &calling_type, &calling_plan, &calling_present, &calling_screen, (unsigned char *)p_callerinfo.id, sizeof(p_callerinfo.id));
+       dec_ie_calling_pn(l3m, &calling_type, &calling_plan, &calling_present, &calling_screen, (unsigned char *)p_callerinfo.id, sizeof(p_callerinfo.id), &calling_type2, &calling_plan2, &calling_present2, &calling_screen2, (unsigned char *)p_callerinfo.id2, sizeof(p_callerinfo.id2));
        dec_ie_called_pn(l3m, &called_type, &called_plan, (unsigned char *)p_dialinginfo.id, sizeof(p_dialinginfo.id));
        dec_ie_keypad(l3m, (unsigned char *)keypad, sizeof(keypad));
        /* te-mode: CNIP (calling name identification presentation) */
-       if (!p_m_d_ntmode)
-               dec_facility_centrex(l3m, (unsigned char *)p_callerinfo.name, sizeof(p_callerinfo.name));
+       dec_facility_centrex(l3m, (unsigned char *)p_callerinfo.name, sizeof(p_callerinfo.name));
        dec_ie_useruser(l3m, &useruser_protocol, useruser, &useruser_len);
        dec_ie_complete(l3m, &p_dialinginfo.sending_complete);
        dec_ie_redir_nr(l3m, &redir_type, &redir_plan, &redir_present, &redir_screen, &redir_reason, (unsigned char *)p_redirinfo.id, sizeof(p_redirinfo.id));
@@ -516,9 +517,10 @@ void Pdss1::setup_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3m)
        switch (calling_type)
        {
                case -1:
+               p_callerinfo.ntype = INFO_NTYPE_NOTPRESENT;
+               break;
+               case 0x0:
                p_callerinfo.ntype = INFO_NTYPE_UNKNOWN;
-               p_callerinfo.present = INFO_PRESENT_NOTAVAIL;
-               p_callerinfo.screen = INFO_SCREEN_NETWORK;
                break;
                case 0x1:
                p_callerinfo.ntype = INFO_NTYPE_INTERNATIONAL;
@@ -536,6 +538,50 @@ void Pdss1::setup_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3m)
        p_callerinfo.isdn_port = p_m_portnum;
        SCPY(p_callerinfo.interface, p_m_mISDNport->ifport->interface->name);
 
+       /* caller info2 */
+       switch (calling_present2)
+       {
+               case 1:
+               p_callerinfo.present2 = INFO_PRESENT_RESTRICTED;
+               break;
+               case 2:
+               p_callerinfo.present2 = INFO_PRESENT_NOTAVAIL;
+               break;
+               default:
+               p_callerinfo.present2 = INFO_PRESENT_ALLOWED;
+               break;
+       }
+       switch (calling_screen2)
+       {
+               case 0:
+               p_callerinfo.screen2 = INFO_SCREEN_USER;
+               break;
+               default:
+               p_callerinfo.screen2 = INFO_SCREEN_NETWORK;
+               break;
+       }
+       switch (calling_type2)
+       {
+               case -1:
+               p_callerinfo.ntype2 = INFO_NTYPE_NOTPRESENT;
+               break;
+               case 0x0:
+               p_callerinfo.ntype2 = INFO_NTYPE_UNKNOWN;
+               break;
+               case 0x1:
+               p_callerinfo.ntype2 = INFO_NTYPE_INTERNATIONAL;
+               break;
+               case 0x2:
+               p_callerinfo.ntype2 = INFO_NTYPE_NATIONAL;
+               break;
+               case 0x4:
+               p_callerinfo.ntype2 = INFO_NTYPE_SUBSCRIBER;
+               break;
+               default:
+               p_callerinfo.ntype2 = INFO_NTYPE_UNKNOWN;
+               break;
+       }
+
        /* dialing information */
        SCAT(p_dialinginfo.id, (char *)keypad);
        switch (called_type)
@@ -600,9 +646,10 @@ void Pdss1::setup_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3m)
        switch (redir_type)
        {
                case -1:
+               p_redirinfo.ntype = INFO_NTYPE_NOTPRESENT;
+               break;
+               case 0x0:
                p_redirinfo.ntype = INFO_NTYPE_UNKNOWN;
-               p_redirinfo.present = INFO_PRESENT_NULL; /* not redirecting */
-               p_redirinfo.reason = INFO_REDIR_UNKNOWN;
                break;
                case 0x1:
                p_redirinfo.ntype = INFO_NTYPE_INTERNATIONAL;
@@ -669,6 +716,15 @@ void Pdss1::setup_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3m)
                break;
        }
 
+       /* set bchannel mode */
+       if (p_capainfo.bearer_capa==INFO_BC_DATAUNRESTRICTED
+        || p_capainfo.bearer_capa==INFO_BC_DATARESTRICTED
+        || p_capainfo.bearer_capa==INFO_BC_VIDEO)
+               p_capainfo.source_mode = B_MODE_HDLC;
+       else
+               p_capainfo.source_mode = B_MODE_TRANSPARENT;
+       p_m_b_mode = p_capainfo.source_mode;
+
        /* hunt channel */
        ret = channel = hunt_bchannel(channel, exclusive);
        if (ret < 0)
@@ -850,8 +906,7 @@ void Pdss1::proceeding_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3
                switch (type)
                {
                        case -1:
-                       message->param.notifyinfo.ntype = INFO_NTYPE_UNKNOWN;
-                       message->param.notifyinfo.present = INFO_PRESENT_NULL;
+                       message->param.notifyinfo.ntype = INFO_NTYPE_NOTPRESENT;
                        break;
                        case 1:
                        message->param.notifyinfo.ntype = INFO_NTYPE_INTERNATIONAL;
@@ -931,8 +986,7 @@ void Pdss1::alerting_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3m)
                switch (type)
                {
                        case -1:
-                       message->param.notifyinfo.ntype = INFO_NTYPE_UNKNOWN;
-                       message->param.notifyinfo.present = INFO_PRESENT_NULL;
+                       message->param.notifyinfo.ntype = INFO_NTYPE_NOTPRESENT;
                        break;
                        case 1:
                        message->param.notifyinfo.ntype = INFO_NTYPE_INTERNATIONAL;
@@ -966,8 +1020,7 @@ void Pdss1::connect_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3m)
        dec_ie_connected_pn(l3m, &type, &plan, &present, &screen, (unsigned char *)p_connectinfo.id, sizeof(p_connectinfo.id));
        dec_ie_display(l3m, (unsigned char *)p_connectinfo.display, sizeof(p_connectinfo.display));
        /* te-mode: CONP (connected name identification presentation) */
-       if (!p_m_d_ntmode)
-               dec_facility_centrex(l3m, (unsigned char *)p_connectinfo.name, sizeof(p_connectinfo.name));
+       dec_facility_centrex(l3m, (unsigned char *)p_connectinfo.name, sizeof(p_connectinfo.name));
        end_trace();
 
        /* select channel */
@@ -1008,9 +1061,8 @@ void Pdss1::connect_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3m)
        }
        switch (type)
        {
-               case 0x0:
-               p_connectinfo.present = INFO_PRESENT_NULL; /* no COLP info */
-               p_connectinfo.ntype = INFO_NTYPE_UNKNOWN;
+               case -1:
+               p_connectinfo.ntype = INFO_NTYPE_NOTPRESENT;
                break;
                case 0x1:
                p_connectinfo.ntype = INFO_NTYPE_INTERNATIONAL;
@@ -1272,8 +1324,7 @@ void Pdss1::notify_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3m)
        switch (type)
        {
                case -1:
-               message->param.notifyinfo.ntype = INFO_NTYPE_UNKNOWN;
-               message->param.notifyinfo.present = INFO_PRESENT_NULL;
+               message->param.notifyinfo.ntype = INFO_NTYPE_NOTPRESENT;
                break;
                case 1:
                message->param.notifyinfo.ntype = INFO_NTYPE_INTERNATIONAL;
@@ -1535,6 +1586,7 @@ void Pdss1::resume_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3m)
        if (ret < 0)
                goto no_channel;
 
+// mode (if hdlc parked) to be done. never mind, this is almost never requested
        /* open channel */
        ret = seize_bchannel(channel, 1);
        if (ret < 0)
@@ -1881,7 +1933,7 @@ void Pdss1::message_information(unsigned int epoint_id, int message_id, union pa
                l3m = create_l3msg();
                l1l2l3_trace_header(p_m_mISDNport, this, L3_INFORMATION_REQ, DIRECTION_OUT);
                enc_ie_called_pn(l3m, 0, 1, (unsigned char *)param->information.id);
-               if (p_m_d_ntmode)
+               if (p_m_d_ntmode || p_m_d_tespecial)
                        enc_ie_display(l3m, (unsigned char *)param->information.display);
                end_trace();
                p_m_mISDNport->ml3->to_layer3(p_m_mISDNport->ml3, MT_INFORMATION, p_m_d_l3id, l3m);
@@ -1898,6 +1950,7 @@ void Pdss1::message_setup(unsigned int epoint_id, int message_id, union paramete
        l3_msg *l3m;
        int ret;
        int plan, type, screen, present, reason;
+       int plan2, type2, screen2, present2;
        int capability, mode, rate, coding, user, presentation, interpretation, hlc, exthlc;
        int channel, exclusive;
        struct epoint_list *epointlist;
@@ -1924,6 +1977,7 @@ void Pdss1::message_setup(unsigned int epoint_id, int message_id, union paramete
 //             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);
+       do_screen(1, p_callerinfo.id2, sizeof(p_callerinfo.id2), &p_callerinfo.ntype2, &p_callerinfo.present2, 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)
@@ -1936,7 +1990,7 @@ void Pdss1::message_setup(unsigned int epoint_id, int message_id, union paramete
                        /* sending information */
                        l3m = create_l3msg();
                        l1l2l3_trace_header(p_m_mISDNport, this, L3_INFORMATION_REQ, DIRECTION_OUT);
-                       if (p_m_d_ntmode)
+                       if (p_m_d_ntmode || p_m_d_tespecial)
                                enc_ie_display(l3m, (unsigned char *)p_callerinfo.display);
                        end_trace();
                        p_m_mISDNport->ml3->to_layer3(p_m_mISDNport->ml3, MT_INFORMATION, p_m_d_l3id, l3m);
@@ -2003,6 +2057,9 @@ void Pdss1::message_setup(unsigned int epoint_id, int message_id, union paramete
        plan = 1;
        switch (p_callerinfo.ntype)
        {
+               case INFO_NTYPE_UNKNOWN:
+               type = 0x0;
+               break;
                case INFO_NTYPE_INTERNATIONAL:
                type = 0x1;
                break;
@@ -2012,8 +2069,8 @@ void Pdss1::message_setup(unsigned int epoint_id, int message_id, union paramete
                case INFO_NTYPE_SUBSCRIBER:
                type = 0x4;
                break;
-               default: /* INFO_NTYPE_UNKNOWN */
-               type = 0x0;
+               default: /* INFO_NTYPE_NOTPRESENT */
+               type = -1;
                break;
        }
        switch (p_callerinfo.screen)
@@ -2027,18 +2084,59 @@ void Pdss1::message_setup(unsigned int epoint_id, int message_id, union paramete
        }
        switch (p_callerinfo.present)
        {
+               case INFO_PRESENT_ALLOWED:
+               present = 0;
+               break;
                case INFO_PRESENT_RESTRICTED:
                present = 1;
                break;
-               case INFO_PRESENT_NOTAVAIL:
+               default: /* INFO_PRESENT_NOTAVAIL */
                present = 2;
                break;
-               default: /* INFO_PRESENT_ALLOWED */
-               present = 0;
+       }
+       /* caller information 2 */
+       plan2 = 1;
+       switch (p_callerinfo.ntype2)
+       {
+               case INFO_NTYPE_UNKNOWN:
+               type2 = 0x0;
+               break;
+               case INFO_NTYPE_INTERNATIONAL:
+               type2 = 0x1;
+               break;
+               case INFO_NTYPE_NATIONAL:
+               type2 = 0x2;
+               break;
+               case INFO_NTYPE_SUBSCRIBER:
+               type2 = 0x4;
+               break;
+               default: /* INFO_NTYPE_NOTPRESENT */
+               type2 = -1;
+               break;
+       }
+       switch (p_callerinfo.screen2)
+       {
+               case INFO_SCREEN_USER:
+               screen2 = 0;
+               break;
+               default: /* INFO_SCREEN_NETWORK */
+               screen2 = 3;
+               break;
+       }
+       switch (p_callerinfo.present2)
+       {
+               case INFO_PRESENT_ALLOWED:
+               present2 = 0;
+               break;
+               case INFO_PRESENT_RESTRICTED:
+               present2 = 1;
+               break;
+               default: /* INFO_PRESENT_NOTAVAIL */
+               present2 = 2;
                break;
        }
        if (type >= 0)
-               enc_ie_calling_pn(l3m, type, plan, present, screen, (unsigned char *)p_callerinfo.id);
+               enc_ie_calling_pn(l3m, type, plan, present, screen, (unsigned char *)p_callerinfo.id, type2, plan2, present2, screen2, (unsigned char *)p_callerinfo.id2);
        /* dialing information */
        if (p_dialinginfo.id[0]) /* only if we have something to dial */
        {
@@ -2056,6 +2154,9 @@ void Pdss1::message_setup(unsigned int epoint_id, int message_id, union paramete
        plan = 1;
        switch (p_redirinfo.ntype)
        {
+               case INFO_NTYPE_UNKNOWN:
+               type = 0x0;
+               break;
                case INFO_NTYPE_INTERNATIONAL:
                type = 0x1;
                break;
@@ -2065,8 +2166,8 @@ void Pdss1::message_setup(unsigned int epoint_id, int message_id, union paramete
                case INFO_NTYPE_SUBSCRIBER:
                type = 0x4;
                break;
-               default: /* INFO_NTYPE_UNKNOWN */
-               type = 0x0;
+               default: /* INFO_NTYPE_NOTPRESENT */
+               type = -1;
                break;
        }
        switch (p_redirinfo.screen)
@@ -2101,25 +2202,18 @@ void Pdss1::message_setup(unsigned int epoint_id, int message_id, union paramete
        }
        switch (p_redirinfo.present)
        {
-               case INFO_PRESENT_NULL: /* no redir at all */
-               present = -1;
-               screen = -1;
-               reason = -1;
-               plan = -1;
-               type = -1;
+               case INFO_PRESENT_ALLOWED:
+               present = 0;
                break;
                case INFO_PRESENT_RESTRICTED:
                present = 1;
                break;
-               case INFO_PRESENT_NOTAVAIL:
+               default: /* INFO_PRESENT_NOTAVAIL */
                present = 2;
                break;
-               default: /* INFO_PRESENT_ALLOWED */
-               present = 0;
-               break;
        }
        /* sending redirecting number only in ntmode */
-       if (type >= 0 && p_m_d_ntmode)
+       if (type >= 0 && (p_m_d_ntmode || p_m_d_tespecial))
                enc_ie_redir_nr(l3m, type, plan, present, screen, reason, (unsigned char *)p_redirinfo.id);
        /* bearer capability */
 //printf("hlc=%d\n",p_capainfo.hlc);
@@ -2151,10 +2245,10 @@ void Pdss1::message_setup(unsigned int epoint_id, int message_id, union paramete
        }
 
        /* display */
-       if (p_callerinfo.display[0] && p_m_d_ntmode)
+       if (p_callerinfo.display[0] && (p_m_d_ntmode || p_m_d_tespecial))
                enc_ie_display(l3m, (unsigned char *)p_callerinfo.display);
        /* nt-mode: CNIP (calling name identification presentation) */
-//     if (p_callerinfo.name[0] && p_m_d_ntmode)
+//     if (p_callerinfo.name[0] && (p_m_d_ntmode || p_m_d_tespecial))
 //             enc_facility_centrex(&setup->FACILITY, dmsg, (unsigned char *)p_callerinfo.name, 1);
        end_trace();
 
@@ -2170,7 +2264,7 @@ void Pdss1::message_facility(unsigned int epoint_id, int message_id, union param
        l3_msg *l3m;
 
        /* facility will not be sent to external lines */
-       if (!p_m_d_ntmode)
+       if (!p_m_d_ntmode && !p_m_d_tespecial)
                return;
 
        /* sending facility */
@@ -2186,7 +2280,7 @@ void Pdss1::message_notify(unsigned int epoint_id, int message_id, union paramet
 {
        l3_msg *l3m;
        int notify;
-       int plan, type = -1, present;
+       int plan = 0, type = -1, present = 0;
 
        if (param->notifyinfo.notify>INFO_NOTIFY_NONE)
                notify = param->notifyinfo.notify & 0x7f;
@@ -2202,6 +2296,9 @@ void Pdss1::message_notify(unsigned int epoint_id, int message_id, union paramet
                plan = 1;
                switch (param->notifyinfo.ntype)
                {
+                       case INFO_NTYPE_UNKNOWN:
+                       type = 0;
+                       break;
                        case INFO_NTYPE_INTERNATIONAL:
                        type = 1;
                        break;
@@ -2212,25 +2309,20 @@ void Pdss1::message_notify(unsigned int epoint_id, int message_id, union paramet
                        type = 4;
                        break;
                        default: /* INFO_NTYPE_UNKNOWN */
-                       type = 0;
+                       type = -1;
                        break;
                }
                switch (param->notifyinfo.present)
                {
-                       case INFO_PRESENT_NULL: /* no redir at all */
-                       present = -1;
-                       plan = -1;
-                       type = -1;
+                       case INFO_PRESENT_ALLOWED:
+                       present = 0;
                        break;
                        case INFO_PRESENT_RESTRICTED:
                        present = 1;
                        break;
-                       case INFO_PRESENT_NOTAVAIL:
+                       default: /* INFO_PRESENT_NOTAVAIL */
                        present = 2;
                        break;
-                       default: /* INFO_PRESENT_ALLOWED */
-                       present = 0;
-                       break;
                }
        }
 
@@ -2256,14 +2348,14 @@ void Pdss1::message_notify(unsigned int epoint_id, int message_id, union paramet
                        l1l2l3_trace_header(p_m_mISDNport, this, L3_NOTIFY_REQ, DIRECTION_OUT);
                        enc_ie_notify(l3m, notify);
                        /* sending redirection number only in ntmode */
-                       if (type >= 0 && p_m_d_ntmode)
+                       if (type >= 0 && (p_m_d_ntmode || p_m_d_tespecial))
                                enc_ie_redir_dn(l3m, type, plan, present, (unsigned char *)param->notifyinfo.id);
-                       if (param->notifyinfo.display[0] && p_m_d_ntmode)
+                       if (param->notifyinfo.display[0] && (p_m_d_ntmode || p_m_d_tespecial))
                                enc_ie_display(l3m, (unsigned char *)param->notifyinfo.display);
                        end_trace();
                        p_m_mISDNport->ml3->to_layer3(p_m_mISDNport->ml3, MT_NOTIFY, p_m_d_l3id, l3m);
                }
-       } else if (p_m_d_ntmode)
+       } else if (p_m_d_ntmode || p_m_d_tespecial)
        {
                /* sending information */
                l3m = create_l3msg();
@@ -2298,7 +2390,7 @@ void Pdss1::message_overlap(unsigned int epoint_id, int message_id, union parame
         || p_capainfo.bearer_capa==INFO_BC_AUDIO
         || p_capainfo.bearer_capa==INFO_BC_DATAUNRESTRICTED_TONES)
        if (p_m_mISDNport->tones)
-               enc_ie_progress(l3m, 0, p_m_d_ntmode?1:5, 8);
+               enc_ie_progress(l3m, 0, (p_m_d_ntmode)?1:5, 8);
        end_trace();
        p_m_mISDNport->ml3->to_layer3(p_m_mISDNport->ml3, MT_SETUP_ACKNOWLEDGE, p_m_d_l3id, l3m);
 
@@ -2321,7 +2413,7 @@ void Pdss1::message_proceeding(unsigned int epoint_id, int message_id, union par
         || p_capainfo.bearer_capa==INFO_BC_AUDIO
         || p_capainfo.bearer_capa==INFO_BC_DATAUNRESTRICTED_TONES)
        if (p_m_mISDNport->tones)
-               enc_ie_progress(l3m, 0, p_m_d_ntmode?1:5, 8);
+               enc_ie_progress(l3m, 0, (p_m_d_ntmode)?1:5, 8);
        end_trace();
        p_m_mISDNport->ml3->to_layer3(p_m_mISDNport->ml3, MT_CALL_PROCEEDING, p_m_d_l3id, l3m);
 
@@ -2346,7 +2438,7 @@ void Pdss1::message_alerting(unsigned int epoint_id, int message_id, union param
                 || p_capainfo.bearer_capa==INFO_BC_AUDIO
                 || p_capainfo.bearer_capa==INFO_BC_DATAUNRESTRICTED_TONES)
                if (p_m_mISDNport->tones)
-                       enc_ie_progress(l3m, 0, p_m_d_ntmode?1:5, 8);
+                       enc_ie_progress(l3m, 0, (p_m_d_ntmode)?1:5, 8);
                end_trace();
                p_m_mISDNport->ml3->to_layer3(p_m_mISDNport->ml3, MT_CALL_PROCEEDING, p_m_d_l3id, l3m);
                new_state(PORT_STATE_IN_PROCEEDING);
@@ -2363,7 +2455,7 @@ void Pdss1::message_alerting(unsigned int epoint_id, int message_id, union param
         || p_capainfo.bearer_capa==INFO_BC_AUDIO
         || p_capainfo.bearer_capa==INFO_BC_DATAUNRESTRICTED_TONES)
        if (p_m_mISDNport->tones)
-               enc_ie_progress(l3m, 0, p_m_d_ntmode?1:5, 8);
+               enc_ie_progress(l3m, 0, (p_m_d_ntmode)?1:5, 8);
        end_trace();
        p_m_mISDNport->ml3->to_layer3(p_m_mISDNport->ml3, MT_ALERTING, p_m_d_l3id, l3m);
 
@@ -2402,7 +2494,7 @@ void Pdss1::message_connect(unsigned int epoint_id, int message_id, union parame
                /* sending information */
                l3m = create_l3msg();
                l1l2l3_trace_header(p_m_mISDNport, this, L3_INFORMATION_REQ, DIRECTION_OUT);
-               if (p_m_d_ntmode)
+               if (p_m_d_ntmode || p_m_d_tespecial)
                        enc_ie_display(l3m, (unsigned char *)p_connectinfo.display);
                end_trace();
                p_m_mISDNport->ml3->to_layer3(p_m_mISDNport->ml3, MT_INFORMATION, p_m_d_l3id, l3m);
@@ -2422,6 +2514,9 @@ void Pdss1::message_connect(unsigned int epoint_id, int message_id, union parame
        plan = 1;
        switch (p_connectinfo.ntype)
        {
+               case INFO_NTYPE_UNKNOWN:
+               type = 0x0;
+               break;
                case INFO_NTYPE_INTERNATIONAL:
                type = 0x1;
                break;
@@ -2431,8 +2526,8 @@ void Pdss1::message_connect(unsigned int epoint_id, int message_id, union parame
                case INFO_NTYPE_SUBSCRIBER:
                type = 0x4;
                break;
-               default: /* INFO_NTYPE_UNKNOWN */
-               type = 0x0;
+               default: /* INFO_NTYPE_NOTPRESENT */
+               type = -1;
                break;
        }
        switch (param->connectinfo.screen)
@@ -2446,32 +2541,26 @@ void Pdss1::message_connect(unsigned int epoint_id, int message_id, union parame
        }
        switch (p_connectinfo.present)
        {
-               case INFO_PRESENT_NULL: /* no colp at all */
-               present = -1;
-               screen = -1;
-               plan = -1;
-               type = -1;
+               case INFO_PRESENT_ALLOWED:
+               present = 0;
                break;
                case INFO_PRESENT_RESTRICTED:
                present = 1;
                break;
-               case INFO_PRESENT_NOTAVAIL:
+               default: /* INFO_PRESENT_NOTAVAIL */
                present = 2;
                break;
-               default: /* INFO_PRESENT_ALLOWED */
-               present = 0;
-               break;
        }
        if (type >= 0)
                enc_ie_connected_pn(l3m, type, plan, present, screen, (unsigned char *)p_connectinfo.id);
        /* display */
-       if (p_connectinfo.display[0] && p_m_d_ntmode)
+       if (p_connectinfo.display[0] && (p_m_d_ntmode || p_m_d_tespecial))
                enc_ie_display(l3m, (unsigned char *)p_connectinfo.display);
        /* nt-mode: CONP (connected name identification presentation) */
-//     if (p_connectinfo.name[0] && p_m_d_ntmode)
+//     if (p_connectinfo.name[0] && (p_m_d_ntmode || p_m_d_tespecial))
 //             enc_facility_centrex(&connect->FACILITY, dmsg, (unsigned char *)p_connectinfo.name, 0);
        /* date & time */
-       if (p_m_d_ntmode)
+       if (p_m_d_ntmode || p_m_d_tespecial)
        {
                epoint = find_epoint_id(epoint_id);
                enc_ie_date(l3m, now, p_settings.no_seconds);
@@ -2532,7 +2621,7 @@ if (/*     ||*/ p_state==PORT_STATE_OUT_SETUP)
                 || p_capainfo.bearer_capa==INFO_BC_AUDIO
                 || p_capainfo.bearer_capa==INFO_BC_DATAUNRESTRICTED_TONES)
                if (p_m_mISDNport->tones)
-                       enc_ie_progress(l3m, 0, p_m_d_ntmode?1:5, 8);
+                       enc_ie_progress(l3m, 0, (p_m_d_ntmode)?1:5, 8);
                end_trace();
                p_m_mISDNport->ml3->to_layer3(p_m_mISDNport->ml3, MT_CALL_PROCEEDING, p_m_d_l3id, l3m);
                new_state(PORT_STATE_IN_PROCEEDING);
@@ -2546,13 +2635,13 @@ if (/*   ||*/ p_state==PORT_STATE_OUT_SETUP)
         || p_capainfo.bearer_capa==INFO_BC_AUDIO
         || p_capainfo.bearer_capa==INFO_BC_DATAUNRESTRICTED_TONES)
        if (p_m_mISDNport->tones)
-               enc_ie_progress(l3m, 0, p_m_d_ntmode?1:5, 8);
+               enc_ie_progress(l3m, 0, (p_m_d_ntmode)?1:5, 8);
        /* send cause */
        enc_ie_cause(l3m, (!p_m_mISDNport->locally && param->disconnectinfo.location==LOCATION_PRIVATE_LOCAL)?LOCATION_PRIVATE_REMOTE:param->disconnectinfo.location, param->disconnectinfo.cause);
        /* send display */
        if (param->disconnectinfo.display[0])
                p = param->disconnectinfo.display;
-       if (p) if (*p && p_m_d_ntmode)
+       if (p) if (*p && (p_m_d_ntmode || p_m_d_tespecial))
                enc_ie_display(l3m, (unsigned char *)p);
        end_trace();
        p_m_mISDNport->ml3->to_layer3(p_m_mISDNport->ml3, MT_DISCONNECT, p_m_d_l3id, l3m);
@@ -2627,7 +2716,7 @@ wirklich erst proceeding?:
                 || p_capainfo.bearer_capa==INFO_BC_AUDIO
                 || p_capainfo.bearer_capa==INFO_BC_DATAUNRESTRICTED_TONES)
                if (p_m_mISDNport->tones)
-                       enc_ie_progress(l3m, 0, p_m_d_ntmode?1:5, 8);
+                       enc_ie_progress(l3m, 0, (p_m_d_ntmode)?1:5, 8);
                end_trace();
                p_m_mISDNport->ml3->to_layer3(p_m_mISDNport->ml3, MT_CALL_PROCEEDING, p_m_d_l3id, l3m);
        }
@@ -2641,14 +2730,14 @@ wirklich erst proceeding?:
         || p_capainfo.bearer_capa==INFO_BC_AUDIO
         || p_capainfo.bearer_capa==INFO_BC_DATAUNRESTRICTED_TONES)
        if (p_m_mISDNport->tones)
-               enc_ie_progress(l3m, 0, p_m_d_ntmode?1:5, 8);
+               enc_ie_progress(l3m, 0, (p_m_d_ntmode)?1:5, 8);
        /* send cause */
        enc_ie_cause(l3m, (p_m_mISDNport->locally && param->disconnectinfo.location==LOCATION_PRIVATE_LOCAL)?LOCATION_PRIVATE_LOCAL:param->disconnectinfo.location, param->disconnectinfo.cause);
        /* send display */
        epoint = find_epoint_id(epoint_id);
        if (param->disconnectinfo.display[0])
                p = param->disconnectinfo.display;
-       if (p) if (*p && p_m_d_ntmode)
+       if (p) if (*p && (p_m_d_ntmode || p_m_d_tespecial))
                enc_ie_display(l3m, (unsigned char *)p);
        end_trace();
        p_m_mISDNport->ml3->to_layer3(p_m_mISDNport->ml3, MT_DISCONNECT, p_m_d_l3id, l3m);
@@ -2666,8 +2755,6 @@ wirklich erst proceeding?:
  */
 int Pdss1::message_epoint(unsigned int epoint_id, int message_id, union parameter *param)
 {
-       struct lcr_msg *message;
-
        if (PmISDN::message_epoint(epoint_id, message_id, param))
                return(1);
 
@@ -2791,7 +2878,7 @@ int Pdss1::message_epoint(unsigned int epoint_id, int message_id, union paramete
                break;
 
                default:
-               PERROR("Pdss1(%s) isdn port with (caller id %s) received a wrong message: %d\n", p_name, p_callerinfo.id, message);
+               PERROR("Pdss1(%s) isdn port with (caller id %s) received a wrong message: %d\n", p_name, p_callerinfo.id, message_id);
        }
 
        return(1);
@@ -2892,18 +2979,18 @@ int stack2manager(struct mISDNport *mISDNport, unsigned int cmd, unsigned int pi
        switch(cmd)
        {
                case MT_SETUP:
-               /* creating port object */
+               /* creating port object, transparent until setup with hdlc */
                SPRINT(name, "%s-%d-in", mISDNport->ifport->interface->name, mISDNport->portnum);
-               if (!(pdss1 = new Pdss1(PORT_TYPE_DSS1_NT_IN, mISDNport, name, NULL, 0, 0)))
+               if (!(pdss1 = new Pdss1(PORT_TYPE_DSS1_NT_IN, mISDNport, name, NULL, 0, 0, B_MODE_TRANSPARENT)))
 
                        FATAL("Cannot create Port instance.\n");
                pdss1->message_isdn(cmd, pid, l3m);
                break;
 
                case MT_RESUME:
-               /* creating port object */
+               /* creating port object, transparent until setup with hdlc */
                SPRINT(name, "%s-%d-in", mISDNport->ifport->interface->name, mISDNport->portnum);
-               if (!(pdss1 = new Pdss1(PORT_TYPE_DSS1_NT_IN, mISDNport, name, NULL, 0, 0)))
+               if (!(pdss1 = new Pdss1(PORT_TYPE_DSS1_NT_IN, mISDNport, name, NULL, 0, 0, B_MODE_TRANSPARENT)))
                        FATAL("Cannot create Port instance.\n");
                pdss1->message_isdn(cmd, pid, l3m);
                break;