Esempio n. 1
0
        public static Csta.EventBuffer_t clearCall(Acs.ACSHandle_t acsHandle, Csta.ConnectionID_t cId)
        {
            Csta.EventBuffer_t evtBuf   = new Csta.EventBuffer_t();
            Acs.InvokeID_t     invokeId = new Acs.InvokeID_t();
            Acs.RetCode_t      retCode  = Csta.cstaClearCall(acsHandle,
                                                             invokeId,
                                                             cId,
                                                             null);
            if (retCode._value < 0)
            {
                System.Windows.Forms.MessageBox.Show("cstaClearCall error: " + retCode);
                return(null);
            }
            ushort eventBufSize = Csta.CSTA_MAX_HEAP;
            ushort numEvents;

            retCode = Acs.acsGetEventBlock(acsHandle,
                                           evtBuf,
                                           ref eventBufSize,
                                           null,
                                           out numEvents);
            if (retCode._value < 0)
            {
                System.Windows.Forms.MessageBox.Show("acsGetEventBlock error: " + retCode);
                return(null);
            }
            return(evtBuf);
        }
Esempio n. 2
0
        // The public method to clear an active call
        public void hangupCall(uint callId, char[] device, uint deviceType)
        {
            // Define the mandatory (unused) private data buffer
            Csta.PrivateData_t privData = new Csta.PrivateData_t();
            privData.vendor = "MERLIN                          ".ToCharArray();
            privData.length = 4;
            privData.data   = "N".ToCharArray();

            // Populate a ConnectionID_t struct with the active call elements
            Csta.ConnectionID_t activeCall = new Csta.ConnectionID_t();
            activeCall.callID          = callId;
            activeCall.deviceID.device = device;
            activeCall.devIDType       = (Csta.ConnectionID_Device_t)deviceType;

            int clearConnection = Csta.cstaClearConnection(acsHandle, numInvokeId, ref activeCall, ref privData);
        }
Esempio n. 3
0
        private void snapShotDataTree_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            if (e.Button != MouseButtons.Right)
            {
                return;
            }
            snapShotDataTree.SelectedNode = e.Node;
            if (!(e.Node is CallNode))
            {
                return;
            }
            CallNode tmpNode = (CallNode)e.Node;

            Csta.ConnectionID_t selectedConnId = tmpNode.connection;
            ContextMenuStrip    snapShotDataTreeContextMenu        = new ContextMenuStrip();
            ToolStripItem       cstaClearCallContextMenuItem       = snapShotDataTreeContextMenu.Items.Add("cstaClearCall");
            ToolStripItem       cstaClearConnectionContextMenuItem = snapShotDataTreeContextMenu.Items.Add("cstaClearConnection");

            cstaClearCallContextMenuItem.Click += (s, ev) =>
            {
                Csta.EventBuffer_t evtbuf = Csta.clearCall(this.parentForm.acsHandle, selectedConnId);
                if (evtbuf.evt.eventHeader.eventClass.eventClass == Csta.CSTACONFIRMATION && evtbuf.evt.eventHeader.eventType.eventType == Csta.CSTA_CLEAR_CALL_CONF)
                {
                    snapShotDataTree.Nodes.Remove(tmpNode);
                }
            };

            cstaClearConnectionContextMenuItem.Click += (s, ev) =>
            {
                Csta.EventBuffer_t evtbuf = Csta.clearConnection(parentForm.acsHandle, parentForm.privData, selectedConnId);
                if (evtbuf.evt.eventHeader.eventClass.eventClass == Csta.CSTACONFIRMATION && evtbuf.evt.eventHeader.eventType.eventType == Csta.CSTA_CLEAR_CONNECTION_CONF)
                {
                    snapShotDataTree.Nodes.Remove(tmpNode);
                }
            };

            snapShotDataTreeContextMenu.Show(Cursor.Position);
        }
Esempio n. 4
0
        public static Att.ATTUCID_t[] GetUcid(Csta.DeviceID_t device)
        {
            Acs.ACSHandle_t acsHandle;
            Acs.InvokeID_t  invokeId;

            // Set PrivateData request
            var privData = new Acs.PrivateData_t();

            privData.vendor  = "VERSION";
            privData.data    = new byte[1024];
            privData.data[0] = Acs.PRIVATE_DATA_ENCODING;

            // Get supportedVersion string
            string requestedVersion = "3-7"; // Private Data version request

            System.Text.StringBuilder supportedVersion = new System.Text.StringBuilder();
            Acs.RetCode_t             attrc            = Att.attMakeVersionString(requestedVersion, supportedVersion);
            //Console.WriteLine("attrc = " + attrc + "; supportedVersion = " + supportedVersion);

            for (int i = 0; i < supportedVersion.Length; i++)
            {
                privData.data[i + 1] = (byte)supportedVersion[i];
            }
            privData.length = Att.ATT_MAX_PRIVATE_DATA;

            Acs.RetCode_t retCode = OpenStream(out acsHandle, out invokeId, ref privData);
            //Console.WriteLine("acsOpenStream retCode = " + retCode + ", Handle = " + acsHandle.ToString());

            retCode = Csta.cstaSnapshotDeviceReq(acsHandle,
                                                 invokeId,
                                                 ref device,
                                                 ref privData);

            privData.length = Att.ATT_MAX_PRIVATE_DATA;
            Csta.CSTAEvent_t evt          = new Csta.CSTAEvent_t();
            ushort           eventBufSize = Csta.CSTA_MAX_HEAP;
            ushort           numEvents    = 0;

            retCode = Acs.acsGetEventBlock(acsHandle,
                                           out evt,
                                           ref eventBufSize,
                                           ref privData,
                                           out numEvents);

            int callCount = evt.cstaConfirmation.snapshotDevice.snapshotData.count;

            Csta.ConnectionID_t[] connections = new Csta.ConnectionID_t[callCount];
            for (int i = 0; i < evt.cstaConfirmation.snapshotDevice.snapshotData.count; i++)
            {
                connections[i] = evt.cstaConfirmation.snapshotDevice.snapshotData.info[i].callIdentifier;
            }

            if (callCount > 0)
            {
                //Console.WriteLine(evt.cstaConfirmation.snapshotDevice.snapshotData);
                //Console.WriteLine(evt.cstaConfirmation.snapshotDevice.snapshotData.info[1].localCallState);
                Att.ATTUCID_t[] ucids = new Att.ATTUCID_t[callCount];
                for (int i = 0; i < callCount; i++)
                {
                    //Csta.ConnectionID_t connection = evt.cstaConfirmation.snapshotDevice.snapshotData.info[i].callIdentifier;

                    retCode = Att.attQueryUCID(ref privData, ref connections[i]);
                    //Console.WriteLine("attQueryUCID retCode = " + retCode);
                    //Console.WriteLine("privData.Length = " + privData.length);

                    retCode = Csta.cstaEscapeService(acsHandle, invokeId, ref privData);
                    //Console.WriteLine("cstaEscapeService retCode = " + retCode);
                    //Console.WriteLine("privData.Length = " + privData.length);
                    // Set private data length (we'll have to call GetEventBlock otherwise)
                    privData.length = Att.ATT_MAX_PRIVATE_DATA;
                    retCode         = Acs.acsGetEventBlock(acsHandle,
                                                           out evt,
                                                           ref eventBufSize,
                                                           ref privData,
                                                           out numEvents);

                    //Console.WriteLine("acsGetEventBlock retCode = " + retCode + " Buffer size = " + eventBufSize + ", numEvents = " + numEvents);
                    //Console.WriteLine("eventClass = " + evt.eventHeader.eventClass);
                    //Console.WriteLine("eventType = " + evt.eventHeader.eventType);
                    //Console.WriteLine("privData.Length = " + privData.length);

                    // Decode ATTPrivateData
                    Att.ATTEvent_t attevt;
                    retCode  = Att.attPrivateData(ref privData, out attevt);
                    ucids[i] = attevt.queryUCID.ucid;
                    //Console.WriteLine("attPrivateData retCode = " + retCode);
                    //Console.WriteLine("privData.Length = " + privData.length);
                    //Console.WriteLine("ATTeventType  = " + attevt.eventType);
                    //Console.WriteLine("ucid #{0} = {1}", i + 1, attevt.queryUCID.ucid);
                }
                Acs.acsAbortStream(acsHandle, out privData);
                return(ucids);
            }
            else
            {
                Console.WriteLine("No active calls");
                Acs.acsAbortStream(acsHandle, out privData);
                return(new Att.ATTUCID_t[0]);
            }
        }
Esempio n. 5
0
 public static extern Acs.RetCode_t cstaTransferCall(
     Acs.ACSHandle_t acsHandle,
     Acs.InvokeID_t invokeID,
     Csta.ConnectionID_t heldCall,
     Csta.ConnectionID_t activeCall,
     Acs.PrivateData_t privateData);
Esempio n. 6
0
 public static extern Acs.RetCode_t cstaPickupCall(
     Acs.ACSHandle_t acsHandle,
     Acs.InvokeID_t invokeID,
     Csta.ConnectionID_t deflectCall,
     ref Csta.DeviceID_t calledDevice,
     Acs.PrivateData_t privateData);
Esempio n. 7
0
 public static extern Acs.RetCode_t cstaHoldCall(
     Acs.ACSHandle_t acsHandle,
     Acs.InvokeID_t invokeID,
     Csta.ConnectionID_t activeCall,
     bool reservation,
     Acs.PrivateData_t privateData);
Esempio n. 8
0
 public static extern Acs.RetCode_t cstaClearConnection(
     Acs.ACSHandle_t acsHandle,
     Acs.InvokeID_t invokeID,
     Csta.ConnectionID_t call,
     Acs.PrivateData_t privateData);
Esempio n. 9
0
 public static extern Acs.RetCode_t cstaCallCompletion(
     Acs.ACSHandle_t acsHandle,
     Acs.InvokeID_t activeCall,
     Feature_t feature,
     Csta.ConnectionID_t call,
     Acs.PrivateData_t privateData);
Esempio n. 10
0
 public static extern Acs.RetCode_t cstaAnswerCall(
     Acs.ACSHandle_t acsHandle,
     Acs.InvokeID_t activeCall,
     Csta.ConnectionID_t alertingCall,
     Acs.PrivateData_t privateData);
Esempio n. 11
0
        public static Csta.EventBuffer_t clearConnection(Acs.ACSHandle_t acsHandle, Acs.PrivateData_t privData, Csta.ConnectionID_t cId)
        {
            var u2uString = "Hello, I AM test u2u string";
            var u2uInfo   = new Att.ATTUserToUserInfo_t();
            // fixed u2u size
            int u2uSize = Att.ATT_MAX_UUI_SIZE;

            u2uInfo.length = (short)u2uString.Length;
            u2uInfo.type   = Att.ATTUUIProtocolType_t.UUI_IA5_ASCII;
            u2uInfo.value  = System.Text.Encoding.ASCII.GetBytes(u2uString);
            Array.Resize(ref u2uInfo.value, u2uSize);

            Att.attV6ClearConnection(privData, Att.ATTDropResource_t.DR_NONE, ref u2uInfo);

            Csta.EventBuffer_t evtBuf   = new Csta.EventBuffer_t();
            Acs.InvokeID_t     invokeId = new Acs.InvokeID_t();
            Acs.RetCode_t      retCode  = Csta.cstaClearConnection(acsHandle,
                                                                   invokeId,
                                                                   cId,
                                                                   privData);
            if (retCode._value < 0)
            {
                System.Windows.Forms.MessageBox.Show("cstaClearConnection error: " + retCode);
                return(null);
            }
            privData.length = Att.ATT_MAX_PRIVATE_DATA;
            ushort eventBufSize = Csta.CSTA_MAX_HEAP;
            ushort numEvents;

            retCode = Acs.acsGetEventBlock(acsHandle,
                                           evtBuf,
                                           ref eventBufSize,
                                           privData,
                                           out numEvents);
            if (retCode._value < 0)
            {
                System.Windows.Forms.MessageBox.Show("acsGetEventBlock error: " + retCode);
                return(null);
            }
            return(evtBuf);
        }
Esempio n. 12
0
 public static extern Acs.RetCode_t cstaMonitorCall(
     Acs.ACSHandle_t acsHandle,
     Acs.InvokeID_t invokeID,
     Csta.ConnectionID_t call,
     ref CSTAMonitorFilter_t monitorFilter,
     Acs.PrivateData_t privateData);