Add support for TCH/H and half rate codec
[lcr.git] / dss1.cpp
index 51b43a1..c4a0aa4 100644 (file)
--- a/dss1.cpp
+++ b/dss1.cpp
@@ -28,7 +28,7 @@ static int delete_event(struct lcr_work *work, void *instance, int index);
 /*
  * constructor
  */
-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)
+Pdss1::Pdss1(int type, struct mISDNport *mISDNport, char *portname, struct port_settings *settings, struct interface *interface, int channel, int exclusive, int mode) : PmISDN(type, mISDNport, portname, settings, interface, channel, exclusive, mode)
 {
        p_callerinfo.itype = (mISDNport->ifport->interface->extension)?INFO_ITYPE_ISDN_EXTENSION:INFO_ITYPE_ISDN;
        p_m_d_ntmode = mISDNport->ntmode;
@@ -1685,7 +1685,7 @@ void Pdss1::facility_ind(unsigned int cmd, unsigned int pid, struct l3_msg *l3m)
 
        message = message_create(p_serial, ACTIVE_EPOINT(p_epointlist), PORT_TO_EPOINT, MESSAGE_FACILITY);
        message->param.facilityinfo.len = fac_len;
-       memcpy(message->param.facilityinfo.data, fac_ie, fac_len);
+       memcpy(message->param.facilityinfo.data, fac_ie + 1, fac_len);
        message_put(message);
 }
 
@@ -2327,17 +2327,17 @@ void Pdss1::message_3pty(unsigned int epoint_id, int message_id, union parameter
        if (param->threepty.result) {
                fac.comp = CompReturnResult;
                fac.u.retResult.invokeId = param->threepty.invoke_id;
+               fac.u.retResult.operationValuePresent = 1;
+               if (param->threepty.begin)
+                       fac.u.retResult.operationValue = Fac_Begin3PTY;
+               if (param->threepty.end)
+                       fac.u.retResult.operationValue = Fac_End3PTY;
        }
        if (param->threepty.error) {
                fac.comp = CompReturnError;
                fac.u.retError.invokeId = param->threepty.invoke_id;
                fac.u.retError.errorValue = FacError_Gen_InvalidCallState;
        }
-       fac.u.retResult.operationValuePresent = 1;
-       if (param->threepty.begin)
-               fac.u.retResult.operationValue = Fac_Begin3PTY;
-       if (param->threepty.end)
-               fac.u.retResult.operationValue = Fac_End3PTY;
        encodeFac(fac_ie, &fac);
 
        /* sending facility */
@@ -3043,7 +3043,7 @@ int stack2manager(struct mISDNport *mISDNport, unsigned int cmd, unsigned int pi
                case MT_SETUP:
                /* 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, B_MODE_TRANSPARENT)))
+               if (!(pdss1 = new Pdss1(PORT_TYPE_DSS1_NT_IN, mISDNport, name, NULL, mISDNport->ifport->interface, 0, 0, B_MODE_TRANSPARENT)))
 
                        FATAL("Cannot create Port instance.\n");
                pdss1->message_isdn(cmd, pid, l3m);
@@ -3052,7 +3052,7 @@ int stack2manager(struct mISDNport *mISDNport, unsigned int cmd, unsigned int pi
                case MT_RESUME:
                /* 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, B_MODE_TRANSPARENT)))
+               if (!(pdss1 = new Pdss1(PORT_TYPE_DSS1_NT_IN, mISDNport, name, NULL, mISDNport->ifport->interface, 0, 0, B_MODE_TRANSPARENT)))
                        FATAL("Cannot create Port instance.\n");
                pdss1->message_isdn(cmd, pid, l3m);
                break;