Move p_m_hold (hold indicator at mISDN) to p_hold (at port)
authorAndreas Eversberg <jolly@eversberg.eu>
Wed, 18 Sep 2013 14:55:14 +0000 (16:55 +0200)
committerAndreas Eversberg <jolly@eversberg.eu>
Tue, 15 Dec 2015 19:53:25 +0000 (20:53 +0100)
apppbx.cpp
dss1.cpp
fxs.cpp
mISDN.cpp
port.cpp
port.h
socket_server.c

index 9f2b2e0..a2f62dd 100644 (file)
@@ -3804,7 +3804,7 @@ int EndpointAppPBX::join_join_dss1(int invoke_id)
        }
 
        /* now find out which is ACTIVE-IDLE and which is ACTIVE-HELD */
-       if (our_pdss1->p_m_hold && !other_pdss1->p_m_hold) {
+       if (our_port->p_hold && !other_port->p_hold) {
                PDEBUG(DEBUG_EPOINT, "EPOINT(%d) our relation is on hold and other is active, so we move our relations to other relations\n", ea_endpoint->ep_serial);
                remove_eapp_hold = this;
                remove_eapp_active = other_eapp;
@@ -3999,8 +3999,8 @@ int EndpointAppPBX::join_join_fxs(void)
                                if (other_port->p_type==PORT_TYPE_POTS_FXS_OUT
                                 || other_port->p_type==PORT_TYPE_POTS_FXS_IN) { /* port is FXS */
                                        other_fxs = (class Pfxs *)other_port;
-                                       PDEBUG(DEBUG_EPOINT, "EPOINT(%d) comparing other endpoint's port is of type isdn! comparing our portnum=%d with other's portnum=%d hold=%s state=%d\n", ea_endpoint->ep_serial, our_fxs->p_m_mISDNport->portnum, other_fxs->p_m_mISDNport->portnum, (other_fxs->p_m_hold)?"YES":"NO", other_fxs->p_state);
-                                       if (1 //other_fxs->p_m_hold /* port is on hold */
+                                       PDEBUG(DEBUG_EPOINT, "EPOINT(%d) comparing other endpoint's port is of type isdn! comparing our portnum=%d with other's portnum=%d hold=%s state=%d\n", ea_endpoint->ep_serial, our_fxs->p_m_mISDNport->portnum, other_fxs->p_m_mISDNport->portnum, (other_fxs->p_hold)?"YES":"NO", other_fxs->p_state);
+                                       if (1 //other_fxs->p_hold /* port is on hold */
                                         && other_fxs->p_m_mISDNport == our_fxs->p_m_mISDNport) /* same isdn interface */
                                                break;
                                } else {
@@ -4039,7 +4039,7 @@ int EndpointAppPBX::join_join_fxs(void)
        }
 
        /* now find out which is ACTIVE-IDLE and which is ACTIVE-HELD */
-       if (our_fxs->p_m_hold && !other_fxs->p_m_hold) {
+       if (our_port->p_hold && !other_port->p_hold) {
                PDEBUG(DEBUG_EPOINT, "EPOINT(%d) our relation is on hold and other is active, so we move our relations to other relations\n", ea_endpoint->ep_serial);
                remove_eapp = this;
                remove_join = our_join;
@@ -4293,8 +4293,8 @@ int EndpointAppPBX::join_3pty_fxs(void)
                                if (other_port->p_type==PORT_TYPE_POTS_FXS_OUT
                                 || other_port->p_type==PORT_TYPE_POTS_FXS_IN) { /* port is isdn nt-mode */
                                        other_fxs = (class Pfxs *)other_port;
-                                       PDEBUG(DEBUG_EPOINT, "EPOINT(%d) comparing other endpoint's port is of type FXS! comparing our portnum=%d with other's portnum=%d hold=%s state=%d\n", ea_endpoint->ep_serial, our_fxs->p_m_mISDNport->portnum, other_fxs->p_m_mISDNport->portnum, (other_fxs->p_m_hold)?"YES":"NO", other_fxs->p_state);
-                                       if (1 //other_fxs->p_m_hold /* port is on hold */
+                                       PDEBUG(DEBUG_EPOINT, "EPOINT(%d) comparing other endpoint's port is of type FXS! comparing our portnum=%d with other's portnum=%d hold=%s state=%d\n", ea_endpoint->ep_serial, our_fxs->p_m_mISDNport->portnum, other_fxs->p_m_mISDNport->portnum, (other_fxs->p_hold)?"YES":"NO", other_fxs->p_state);
+                                       if (1 //other_fxs->p_hold /* port is on hold */
                                         && other_fxs->p_m_mISDNport == our_fxs->p_m_mISDNport) /* same pots interface */
                                                break;
                                } else {
index f2c2ba5..d02f185 100644 (file)
--- a/dss1.cpp
+++ b/dss1.cpp
@@ -1359,10 +1359,10 @@ void Pdss1::hold_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3m)
        l1l2l3_trace_header(p_m_mISDNport, this, L3_HOLD_IND, DIRECTION_IN);
        end_trace();
 
-       if (!ACTIVE_EPOINT(p_epointlist) || p_m_hold) {
+       if (!ACTIVE_EPOINT(p_epointlist) || p_hold) {
                l3m = create_l3msg();
                l1l2l3_trace_header(p_m_mISDNport, this, L3_HOLD_REJECT_REQ, DIRECTION_OUT);
-               enc_ie_cause(l3m, (p_m_mISDNport->locally)?LOCATION_PRIVATE_LOCAL:LOCATION_PRIVATE_REMOTE, p_m_hold?101:31); /* normal unspecified / incompatible state */
+               enc_ie_cause(l3m, (p_m_mISDNport->locally)?LOCATION_PRIVATE_LOCAL:LOCATION_PRIVATE_REMOTE, p_hold?101:31); /* normal unspecified / incompatible state */
                add_trace("reason", NULL, "no endpoint");
                end_trace();
                p_m_mISDNport->ml3->to_layer3(p_m_mISDNport->ml3, MT_HOLD_REJECT, p_m_d_l3id, l3m);
@@ -1383,7 +1383,7 @@ void Pdss1::hold_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3m)
        drop_bchannel();
 
        /* set hold state */
-       p_m_hold = 1;
+       p_hold = 1;
 #if 0
        epoint = find_epoint_id(ACTIVE_EPOINT(p_epointlist));
        if (epoint && p_m_d_ntmode) {
@@ -1411,7 +1411,7 @@ void Pdss1::retrieve_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3m)
        dec_ie_channel_id(l3m, &exclusive, &channel);
        end_trace();
 
-       if (!p_m_hold) {
+       if (!p_hold) {
                cause = 101; /* incompatible state */
                reject:
 
@@ -1445,7 +1445,7 @@ void Pdss1::retrieve_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3m)
        bchannel_event(p_m_mISDNport, p_m_b_index, B_EVENT_USE);
 
        /* set hold state */
-       p_m_hold = 0;
+       p_hold = 0;
        unsched_timer(&p_m_timeout);
 
        /* acknowledge retrieve */
diff --git a/fxs.cpp b/fxs.cpp
index 0d1a915..f8e769d 100644 (file)
--- a/fxs.cpp
+++ b/fxs.cpp
@@ -297,8 +297,8 @@ no_channel:
                PDEBUG(DEBUG_ISDN, "Pfxs(%s) bchannel is already active\n", p_name);
        }
 
-       if (p_m_hold) {
-               p_m_hold = 0;
+       if (p_hold) {
+               p_hold = 0;
                message = message_create(p_serial, ACTIVE_EPOINT(p_epointlist), PORT_TO_EPOINT, MESSAGE_NOTIFY);
                message->param.notifyinfo.notify = INFO_NOTIFY_REMOTE_RETRIEVAL;
                message->param.notifyinfo.local = 1; /* call is held by supplementary service */
@@ -326,7 +326,7 @@ void Pfxs::hold_ind(unsigned int cont)
        drop_bchannel();
        PDEBUG(DEBUG_ISDN, "Pfxs(%s) drop bchannel\n", p_name);
 
-       p_m_hold = 1;
+       p_hold = 1;
 }
 
 void Pfxs::retrieve_ind(unsigned int cont)
@@ -398,7 +398,7 @@ no_channel:
                PDEBUG(DEBUG_ISDN, "Pfxs(%s) bchannel is already active\n", p_name);
        }
 
-       p_m_hold = 0;
+       p_hold = 0;
        message = message_create(p_serial, ACTIVE_EPOINT(p_epointlist), PORT_TO_EPOINT, MESSAGE_NOTIFY);
        message->param.notifyinfo.notify = INFO_NOTIFY_REMOTE_RETRIEVAL;
        message->param.notifyinfo.local = 1; /* call is held by supplementary service */
@@ -481,7 +481,7 @@ void Pfxs::message_setup(unsigned int epoint_id, int message_id, union parameter
                        if (pots->p_m_mISDNport == p_m_mISDNport) {
                                if (pots != this)
                                        any_call = 1;
-                               if (pots->p_state == PORT_STATE_CONNECT && !pots->p_m_hold)
+                               if (pots->p_state == PORT_STATE_CONNECT && !pots->p_hold)
                                        break; // found
                        }
                }
@@ -574,7 +574,7 @@ void Pfxs::message_release(unsigned int epoint_id, int message_id, union paramet
                trigger_work(&p_m_fxs_delete);
        }
        if (p_state == PORT_STATE_CONNECT) {
-               if (!p_m_hold)
+               if (!p_hold)
                        set_tone("", "release");
                else
                        trigger_work(&p_m_fxs_delete);
@@ -728,7 +728,7 @@ setup:
                                if ((port->p_type & PORT_CLASS_POTS_MASK) == PORT_CLASS_POTS_FXS) {
                                        pots = (class Pfxs *)port;
                                        if (pots->p_m_mISDNport == mISDNport) {
-                                               if (pots->p_state == PORT_STATE_CONNECT && pots->p_m_hold) {
+                                               if (pots->p_state == PORT_STATE_CONNECT && pots->p_hold) {
                                                        if (pots->p_m_fxs_age > latest) {
                                                                latest = pots->p_m_fxs_age;
                                                                latest_pots = pots;
@@ -745,7 +745,7 @@ setup:
                                if ((port->p_type & PORT_CLASS_POTS_MASK) == PORT_CLASS_POTS_FXS) {
                                        pots = (class Pfxs *)port;
                                        if (pots->p_m_mISDNport == mISDNport) {
-                                               if ((pots->p_state != PORT_STATE_CONNECT || !pots->p_m_hold) && pots != alerting_pots) {
+                                               if ((pots->p_state != PORT_STATE_CONNECT || !pots->p_hold) && pots != alerting_pots) {
                                                        PDEBUG(DEBUG_ISDN, "Pfxs(%s) release because pots-ring-after-hangup set and call not on hold / alerting\n", pots->p_name);
                                                        pots->hangup_ind(cont);
                                                }
@@ -792,7 +792,7 @@ flash:
                                pots = (class Pfxs *)port;
                                if (pots->p_m_mISDNport == mISDNport) {
                                        if (pots->p_state == PORT_STATE_CONNECT) {
-                                               if (pots->p_m_hold) {
+                                               if (pots->p_hold) {
                                                        if (pots->p_m_fxs_age > latest) {
                                                                latest = pots->p_m_fxs_age;
                                                                latest_pots = pots;
index a7facb6..aff2f34 100644 (file)
--- a/mISDN.cpp
+++ b/mISDN.cpp
@@ -130,7 +130,6 @@ PmISDN::PmISDN(int type, mISDNport *mISDNport, char *portname, struct port_setti
        p_m_b_exclusive = 0;
        p_m_b_reserve = 0;
        p_m_b_mode = mode;
-       p_m_hold = 0;
        p_m_tx_gain = mISDNport->ifport->interface->tx_gain;
        p_m_rx_gain = mISDNport->ifport->interface->rx_gain;
        p_m_conf = 0;
index 32184a8..11b70f3 100644 (file)
--- a/port.cpp
+++ b/port.cpp
@@ -176,6 +176,7 @@ Port::Port(int type, const char *portname, struct port_settings *settings, struc
        memset(&p_capainfo, 0, sizeof(p_capainfo));
        p_echotest = 0;
        p_bridge = 0;
+       p_hold = 0;
 
        /* call recording */
        p_record = NULL;
diff --git a/port.h b/port.h
index cc7b071..08f849f 100644 (file)
--- a/port.h
+++ b/port.h
@@ -236,6 +236,7 @@ class Port
        void bridge(unsigned int bridge_id);    /* join a bridge */
        int bridge_tx(unsigned char *data, int len); /* used to transmit data to remote port */
        virtual int bridge_rx(unsigned char *data, int len); /* function to be inherited, so data is received */
+       int p_hold;                             /* if port is on hold */
 
        /* state */
        int p_state;                            /* state of port */
index 28dccd9..df07b14 100644 (file)
@@ -1118,7 +1118,7 @@ int admin_state(struct admin_queue **responsep)
                        response->am[num].u.p.isdn = 1;
                        pdss1 = (class Pdss1 *)port;
                        response->am[num].u.p.isdn_chan = pdss1->p_m_b_channel;
-                       response->am[num].u.p.isdn_hold = pdss1->p_m_hold;
+                       response->am[num].u.p.isdn_hold = pdss1->p_hold;
                        response->am[num].u.p.isdn_ces = pdss1->p_m_d_ces;
                }
 #endif