now LCR features real HDLC bchannel mode.
authorSuper User <root@isdn.jolly.ten>
Sat, 26 Jul 2008 15:42:16 +0000 (17:42 +0200)
committerSuper User <root@isdn.jolly.ten>
Sat, 26 Jul 2008 15:42:16 +0000 (17:42 +0200)
-> if initial caller uses pure data mode (or video), the bchannels for this call are handled in HDLC mode. (hardware/software briding is still applicable.)

modified:   apppbx.cpp
modified:   chan_lcr.c
modified:   dss1.cpp
modified:   dss1.h
modified:   lcradmin.c
modified:   lcrsocket.h
modified:   mISDN.cpp
modified:   mISDN.h
modified:   message.h
modified:   socket_server.c

apppbx.cpp
chan_lcr.c
dss1.cpp
dss1.h
lcradmin.c
lcrsocket.h
mISDN.cpp
mISDN.h
message.h
socket_server.c

index c280d20..ffb7ebe 100644 (file)
@@ -845,6 +845,10 @@ void EndpointAppPBX::out_setup(void)
        struct port_settings    port_settings;
        int                     channel = 0;
        int                     earlyb;
+       int                     mode = B_MODE_TRANSPARENT;
+
+       /* set bchannel mode */
+       mode = e_capainfo.source_mode;
 
        /* create settings for creating port */
        memset(&port_settings, 0, sizeof(port_settings));
@@ -983,7 +987,7 @@ void EndpointAppPBX::out_setup(void)
                        }
                        /* creating INTERNAL port */
                        SPRINT(portname, "%s-%d-out", mISDNport->ifport->interface->name, mISDNport->portnum);
-                       port = new Pdss1((mISDNport->ntmode)?PORT_TYPE_DSS1_NT_OUT:PORT_TYPE_DSS1_TE_OUT, mISDNport, portname, &port_settings, channel, mISDNport->ifport->channel_force);
+                       port = new Pdss1((mISDNport->ntmode)?PORT_TYPE_DSS1_NT_OUT:PORT_TYPE_DSS1_TE_OUT, mISDNport, portname, &port_settings, channel, mISDNport->ifport->channel_force, mode);
                        if (!port)
                                FATAL("No memory for DSS1 Port instance\n");
                        PDEBUG(DEBUG_EPOINT, "EPOINT(%d) got port %s\n", ea_endpoint->ep_serial, port->p_name);
@@ -1091,7 +1095,7 @@ void EndpointAppPBX::out_setup(void)
                                {
                                        /* creating EXTERNAL port*/
                                        SPRINT(portname, "%s-%d-out", mISDNport->ifport->interface->name, mISDNport->portnum);
-                                       if (!(port = new Pdss1((mISDNport->ntmode)?PORT_TYPE_DSS1_NT_OUT:PORT_TYPE_DSS1_TE_OUT, mISDNport, portname, &port_settings, channel, mISDNport->ifport->channel_force)))
+                                       if (!(port = new Pdss1((mISDNport->ntmode)?PORT_TYPE_DSS1_NT_OUT:PORT_TYPE_DSS1_TE_OUT, mISDNport, portname, &port_settings, channel, mISDNport->ifport->channel_force, mode)))
                                                FATAL("No memory for DSS1 Port instance\n");
                                        earlyb = mISDNport->earlyb;
                                } else
@@ -1185,7 +1189,7 @@ void EndpointAppPBX::out_setup(void)
                        }
                        /* creating EXTERNAL port*/
                        SPRINT(portname, "%s-%d-out", mISDNport->ifport->interface->name, mISDNport->portnum);
-                       if (!(port = new Pdss1((mISDNport->ntmode)?PORT_TYPE_DSS1_NT_OUT:PORT_TYPE_DSS1_TE_OUT, mISDNport, portname, &port_settings, channel, mISDNport->ifport->channel_force)))
+                       if (!(port = new Pdss1((mISDNport->ntmode)?PORT_TYPE_DSS1_NT_OUT:PORT_TYPE_DSS1_TE_OUT, mISDNport, portname, &port_settings, channel, mISDNport->ifport->channel_force, mode)))
                                FATAL("No memory for DSS1 Port instance\n");
                        earlyb = mISDNport->earlyb;
                        PDEBUG(DEBUG_EPOINT, "EPOINT(%d) created port %s\n", ea_endpoint->ep_serial, port->p_name);
index 8d46357..5a5b6f9 100644 (file)
@@ -592,8 +592,12 @@ static void send_setup_to_lcr(struct chan_call *call)
        }
        newparam.setup.capainfo.bearer_capa = ast->transfercapability;
        newparam.setup.capainfo.bearer_mode = INFO_BMODE_CIRCUIT;
-       if (!call->hdlc)
+       if (call->hdlc)
+               newparam.setup.capainfo.source_mode = B_MODE_HDLC;
+       else {
+               newparam.setup.capainfo.source_mode = B_MODE_TRANSPARENT;
                newparam.setup.capainfo.bearer_info1 = (options.law=='a')?3:2;
+       }
        newparam.setup.capainfo.hlc = INFO_HLC_NONE;
        newparam.setup.capainfo.exthlc = INFO_HLC_NONE;
        send_message(MESSAGE_SETUP, call->ref, &newparam);
@@ -814,9 +818,7 @@ static void lcr_in_setup(struct chan_call *call, int message_type, union paramet
        }
        ast->transfercapability = param->setup.capainfo.bearer_capa;
        /* enable hdlc if transcap is data */
-       if (ast->transfercapability == INFO_BC_DATAUNRESTRICTED
-        || ast->transfercapability == INFO_BC_DATARESTRICTED
-        || ast->transfercapability == INFO_BC_VIDEO)
+       if (param->setup.capainfo.source_mode == B_MODE_HDLC)
                call->hdlc = 1;
        strncpy(call->oad, numberrize_callerinfo(param->setup.callerinfo.id, param->setup.callerinfo.ntype, options.national, options.international), sizeof(call->oad)-1);
 
index 06bb203..fea2e29 100644 (file)
--- a/dss1.cpp
+++ b/dss1.cpp
@@ -23,7 +23,7 @@ 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;
@@ -669,6 +669,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)
@@ -1535,6 +1544,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)
@@ -2892,18 +2902,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;
diff --git a/dss1.h b/dss1.h
index 1f27714..32b532a 100644 (file)
--- a/dss1.h
+++ b/dss1.h
@@ -13,7 +13,7 @@
 class Pdss1 : public PmISDN
 {
        public:
-       Pdss1(int type, struct mISDNport *mISDNport, char *portname, struct port_settings *settings, int channel, int exclusive);
+       Pdss1(int type, struct mISDNport *mISDNport, char *portname, struct port_settings *settings, int channel, int exclusive, int mode);
        ~Pdss1();
        unsigned int p_m_d_l3id;                /* current l3 process id */
        void message_isdn(unsigned int cmd, unsigned int pid, struct l3_msg *l3m);
index 288bebd..1df16c5 100644 (file)
@@ -739,6 +739,8 @@ char *admin_state(int sock, char *argv[])
                                                                SPRINT(buffer,"S%2d: ", j+1+(j>=15));
                                                        else
                                                                SPRINT(buffer,"B%2d: ", j+1);
+                                                       if (m[i].u.i.mode[j] == B_MODE_HDLC)
+                                                               SCAT(buffer,"HDLC ");
                                                        addstr(buffer);
                                                        switch(m[i].u.i.busy[j])
                                                        {
index 735b610..86497f9 100644 (file)
@@ -77,6 +77,7 @@ struct admin_response_interface {
        int             channels;
        char            busy[256]; /* if port is idle(0) busy(1) */
        unsigned int    port[256]; /* current port */
+       int             mode[256];
 };
 
 struct admin_response_remote {
index df550ae..4bc679b 100644 (file)
--- a/mISDN.cpp
+++ b/mISDN.cpp
@@ -91,7 +91,7 @@ void mISDN_deinitialize(void)
 /*
  * constructor
  */
-PmISDN::PmISDN(int type, mISDNport *mISDNport, char *portname, struct port_settings *settings, int channel, int exclusive) : Port(type, portname, settings)
+PmISDN::PmISDN(int type, mISDNport *mISDNport, char *portname, struct port_settings *settings, int channel, int exclusive, int mode) : Port(type, portname, settings)
 {
        p_m_mISDNport = mISDNport;
        p_m_portnum = mISDNport->portnum;
@@ -99,6 +99,7 @@ PmISDN::PmISDN(int type, mISDNport *mISDNport, char *portname, struct port_setti
        p_m_b_channel = 0;
        p_m_b_exclusive = 0;
        p_m_b_reserve = 0;
+       p_m_b_mode = mode;
        p_m_delete = 0;
        p_m_hold = 0;
        p_m_tx_gain = mISDNport->ifport->interface->tx_gain;
@@ -375,8 +376,8 @@ static int _bchannel_create(struct mISDNport *mISDNport, int i)
 
        /* open socket */
 //#warning testing without DSP
-//     mISDNport->b_socket[i] = socket(PF_ISDN, SOCK_DGRAM, ISDN_P_B_RAW);
-       mISDNport->b_socket[i] = socket(PF_ISDN, SOCK_DGRAM, ISDN_P_B_L2DSP);
+//     mISDNport->b_socket[i] = socket(PF_ISDN, SOCK_DGRAM, (mISDNport->b_mode[i]==B_MODE_HDLC)?ISDN_P_B_HDLC:ISDN_P_B_RAW);
+       mISDNport->b_socket[i] = socket(PF_ISDN, SOCK_DGRAM, (mISDNport->b_mode[i]==B_MODE_HDLC)?ISDN_P_B_L2DSPHDLC:ISDN_P_B_L2DSP);
        if (mISDNport->b_socket[i] < 0)
        {
                PERROR("Error: Failed to open bchannel-socket for index %d with mISDN-DSP layer. Did you load mISDNdsp.ko?\n", i);
@@ -448,12 +449,13 @@ static void _bchannel_activate(struct mISDNport *mISDNport, int i, int activate)
 static void _bchannel_configure(struct mISDNport *mISDNport, int i)
 {
        struct PmISDN *port;
-       int handle;
+       int handle, mode;
 
        if (mISDNport->b_socket[i] < 0)
                return;
        handle = mISDNport->b_socket[i];
        port = mISDNport->b_port[i];
+       mode = mISDNport->b_mode[i];
        if (!port)
        {
                PERROR("bchannel index i=%d not associated with a port object\n", i);
@@ -463,27 +465,27 @@ static void _bchannel_configure(struct mISDNport *mISDNport, int i)
        /* set dsp features */
        if (port->p_m_txdata)
                ph_control(mISDNport, port, handle, (port->p_m_txdata)?DSP_TXDATA_ON:DSP_TXDATA_OFF, 0, "DSP-TXDATA", port->p_m_txdata);
-       if (port->p_m_delay)
+       if (port->p_m_delay && mode == B_MODE_TRANSPARENT)
                ph_control(mISDNport, port, handle, DSP_DELAY, port->p_m_delay, "DSP-DELAY", port->p_m_delay);
-       if (port->p_m_tx_gain)
+       if (port->p_m_tx_gain && mode == B_MODE_TRANSPARENT)
                ph_control(mISDNport, port, handle, DSP_VOL_CHANGE_TX, port->p_m_tx_gain, "DSP-TX_GAIN", port->p_m_tx_gain);
-       if (port->p_m_rx_gain)
+       if (port->p_m_rx_gain && mode == B_MODE_TRANSPARENT)
                ph_control(mISDNport, port, handle, DSP_VOL_CHANGE_RX, port->p_m_rx_gain, "DSP-RX_GAIN", port->p_m_rx_gain);
-       if (port->p_m_pipeline[0])
+       if (port->p_m_pipeline[0] && mode == B_MODE_TRANSPARENT)
                ph_control_block(mISDNport, port, handle, DSP_PIPELINE_CFG, port->p_m_pipeline, strlen(port->p_m_pipeline)+1, "DSP-PIPELINE", 0);
        if (port->p_m_conf)
                ph_control(mISDNport, port, handle, DSP_CONF_JOIN, port->p_m_conf, "DSP-CONF", port->p_m_conf);
        if (port->p_m_echo)
                ph_control(mISDNport, port, handle, DSP_ECHO_ON, 0, "DSP-ECHO", 1);
-       if (port->p_m_tone)
+       if (port->p_m_tone && mode == B_MODE_TRANSPARENT)
                ph_control(mISDNport, port, handle, DSP_TONE_PATT_ON, port->p_m_tone, "DSP-TONE", port->p_m_tone);
        if (port->p_m_rxoff)
                ph_control(mISDNport, port, handle, DSP_RECEIVE_OFF, 0, "DSP-RXOFF", 1);
-//     if (port->p_m_txmix)
+//     if (port->p_m_txmix && mode == B_MODE_TRANSPARENT)
 //             ph_control(mISDNport, port, handle, DSP_MIX_ON, 0, "DSP-MIX", 1);
-       if (port->p_m_dtmf)
+       if (port->p_m_dtmf && mode == B_MODE_TRANSPARENT)
                ph_control(mISDNport, port, handle, DTMF_TONE_START, 0, "DSP-DTMF", 1);
-       if (port->p_m_crypt)
+       if (port->p_m_crypt && mode == B_MODE_TRANSPARENT)
                ph_control_block(mISDNport, port, handle, DSP_BF_ENABLE_KEY, port->p_m_crypt_key, port->p_m_crypt_key_len, "DSP-CRYPT", port->p_m_crypt_key_len);
 }
 
@@ -1030,11 +1032,12 @@ int PmISDN::seize_bchannel(int channel, int exclusive)
 seize:
        PDEBUG(DEBUG_BCHANNEL, "PmISDN(%s) seizing bchannel %d (index %d)\n", p_name, channel, i);
 
-       /* link Port */
+       /* link Port, set parameters */
        p_m_mISDNport->b_port[i] = this;
        p_m_b_index = i;
        p_m_b_channel = channel;
        p_m_b_exclusive = exclusive;
+       p_m_mISDNport->b_mode[i] = p_m_b_mode;
 
        /* reserve channel */
        if (!p_m_b_reserve)
@@ -1068,6 +1071,7 @@ void PmISDN::drop_bchannel(void)
        if (p_m_mISDNport->b_state[p_m_b_index] != B_STATE_IDLE)
                bchannel_event(p_m_mISDNport, p_m_b_index, B_EVENT_DROP);
        p_m_mISDNport->b_port[p_m_b_index] = NULL;
+       p_m_mISDNport->b_mode[p_m_b_index] = 0;
        p_m_b_index = -1;
        p_m_b_channel = 0;
        p_m_b_exclusive = 0;
@@ -1540,7 +1544,7 @@ void PmISDN::set_tone(char *dir, char *tone)
                nodsp:
                if (p_m_tone)
                if (p_m_b_index > -1)
-               if (p_m_mISDNport->b_state[p_m_b_index] == B_STATE_ACTIVE)
+               if (p_m_mISDNport->b_state[p_m_b_index] == B_STATE_ACTIVE && p_m_mISDNport->b_mode[p_m_b_index] == B_MODE_TRANSPARENT)
                {
                        PDEBUG(DEBUG_ISDN, "we reset tone from id=%d to OFF.\n", p_m_tone);
                        ph_control(p_m_mISDNport, this, p_m_mISDNport->b_socket[p_m_b_index], DSP_TONE_PATT_OFF, 0, "DSP-TONE", 0);
@@ -1624,7 +1628,7 @@ void PmISDN::set_tone(char *dir, char *tone)
                p_m_tone = id;
                PDEBUG(DEBUG_ISDN, "we set tone to id=%d.\n", p_m_tone);
                if (p_m_b_index > -1)
-               if (p_m_mISDNport->b_state[p_m_b_index] == B_STATE_ACTIVE)
+               if (p_m_mISDNport->b_state[p_m_b_index] == B_STATE_ACTIVE && p_m_mISDNport->b_mode[p_m_b_index] == B_MODE_TRANSPARENT)
                        ph_control(p_m_mISDNport, this, p_m_mISDNport->b_socket[p_m_b_index], p_m_tone?DSP_TONE_PATT_ON:DSP_TONE_PATT_OFF, p_m_tone, "DSP-TONE", p_m_tone);
        }
        /* turn user-space tones off in cases of no tone OR dsp tone */
@@ -1644,7 +1648,7 @@ void PmISDN::message_mISDNsignal(unsigned int epoint_id, int message_id, union p
                        p_m_tx_gain = param->mISDNsignal.tx_gain;
                        PDEBUG(DEBUG_BCHANNEL, "we change tx-volume to shift=%d.\n", p_m_tx_gain);
                        if (p_m_b_index > -1)
-                       if (p_m_mISDNport->b_state[p_m_b_index] == B_STATE_ACTIVE)
+                       if (p_m_mISDNport->b_state[p_m_b_index] == B_STATE_ACTIVE && p_m_mISDNport->b_mode[p_m_b_index] == B_MODE_TRANSPARENT)
                                ph_control(p_m_mISDNport, this, p_m_mISDNport->b_socket[p_m_b_index], DSP_VOL_CHANGE_TX, p_m_tx_gain, "DSP-TX_GAIN", p_m_tx_gain);
                } else
                        PDEBUG(DEBUG_BCHANNEL, "we already have tx-volume shift=%d.\n", p_m_rx_gain);
@@ -1653,7 +1657,7 @@ void PmISDN::message_mISDNsignal(unsigned int epoint_id, int message_id, union p
                        p_m_rx_gain = param->mISDNsignal.rx_gain;
                        PDEBUG(DEBUG_BCHANNEL, "we change rx-volume to shift=%d.\n", p_m_rx_gain);
                        if (p_m_b_index > -1)
-                       if (p_m_mISDNport->b_state[p_m_b_index] == B_STATE_ACTIVE)
+                       if (p_m_mISDNport->b_state[p_m_b_index] == B_STATE_ACTIVE && p_m_mISDNport->b_mode[p_m_b_index] == B_MODE_TRANSPARENT)
                                ph_control(p_m_mISDNport, this, p_m_mISDNport->b_socket[p_m_b_index], DSP_VOL_CHANGE_RX, p_m_rx_gain, "DSP-RX_GAIN", p_m_rx_gain);
                } else
                        PDEBUG(DEBUG_BCHANNEL, "we already have rx-volume shift=%d.\n", p_m_rx_gain);
@@ -1691,7 +1695,7 @@ void PmISDN::message_mISDNsignal(unsigned int epoint_id, int message_id, union p
                        p_m_delay = param->mISDNsignal.delay;
                        PDEBUG(DEBUG_BCHANNEL, "we change delay mode to delay=%d.\n", p_m_delay);
                        if (p_m_b_index > -1)
-                       if (p_m_mISDNport->b_state[p_m_b_index] == B_STATE_ACTIVE)
+                       if (p_m_mISDNport->b_state[p_m_b_index] == B_STATE_ACTIVE && p_m_mISDNport->b_mode[p_m_b_index] == B_MODE_TRANSPARENT)
                                ph_control(p_m_mISDNport, this, p_m_mISDNport->b_socket[p_m_b_index], p_m_delay?DSP_DELAY:DSP_JITTER, p_m_delay, "DSP-DELAY", p_m_delay);
                } else
                        PDEBUG(DEBUG_BCHANNEL, "we already have delay=%d.\n", p_m_delay);
@@ -1724,7 +1728,7 @@ void PmISDN::message_crypt(unsigned int epoint_id, int message_id, union paramet
                crypt_off:
                PDEBUG(DEBUG_BCHANNEL, "we set encryption to crypt=%d. (0 means OFF)\n", p_m_crypt);
                if (p_m_b_index > -1)
-               if (p_m_mISDNport->b_state[p_m_b_index] == B_STATE_ACTIVE)
+               if (p_m_mISDNport->b_state[p_m_b_index] == B_STATE_ACTIVE && p_m_mISDNport->b_mode[p_m_b_index] == B_MODE_TRANSPARENT)
                        ph_control_block(p_m_mISDNport, this, p_m_mISDNport->b_socket[p_m_b_index], p_m_crypt?DSP_BF_ENABLE_KEY:DSP_BF_DISABLE, p_m_crypt_key, p_m_crypt_key_len, "DSP-CRYPT", p_m_crypt_key_len);
                break;
 
@@ -1753,7 +1757,7 @@ void PmISDN::message_crypt(unsigned int epoint_id, int message_id, union paramet
                p_m_crypt_msg_loops = 6; /* enable */
 #if 0
                /* disable txmix, or we get corrupt data due to audio process */
-               if (p_m_txmix && p_m_b_index>=0)
+               if (p_m_txmix && p_m_b_index>=0 && p_m_mISDNport->b_mode[p_m_b_index] == B_MODE_TRANSPARENT)
                {
                        PDEBUG(DEBUG_BCHANNEL, "for sending CR_MESSAGE_REQ, we reset txmix from txmix=%d.\n", p_m_txmix);
                        ph_control(p_m_mISDNport, this, p_mISDNport->b_socket[p_m_b_index], DSP_MIX_OFF, 0, "DSP-TXMIX", 0);
@@ -1838,7 +1842,7 @@ int mISDN_handler(void)
                                                isdnport->p_m_rxoff = 0;
                                                PDEBUG(DEBUG_BCHANNEL, "%s: receive data is required, so we turn them on\n", __FUNCTION__);
                                                if (mISDNport->b_port[i] && mISDNport->b_state[i] == B_STATE_ACTIVE)
-                                                       ph_control(mISDNport, isdnport, mISDNport->b_socket[isdnport->p_m_b_index], DSP_RECEIVE_ON, 0, "DSP-RXOFF", 0);
+                                                       ph_control(mISDNport, isdnport, mISDNport->b_socket[i], DSP_RECEIVE_ON, 0, "DSP-RXOFF", 0);
                                                return(1);
                                        }
                                } else
@@ -1850,7 +1854,7 @@ int mISDN_handler(void)
                                                isdnport->p_m_rxoff = 1;
                                                PDEBUG(DEBUG_BCHANNEL, "%s: receive data is not required, so we turn them off\n", __FUNCTION__);
                                                if (mISDNport->b_port[i] && mISDNport->b_state[i] == B_STATE_ACTIVE)
-                                                       ph_control(mISDNport, isdnport, mISDNport->b_socket[isdnport->p_m_b_index], DSP_RECEIVE_OFF, 0, "DSP-RXOFF", 1);
+                                                       ph_control(mISDNport, isdnport, mISDNport->b_socket[i], DSP_RECEIVE_OFF, 0, "DSP-RXOFF", 1);
                                                return(1);
                                        }
                                }
@@ -1864,7 +1868,7 @@ int mISDN_handler(void)
                                                isdnport->p_m_txdata = 1;
                                                PDEBUG(DEBUG_BCHANNEL, "%s: transmit data is required, so we turn them on\n", __FUNCTION__);
                                                if (mISDNport->b_port[i] && mISDNport->b_state[i] == B_STATE_ACTIVE)
-                                                       ph_control(mISDNport, isdnport, mISDNport->b_socket[isdnport->p_m_b_index], DSP_TXDATA_ON, 0, "DSP-TXDATA", 1);
+                                                       ph_control(mISDNport, isdnport, mISDNport->b_socket[i], DSP_TXDATA_ON, 0, "DSP-TXDATA", 1);
                                                return(1);
                                        }
                                } else
@@ -1876,7 +1880,7 @@ int mISDN_handler(void)
                                                isdnport->p_m_txdata = 0;
                                                PDEBUG(DEBUG_BCHANNEL, "%s: transmit data is not required, so we turn them off\n", __FUNCTION__);
                                                if (mISDNport->b_port[i] && mISDNport->b_state[i] == B_STATE_ACTIVE)
-                                                       ph_control(mISDNport, isdnport, mISDNport->b_socket[isdnport->p_m_b_index], DSP_TXDATA_OFF, 0, "DSP-TXDATA", 0);
+                                                       ph_control(mISDNport, isdnport, mISDNport->b_socket[i], DSP_TXDATA_OFF, 0, "DSP-TXDATA", 0);
                                                return(1);
                                        }
                                }
diff --git a/mISDN.h b/mISDN.h
index aa9511a..62ec524 100644 (file)
--- a/mISDN.h
+++ b/mISDN.h
@@ -51,6 +51,7 @@ struct mISDNport {
        class PmISDN *b_port[128]; /* bchannel assigned to port object */
        struct mqueue upqueue;
        int b_socket[128];
+       int b_mode[128]; /* B_MODE_* */
        int b_state[128]; /* statemachine, 0 = IDLE */
        double b_timer[128]; /* timer for state machine */
        int b_remote_id[128]; /* the socket currently exported (0=none) */
@@ -97,7 +98,7 @@ void message_bchannel_from_remote(class JoinRemote *joinremote, int type, unsign
 class PmISDN : public Port
 {
        public:
-       PmISDN(int type, struct mISDNport *mISDNport, char *portname, struct port_settings *settings, int channel, int exclusive);
+       PmISDN(int type, struct mISDNport *mISDNport, char *portname, struct port_settings *settings, int channel, int exclusive, int mode);
        ~PmISDN();
        void bchannel_receive(struct mISDNhead *hh, unsigned char *data, int len);
        int handler(void);
@@ -149,6 +150,7 @@ class PmISDN : public Port
        int p_m_b_reserve;                      /* set if channel is reserved */
 //     long long p_m_jittercheck;              /* time of audio data */
 //     long long p_m_jitterdropped;            /* number of bytes dropped */
+       int p_m_b_mode;                         /* bchannel mode */
        int p_m_delete;                         /* true if obj. must del. */
        int p_m_hold;                           /* if port is on hold */
        unsigned int p_m_timeout;               /* timeout of timers */
index a1f5baf..8fb7021 100644 (file)
--- a/message.h
+++ b/message.h
@@ -144,6 +144,10 @@ enum {
        B_STATE_REMOTE,         /* bchannel assigned to remote application */
        B_STATE_IMPORTING,      /* BCHANNEL_REMOVE sent */
 };
+enum {
+       B_MODE_TRANSPARENT,     /* normal transparent audio */
+       B_MODE_HDLC,            /* hdlc data mode */
+};
 
 /* call-info structure CALLER */
 struct caller_info {
@@ -204,6 +208,7 @@ struct redir_info {
 
 /* call-info structure capability */
 struct capa_info {
+       int source_mode;                /* forward mode */
        int bearer_capa;                /* capability */
        int bearer_mode;                /* circuit/packet */
        int bearer_info1;               /* alaw,ulaw,... */
index fd18ff5..0b6e173 100644 (file)
@@ -919,6 +919,7 @@ int admin_state(struct admin_queue **responsep)
                                        response->am[num].u.i.busy[i] = mISDNport->b_state[i];
                                        if (mISDNport->b_port[i])
                                                response->am[num].u.i.port[i] = mISDNport->b_port[i]->p_serial;
+                                       response->am[num].u.i.mode[i] = mISDNport->b_mode[i];
                                        i++;
                                }
                        }