private void goButton_Click(object sender, EventArgs e)
        {
            var checkedButton1 = this.connGroupBox1.Controls.OfType<RadioButtonConn>()
                                      .FirstOrDefault(rb => rb.Checked);
            var checkedButton2 = this.connGroupBox2.Controls.OfType<RadioButtonConn>()
                                      .FirstOrDefault(rb2 => rb2.Checked);
            Acs.RetCode_t rc;
            if (this.blockAllCheckBox.Checked)
                rc =  Att.attSelectiveListeningRetrieve(this._parent.privData, checkedButton1.Connection, true, checkedButton1.Connection);
            else
                rc = Att.attSelectiveListeningRetrieve(this._parent.privData, checkedButton1.Connection, false, checkedButton2.Connection);
            this._parent.Log("attSelectiveListeningRetrieve result = " + rc._value);
            if (rc._value < 0) return;
            var invokeId = new Acs.InvokeID_t();
            rc = Csta.cstaEscapeService(this._parent.acsHandle, invokeId, this._parent.privData);
            this._parent.Log("cstaEscapeService result = " + rc._value);
            if (rc._value < 0) return;

            ushort eventBufferSize = Csta.CSTA_MAX_HEAP;
            var eventBuf = new Csta.EventBuffer_t();
            ushort numEvents;
            rc = Acs.acsGetEventBlock(this._parent.acsHandle, eventBuf, ref eventBufferSize, this._parent.privData, out numEvents);
            this._parent.Log("acsGetEventBlock result = " + rc._value);
            if (rc._value < 0) return;

            if (eventBuf.evt.eventHeader.eventClass.eventClass == Csta.CSTACONFIRMATION && eventBuf.evt.eventHeader.eventType.eventType == Csta.CSTA_ESCAPE_SVC_CONF)
            {
                MessageBox.Show("attSelectiveListeningRetrieve Succeded");
            }
            else
            {
                MessageBox.Show("attSelectiveListeningRetrieve Failed. Error was: " + eventBuf.evt.cstaConfirmation.universalFailure.error);
            }
        }
Пример #2
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;
 }
Пример #3
0
        private void goButton_Click(object sender, EventArgs e)
        {
            var checkedButton1 = this.connGroupBox1.Controls.OfType <RadioButtonConn>()
                                 .FirstOrDefault(rb => rb.Checked);
            var checkedButton2 = this.connGroupBox2.Controls.OfType <RadioButtonConn>()
                                 .FirstOrDefault(rb2 => rb2.Checked);

            Acs.RetCode_t rc;
            if (this.blockAllCheckBox.Checked)
            {
                rc = Att.attSelectiveListeningRetrieve(this._parent.privData, checkedButton1.Connection, true, checkedButton1.Connection);
            }
            else
            {
                rc = Att.attSelectiveListeningRetrieve(this._parent.privData, checkedButton1.Connection, false, checkedButton2.Connection);
            }
            this._parent.Log("attSelectiveListeningRetrieve result = " + rc._value);
            if (rc._value < 0)
            {
                return;
            }
            var invokeId = new Acs.InvokeID_t();

            rc = Csta.cstaEscapeService(this._parent.acsHandle, invokeId, this._parent.privData);
            this._parent.Log("cstaEscapeService result = " + rc._value);
            if (rc._value < 0)
            {
                return;
            }

            ushort eventBufferSize = Csta.CSTA_MAX_HEAP;
            var    eventBuf        = new Csta.EventBuffer_t();
            ushort numEvents;

            rc = Acs.acsGetEventBlock(this._parent.acsHandle, eventBuf, ref eventBufferSize, this._parent.privData, out numEvents);
            this._parent.Log("acsGetEventBlock result = " + rc._value);
            if (rc._value < 0)
            {
                return;
            }

            if (eventBuf.evt.eventHeader.eventClass.eventClass == Csta.CSTACONFIRMATION && eventBuf.evt.eventHeader.eventType.eventType == Csta.CSTA_ESCAPE_SVC_CONF)
            {
                MessageBox.Show("attSelectiveListeningRetrieve Succeded");
            }
            else
            {
                MessageBox.Show("attSelectiveListeningRetrieve Failed. Error was: " + eventBuf.evt.cstaConfirmation.universalFailure.error);
            }
        }
Пример #4
0
        public Att.ATTUCID_t GetUcid(Csta.ConnectionID_t conn)
        {
            Acs.InvokeID_t invokeId = new Acs.InvokeID_t();
            Csta.EventBuffer_t evtBuf = new Csta.EventBuffer_t();
            ushort eventBufSize = Csta.CSTA_MAX_HEAP;
            ushort numEvents = 0;
            Acs.RetCode_t retCode = Att.attQueryUCID(this.privData, conn);
            retCode = Csta.cstaEscapeService(acsHandle, invokeId, this.privData);
            this.privData.length = Att.ATT_MAX_PRIVATE_DATA;
            retCode = Acs.acsGetEventBlock(acsHandle,
                                         evtBuf,
                                         ref eventBufSize,
                                         this.privData,
                                         out numEvents);

            Att.ATTEvent_t attEvt = new Att.ATTEvent_t();
            retCode = Att.attPrivateData(this.privData, attEvt);
            Debug.WriteLine("attPrivateData retCode = " + retCode._value);
            return attEvt.queryUCID.ucid;
        }
Пример #5
0
        private void attQueryUCIDButton_Click(object sender, EventArgs e)
        {
            if (!streamCheckbox.Checked || deviceTextBox.Text.Length == 0 || deviceTextBox.Text.Length > 5 || !streamCheckbox.Checked) { return; }
            Csta.DeviceID_t currentDevice = deviceTextBox.Text;
            Acs.InvokeID_t invokeId = new Acs.InvokeID_t();
            Acs.RetCode_t retCode = Csta.cstaSnapshotDeviceReq(this.acsHandle,
                                                 invokeId,
                                                 ref currentDevice,
                                                 privData);
            Csta.EventBuffer_t evtBuf = new Csta.EventBuffer_t();
            this.privData.length = Att.ATT_MAX_PRIVATE_DATA;
            ushort eventBufSize = Csta.CSTA_MAX_HEAP;
            ushort numEvents;
            retCode = Acs.acsGetEventBlock(this.acsHandle,
                                          evtBuf,
                                          ref eventBufSize,
                                          privData,
                                          out numEvents);
            if (retCode._value < 0)
            {
                MessageBox.Show("acsGetEventBlock error: " + retCode);
                return;
            }
            if (evtBuf.evt.eventHeader.eventClass.eventClass != Csta.CSTACONFIRMATION || evtBuf.evt.eventHeader.eventType.eventType != Csta.CSTA_SNAPSHOT_DEVICE_CONF)
            {
                if (evtBuf.evt.eventHeader.eventClass.eventClass == Csta.CSTACONFIRMATION && evtBuf.evt.eventHeader.eventType.eventType == Csta.CSTA_UNIVERSAL_FAILURE_CONF)
                {
                    MessageBox.Show("Snapshot device failed. Error: " + evtBuf.evt.cstaConfirmation.universalFailure.error);
                }
                return;
            }
            int callCountForSnapshotDevice = evtBuf.evt.cstaConfirmation.snapshotDevice.snapshotData.count;
            if (callCountForSnapshotDevice < 1)
            {
                MessageBox.Show("No active calls");
                return;
            }

            var snapDeviceInfoArray = (Csta.CSTASnapshotDeviceResponseInfo_t[])evtBuf.auxData["snapDeviceInfo"];
            var tmpConn = snapDeviceInfoArray[0].callIdentifier;
            CallNode callNode = new CallNode();
            string ucid = GetUcid(tmpConn).ToString();
            Log("The ucid of call #" + tmpConn.callID + " is " + ucid);
            MessageBox.Show("attQueryUCID succeded. Look in the log for details.");
        }
Пример #6
0
        private void snapShotDeviceButton_Click(object sender, EventArgs e)
        {
            if (!this.configured)
            {
                MessageBox.Show("Application is not configured");
                this.mainTabs.SelectTab(configTab);
                return;
            }
            if (!streamCheckbox.Checked || deviceTextBox.Text.Length == 0 || deviceTextBox.Text.Length > 5 || !streamCheckbox.Checked) { return; }
            Csta.DeviceID_t currentDevice = deviceTextBox.Text;
            Acs.InvokeID_t invokeId = new Acs.InvokeID_t();
            Acs.RetCode_t retCode = Csta.cstaSnapshotDeviceReq(this.acsHandle,
                                                 invokeId,
                                                 ref currentDevice,
                                                 privData);
            if (retCode._value < 0)
            {
                MessageBox.Show("cstaSnapshotDeviceReq error: " + retCode);
                return;
            }
            Csta.EventBuffer_t evtBuf = new Csta.EventBuffer_t();
            this.privData.length = Att.ATT_MAX_PRIVATE_DATA;
            ushort eventBufSize = Csta.CSTA_MAX_HEAP;
            ushort numEvents;
            retCode = Acs.acsGetEventBlock(this.acsHandle,
                                          evtBuf,
                                          ref eventBufSize,
                                          privData,
                                          out numEvents);
            if (retCode._value < 0)
            {
                MessageBox.Show("acsGetEventBlock error: " + retCode);
                return;
            }
            if (evtBuf.evt.eventHeader.eventClass.eventClass != Csta.CSTACONFIRMATION || evtBuf.evt.eventHeader.eventType.eventType != Csta.CSTA_SNAPSHOT_DEVICE_CONF)
            {
                if (evtBuf.evt.eventHeader.eventClass.eventClass == Csta.CSTACONFIRMATION && evtBuf.evt.eventHeader.eventType.eventType == Csta.CSTA_UNIVERSAL_FAILURE_CONF)
                {
                    MessageBox.Show("Snapshot device failed. Error: " + evtBuf.evt.cstaConfirmation.universalFailure.error);
                }
                return;
            }
            int callCountForSnapshotDevice = evtBuf.evt.cstaConfirmation.snapshotDevice.snapshotData.count;
            if (callCountForSnapshotDevice < 1)
            {
                MessageBox.Show("No active calls");
                return;
            }

            Csta.ConnectionID_t tmpConn;

            TSAPIDemo.Subforms.SnapShotDevicePopup snapShotDevicePop = new Subforms.SnapShotDevicePopup();
            snapShotDevicePop.parentForm = this;

            snapShotDevicePop.snapShotDataTree.Nodes.Clear();
            for (int i = 0; i < callCountForSnapshotDevice; i++)
            {
                var snapDeviceInfoArray = (Csta.CSTASnapshotDeviceResponseInfo_t[])evtBuf.auxData["snapDeviceInfo"];
                tmpConn = snapDeviceInfoArray[i].callIdentifier;
                CallNode callNode = new CallNode();
                callNode.Text = GetUcid(tmpConn).ToString();
                snapShotDevicePop.snapShotDataTree.Nodes.Add(callNode);

                callNode.connection = tmpConn;
                snapShotDevicePop.snapShotDataTree.Nodes[i].Text += ". States: ";
                for (int j = 0; j < snapDeviceInfoArray[i].localCallState.count; j++)
                {
                    var snapDeviceStateArray = (Csta.LocalConnectionState_t[])evtBuf.auxData["snapDeviceState" + i];
                    snapShotDevicePop.snapShotDataTree.Nodes[i].Text += "#" + (j + 1) + ": " + snapDeviceStateArray[j] + " ";
                }
                Csta.EventBuffer_t snapCallEvt = snapshotCall(tmpConn);
                snapShotDevicePop.snapShotDataTree.Nodes[i].Nodes.Clear();
                int callCountForSnapshotCall = snapCallEvt.evt.cstaConfirmation.snapshotCall.snapshotData.count;
                var snapCallInfoArray = (Csta.CSTASnapshotCallResponseInfo_t[])snapCallEvt.auxData["snapCallInfo"];
                for (int j = 0; j < callCountForSnapshotCall; j++)
                {
                    TreeNode t = new TreeNode(snapCallInfoArray[j].deviceOnCall.deviceID.ToString() + "; " + snapCallInfoArray[j].deviceOnCall.deviceIDType + "; " + snapCallInfoArray[j].deviceOnCall.deviceIDStatus);
                    snapShotDevicePop.snapShotDataTree.Nodes[i].Nodes.Add(t);
                }
                snapShotDevicePop.snapShotDataTree.Nodes[i].Expand();
            }
            snapShotDevicePop.ShowDialog();
        }
Пример #7
0
 private Csta.EventBuffer_t snapshotCall(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.cstaSnapshotCallReq(this.acsHandle,
                                          invokeId,
                                          cId,
                                          this.privData);
     if (retCode._value < 0)
     {
         MessageBox.Show("cstaSnapshotCallReq error: " + retCode);
         return null;
     }
     this.privData.length = Att.ATT_MAX_PRIVATE_DATA;
     ushort eventBufSize = Csta.CSTA_MAX_HEAP;
     ushort numEvents;
     retCode = Acs.acsGetEventBlock(this.acsHandle,
                                   evtBuf,
                                   ref eventBufSize,
                                   privData,
                                   out numEvents);
     if (retCode._value < 0)
     {
         MessageBox.Show("acsGetEventBlock error: " + retCode);
         return null;
     }
     if (evtBuf.evt.eventHeader.eventClass.eventClass != Csta.CSTACONFIRMATION ||
         evtBuf.evt.eventHeader.eventType.eventType != Csta.CSTA_SNAPSHOT_CALL_CONF)
     {
         if (evtBuf.evt.eventHeader.eventClass.eventClass == Csta.CSTACONFIRMATION
             && evtBuf.evt.eventHeader.eventType.eventType == Csta.CSTA_UNIVERSAL_FAILURE_CONF)
         {
             MessageBox.Show("Snapshot call failed. Error: " + evtBuf.evt.cstaConfirmation.universalFailure.error);
         }
     }
     return evtBuf;
 }
Пример #8
0
        private void cstaConsultantCallButton_Click(object sender, EventArgs e)
        {
            if (!streamCheckbox.Checked || deviceTextBox.Text.Length == 0 || deviceTextBox.Text.Length > 5 || !streamCheckbox.Checked) { return; }

            cstaConsultationCallPopupForm subform = new cstaConsultationCallPopupForm();
            subform.ShowDialog();
            if (subform.DialogResult == DialogResult.OK)
            {
                if (subform.consultationCallRadioButton.Checked)
                {
                    Csta.DeviceID_t dev = subform.ReturnDeviceId;
                    Acs.InvokeID_t invoikeId = new Acs.InvokeID_t();
                    Csta.ConnectionID_t[] conns = GetCurrentConnections(this.deviceTextBox.Text);

                    if (conns == null || conns.Length == 0)
                    {
                        MessageBox.Show("No active calls");
                        return;
                    }

                    // Define private data
                    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 = Encoding.ASCII.GetBytes(u2uString);
                    Array.Resize(ref u2uInfo.value, u2uSize);
                    var dummyDev = new Csta.DeviceID_t();

                    Att.attV6ConsultationCall(this.privData, ref dummyDev, false, ref u2uInfo);

                    Acs.RetCode_t retCode = Csta.cstaConsultationCall(this.acsHandle, invoikeId, conns[0], ref dev, this.privData);
                    if (retCode._value > 0)
                    {
                        Csta.EventBuffer_t evtBuf = new Csta.EventBuffer_t();
                        ushort numEvents;
                        ushort eventBufSize = Csta.CSTA_MAX_HEAP;
                        Acs.acsGetEventBlock(this.acsHandle, evtBuf, ref eventBufSize, this.privData, out numEvents);
                        if (evtBuf.evt.eventHeader.eventClass.eventClass == Csta.CSTACONFIRMATION && evtBuf.evt.eventHeader.eventType.eventType == Csta.CSTA_CONSULTATION_CALL_CONF)
                        {
                            Att.ATTEvent_t attEvt = new Att.ATTEvent_t();
                            retCode = Att.attPrivateData(this.privData, attEvt);
                            Debug.WriteLine("attPrivateData retCode = " + retCode._value);
                            if (attEvt.eventType.eventType == Att.ATT_CONSULTATION_CALL_CONF)
                                MessageBox.Show(String.Format("Consultant Call to {0} successfull! Ucid of new call = {1}", dev.ToString(), attEvt.consultationCall.ucid));
                            else
                                MessageBox.Show("Got wrong ATT Event... " + attEvt.eventType.eventType);
                        }
                        else if (evtBuf.evt.eventHeader.eventClass.eventClass == Csta.CSTACONFIRMATION && evtBuf.evt.eventHeader.eventType.eventType == Csta.CSTA_UNIVERSAL_FAILURE_CONF)
                        {
                            MessageBox.Show("Could not perform ConsultantCall. Error: " + evtBuf.evt.cstaConfirmation.universalFailure.error);
                        }
                    }
                    else
                    {
                        MessageBox.Show("There was an error during cstaConsultantCall. Code = " + retCode._value);
                    }
                }
                else if (subform.DirectAgentCallRadioButton.Checked)
                {
                    Csta.DeviceID_t dev = subform.ReturnDeviceId;
                    Acs.InvokeID_t invoikeId = new Acs.InvokeID_t();
                    Csta.ConnectionID_t[] conns = GetCurrentConnections(this.deviceTextBox.Text);

                    if (conns == null || conns.Length == 0)
                    {
                        MessageBox.Show("No active calls");
                        return;
                    }

                    // Define private data
                    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 = Encoding.ASCII.GetBytes(u2uString);
                    Array.Resize(ref u2uInfo.value, u2uSize);
                    Csta.DeviceID_t split = subform.ReturnDeviceId;

                    Att.attV6DirectAgentCall(this.privData, ref split, false, ref u2uInfo);

                    Acs.RetCode_t retCode = Csta.cstaConsultationCall(this.acsHandle, invoikeId, conns[0], ref dev, this.privData);
                    if (retCode._value > 0)
                    {
                        Csta.EventBuffer_t evtBuf = new Csta.EventBuffer_t();
                        ushort numEvents;
                        ushort eventBufSize = Csta.CSTA_MAX_HEAP;
                        Acs.acsGetEventBlock(this.acsHandle, evtBuf, ref eventBufSize, this.privData, out numEvents);
                        if (evtBuf.evt.eventHeader.eventClass.eventClass == Csta.CSTACONFIRMATION && evtBuf.evt.eventHeader.eventType.eventType == Csta.CSTA_CONSULTATION_CALL_CONF)
                        {
                            Att.ATTEvent_t attEvt = new Att.ATTEvent_t();
                            retCode = Att.attPrivateData(this.privData, attEvt);
                            if (attEvt.eventType.eventType == Att.ATT_DIRECT_AGENT_CALL)
                                MessageBox.Show(String.Format("Consultant Call to {0} successfull! Ucid of new call = {1}", dev.ToString(), attEvt.consultationCall.ucid));
                            else
                                MessageBox.Show("Got wrong ATT Event... " + attEvt.eventType.eventType);
                            Debug.WriteLine("attPrivateData retCode = " + retCode._value);
                            MessageBox.Show(String.Format("Consultant Call to {0} successfull! Ucid of new call = {1}", dev.ToString(), attEvt.conferenceCall.ucid));
                        }
                        else if (evtBuf.evt.eventHeader.eventClass.eventClass == Csta.CSTACONFIRMATION && evtBuf.evt.eventHeader.eventType.eventType == Csta.CSTA_UNIVERSAL_FAILURE_CONF)
                        {
                            MessageBox.Show("Could not perform ConsultantCall. Error: " + evtBuf.evt.cstaConfirmation.universalFailure.error);
                        }
                    }
                    else
                    {
                        MessageBox.Show("There was an error during cstaConsultantCall. Code = " + retCode._value);
                    }
                }
                else if (subform.supervisorAssistCallRadioButton.Checked)
                {
                    Csta.DeviceID_t dev = subform.ReturnDeviceId;
                    Acs.InvokeID_t invoikeId = new Acs.InvokeID_t();
                    Csta.ConnectionID_t[] conns = GetCurrentConnections(this.deviceTextBox.Text);

                    if (conns == null || conns.Length == 0)
                    {
                        MessageBox.Show("No active calls");
                        return;
                    }

                    // Define private data
                    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 = Encoding.ASCII.GetBytes(u2uString);
                    Array.Resize(ref u2uInfo.value, u2uSize);
                    Csta.DeviceID_t split = subform.ReturnDeviceId;

                    Att.attV6SupervisorAssistCall(this.privData, ref split, ref u2uInfo);

                    Acs.RetCode_t retCode = Csta.cstaConsultationCall(this.acsHandle, invoikeId, conns[0], ref dev, this.privData);
                    if (retCode._value > 0)
                    {
                        Csta.EventBuffer_t evtBuf = new Csta.EventBuffer_t();
                        ushort numEvents;
                        ushort eventBufSize = Csta.CSTA_MAX_HEAP;
                        Acs.acsGetEventBlock(this.acsHandle, evtBuf, ref eventBufSize, this.privData, out numEvents);
                        if (evtBuf.evt.eventHeader.eventClass.eventClass == Csta.CSTACONFIRMATION && evtBuf.evt.eventHeader.eventType.eventType == Csta.CSTA_CONSULTATION_CALL_CONF)
                        {
                            Att.ATTEvent_t attEvt = new Att.ATTEvent_t();
                            retCode = Att.attPrivateData(this.privData, attEvt);
                            if (attEvt.eventType.eventType == Att.ATT_DIRECT_AGENT_CALL)
                                MessageBox.Show(String.Format("Consultant Call to {0} successfull! Ucid of new call = {1}", dev.ToString(), attEvt.consultationCall.ucid));
                            else
                                MessageBox.Show("Got wrong ATT Event... " + attEvt.eventType.eventType);
                            Debug.WriteLine("attPrivateData retCode = " + retCode._value);
                            MessageBox.Show(String.Format("Consultant Call to {0} successfull! Ucid of new call = {1}", dev.ToString(), attEvt.conferenceCall.ucid));
                        }
                        else if (evtBuf.evt.eventHeader.eventClass.eventClass == Csta.CSTACONFIRMATION && evtBuf.evt.eventHeader.eventType.eventType == Csta.CSTA_UNIVERSAL_FAILURE_CONF)
                        {
                            MessageBox.Show("Could not perform ConsultantCall. Error: " + evtBuf.evt.cstaConfirmation.universalFailure.error);
                        }
                    }
                    else
                    {
                        MessageBox.Show("There was an error during cstaConsultantCall. Code = " + retCode._value);
                    }
                }
            }
        }
Пример #9
0
        private void attSingleStepTransferCallButton_Click(object sender, EventArgs e)
        {
            if (!streamCheckbox.Checked || deviceTextBox.Text.Length == 0 || deviceTextBox.Text.Length > 5 || !streamCheckbox.Checked) { return; }
            Csta.DeviceID_t currentDevice = deviceTextBox.Text;
            Csta.ConnectionID_t[] conns = GetCurrentConnections(this.deviceTextBox.Text);

            if (conns == null || conns.Length == 0)
            {
                MessageBox.Show("No active calls");
                return;
            }

            var devicePopup = new DeviceSelectPopupForm();
            devicePopup._parent = this;
            var dialogResult = devicePopup.ShowDialog();
            if (dialogResult != DialogResult.OK) return;
            Csta.DeviceID_t transferredTo = devicePopup.deviceIdTextBox.Text;
            var activeCall = conns[0];

            Acs.RetCode_t retCode = Att.attSingleStepTransferCall(this.privData, activeCall, ref transferredTo);
            Log("attSingleStepTransferCall result = " + retCode._value);

            if (retCode._value < 0) return;
            var invokeId = new Acs.InvokeID_t();
            retCode = Csta.cstaEscapeService(this.acsHandle, invokeId, this.privData);

            if (retCode._value < 0)
            {
                this.Log("cstaEscapeService result = " + retCode._value);
                return;
            }

            ushort eventBufferSize = Csta.CSTA_MAX_HEAP;
            this.privData.length = Att.ATT_MAX_PRIVATE_DATA;
            var eventBuf = new Csta.EventBuffer_t();
            ushort numEvents;
            retCode = Acs.acsGetEventBlock(this.acsHandle, eventBuf, ref eventBufferSize, this.privData, out numEvents);
            this.Log("acsGetEventBlock result = " + retCode._value);
            if (retCode._value < 0) return;

            if (eventBuf.evt.eventHeader.eventClass.eventClass == Csta.CSTACONFIRMATION && eventBuf.evt.eventHeader.eventType.eventType == Csta.CSTA_ESCAPE_SVC_CONF)
            {
                Att.ATTEvent_t attEvt = new Att.ATTEvent_t();
                retCode = Att.attPrivateData(this.privData, attEvt);
                Debug.WriteLine("attPrivateData retCode = " + retCode._value);
                if (attEvt.eventType.eventType == Att.ATT_SINGLE_STEP_TRANSFER_CALL_CONF)
                    MessageBox.Show("attSingleStepTransfer Succeded. New device = " + attEvt.ssTransferCallConf.transferredCall.deviceID);
                else
                    MessageBox.Show("Got wrong ATT Event... " + attEvt.eventType.eventType);
            }
            else
            {
                MessageBox.Show("attSingleStepConference Failed. Error was: " + eventBuf.evt.cstaConfirmation.universalFailure.error);
            }
        }
Пример #10
0
 private void acsSetHeartbeatIntervalButton_Click(object sender, EventArgs e)
 {
     acsSetHeartbeatIntervalPopupForm subform = new acsSetHeartbeatIntervalPopupForm();
     subform.ShowDialog();
     if (subform.DialogResult == DialogResult.OK)
     {
         ushort hbInterval = subform.ReturnValue;
         var invoikeId = new Acs.InvokeID_t();
         Acs.RetCode_t retCode = Acs.acsSetHeartbeatInterval(this.acsHandle, invoikeId, hbInterval, null);
         if (retCode._value > 0)
         {
             Csta.EventBuffer_t evtBuf = new Csta.EventBuffer_t();
             ushort numEvents;
             ushort eventBufSize = Csta.CSTA_MAX_HEAP;
             Acs.acsGetEventBlock(this.acsHandle, evtBuf, ref eventBufSize, null, out numEvents);
             if (evtBuf.evt.eventHeader.eventClass.eventClass == Acs.ACSCONFIRMATION && evtBuf.evt.eventHeader.eventType.eventType == Acs.ACS_UNIVERSAL_FAILURE_CONF)
             {
                 MessageBox.Show("Could not change HeartbeatInterval. Error: " + evtBuf.evt.acsConfirmation.failureEvent.error);
             }
         }
         else
         {
             MessageBox.Show("There was an error during acsSetHeartbeatInterval. Code = " + retCode._value);
         }
     }
 }
Пример #11
0
        private void cstaReconnectCallButton_Click(object sender, EventArgs e)
        {
            if (!streamCheckbox.Checked || deviceTextBox.Text.Length == 0 || deviceTextBox.Text.Length > 5 || !streamCheckbox.Checked) { return; }
            Csta.ConnectionID_t[] conns = GetCurrentConnections(this.deviceTextBox.Text);

            if (conns == null || conns.Length < 2)
            {
                MessageBox.Show("Need 2 calls to reconnect them");
                return;
            }

            var invokeId = new Acs.InvokeID_t();

            var u2uString = "Hello, I AM test u2u string";
            var u2uInfo = new Att.ATTUserToUserInfo_t();
            int u2uSize = Att.ATT_MAX_UUI_SIZE;
            u2uInfo.length = (short)u2uString.Length;
            u2uInfo.type = Att.ATTUUIProtocolType_t.UUI_IA5_ASCII;
            u2uInfo.value = Encoding.ASCII.GetBytes(u2uString);
            Array.Resize(ref u2uInfo.value, u2uSize);
            var dropResource = Att.ATTDropResource_t.DR_NONE;

            Att.attV6ReconnectCall(this.privData, dropResource, ref u2uInfo);

            Acs.RetCode_t retCode = Csta.cstaReconnectCall(this.acsHandle, invokeId, conns[0], conns[1], this.privData);
            Debug.WriteLine("cstaReconnectCall result = " + retCode._value);

            var evtBuf = new Csta.EventBuffer_t();
            ushort eventBufSize = Csta.CSTA_MAX_HEAP;
            ushort numEvents;
            retCode = Acs.acsGetEventBlock(this.acsHandle,
                                          evtBuf,
                                          ref eventBufSize,
                                          privData,
                                          out numEvents);
            if (evtBuf.evt.eventHeader.eventClass.eventClass == Csta.CSTACONFIRMATION && evtBuf.evt.eventHeader.eventType.eventType == Csta.CSTA_RECONNECT_CALL_CONF)
            {
                MessageBox.Show("cstaReconnectCall Succeded");
            }
            else
            {
                MessageBox.Show("cstaReconnectCall Failed. Error was: " + evtBuf.evt.cstaConfirmation.universalFailure.error);
            }
        }
Пример #12
0
        private void cstaMakePredictiveCallButton_Click(object sender, EventArgs e)
        {
            if (!streamCheckbox.Checked || deviceTextBox.Text.Length == 0 || deviceTextBox.Text.Length > 5 || !streamCheckbox.Checked) { return; }

            var invokeId = new Acs.InvokeID_t();
            Csta.DeviceID_t callingDevice = this.deviceTextBox.Text;
            DeviceSelectPopupForm deviceSelect = new DeviceSelectPopupForm();
            DialogResult deviceSelectDialog = deviceSelect.ShowDialog();
            if (deviceSelectDialog != DialogResult.OK) return;

            Csta.DeviceID_t calledDevice = deviceSelect.deviceIdTextBox.Text;
            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 = Encoding.ASCII.GetBytes(u2uString);
            Array.Resize(ref u2uInfo.value, u2uSize);
            Att.ATTAnswerTreat_t at = Att.ATTAnswerTreat_t.AT_NONE;
            var dummyDev = new Csta.DeviceID_t();

            Att.attV6MakePredictiveCall(this.privData, false, 2, at, ref dummyDev, ref u2uInfo);

            Csta.AllocationState_t allocState = Csta.AllocationState_t.AS_CALL_ESTABLISHED;
            Acs.RetCode_t retCode = Csta.cstaMakePredictiveCall(this.acsHandle, invokeId, ref callingDevice, ref calledDevice, allocState, this.privData);
            Debug.WriteLine("cstaMakePredictiveCall result = " + retCode._value);

            var evtBuf = new Csta.EventBuffer_t();
            ushort eventBufSize = Csta.CSTA_MAX_HEAP;
            ushort numEvents;
            retCode = Acs.acsGetEventBlock(this.acsHandle,
                                          evtBuf,
                                          ref eventBufSize,
                                          privData,
                                          out numEvents);
            if (evtBuf.evt.eventHeader.eventClass.eventClass == Csta.CSTACONFIRMATION && evtBuf.evt.eventHeader.eventType.eventType == Csta.CSTA_MAKE_PREDICTIVE_CALL_CONF)
            {
                Att.ATTEvent_t attEvt = new Att.ATTEvent_t();
                retCode = Att.attPrivateData(this.privData, attEvt);
                Debug.WriteLine("attPrivateData retCode = " + retCode._value);
                if (attEvt.eventType.eventType == Att.ATT_MAKE_PREDICTIVE_CALL_CONF)
                    MessageBox.Show(String.Format("Make Predictive Call from {0} to {1} is successfull! Ucid of new call = {2}", callingDevice.ToString(), calledDevice.ToString(), attEvt.makePredictiveCall.ucid));
                else
                    MessageBox.Show("Got wrong ATT Event... " + attEvt.eventType.eventType);

                MessageBox.Show("cstaMakePredictiveCall Succeded");
            }
            else
            {
                MessageBox.Show("cstaMakePredictiveCall Failed. Error was: " + evtBuf.evt.cstaConfirmation.universalFailure.error);
            }
        }
Пример #13
0
        private void cstaMakeCallButton_Click(object sender, EventArgs e)
        {
            if (!streamCheckbox.Checked || deviceTextBox.Text.Length == 0 || deviceTextBox.Text.Length > 5 || !streamCheckbox.Checked) { return; }

            var invokeId = new Acs.InvokeID_t();
            Csta.DeviceID_t callingDevice = this.deviceTextBox.Text;

            var deviceSelectDialog = new cstaMakeCallPopupForm();
            deviceSelectDialog.ShowDialog();
            DialogResult deviceSelectResult = deviceSelectDialog.DialogResult;
            if (deviceSelectResult != DialogResult.OK)
            {
                //MessageBox.Show("No device selected");
                return;
            }
            Csta.DeviceID_t calledDevice = deviceSelectDialog.deviceIdTextBox.Text;

            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 = Encoding.ASCII.GetBytes(u2uString);
            Array.Resize(ref u2uInfo.value, u2uSize);
            Csta.DeviceID_t destRouteOrSplit;
            if (deviceSelectDialog.destRouteOrSplitTextBox.Text == string.Empty)
                destRouteOrSplit = null;
            else
                destRouteOrSplit = deviceSelectDialog.destRouteOrSplitTextBox.Text;

            if (deviceSelectDialog.normalCallRadio.Checked)
                Att.attV6MakeCall(this.privData, ref destRouteOrSplit, false, ref u2uInfo);
            else if (deviceSelectDialog.directAgentCallRadio.Checked)
                Att.attV6DirectAgentCall(this.privData, ref destRouteOrSplit, false, ref u2uInfo);
            else if (deviceSelectDialog.supervisorAssistCallRadio.Checked)
                Att.attV6SupervisorAssistCall(this.privData, ref destRouteOrSplit, ref u2uInfo);

            Acs.RetCode_t retCode = Csta.cstaMakeCall(this.acsHandle, invokeId, ref callingDevice, ref calledDevice, this.privData);
            Debug.WriteLine("cstaMakeCall result = " + retCode._value);

            var evtBuf = new Csta.EventBuffer_t();
            ushort eventBufSize = Csta.CSTA_MAX_HEAP;
            ushort numEvents;
            retCode = Acs.acsGetEventBlock(this.acsHandle,
                                          evtBuf,
                                          ref eventBufSize,
                                          privData,
                                          out numEvents);
            if (evtBuf.evt.eventHeader.eventClass.eventClass == Csta.CSTACONFIRMATION && evtBuf.evt.eventHeader.eventType.eventType == Csta.CSTA_MAKE_CALL_CONF)
            {
                Att.ATTEvent_t attEvt = new Att.ATTEvent_t();
                retCode = Att.attPrivateData(this.privData, attEvt);
                Debug.WriteLine("attPrivateData retCode = " + retCode._value);
                if (attEvt.eventType.eventType == Att.ATT_MAKE_CALL_CONF)
                    MessageBox.Show(String.Format("Make Call from {0} to {1} is successfull! Ucid of new call = {2}", callingDevice.ToString(), calledDevice.ToString(), attEvt.consultationCall.ucid));
                else
                    MessageBox.Show("Got wrong ATT Event... " + attEvt.eventType.eventType);
            }
            else
            {
                MessageBox.Show("cstaMakeCall Failed. Error was: " + evtBuf.evt.cstaConfirmation.universalFailure.error);
            }
        }
Пример #14
0
        private void cstaGetAPICapsButton_Click(object sender, EventArgs e)
        {
            var invoikeId = new Acs.InvokeID_t();
            Acs.RetCode_t retCode = Csta.cstaGetAPICaps(this.acsHandle, invoikeId);
            if (retCode._value >= 0)
            {
                Csta.EventBuffer_t evtBuf = new Csta.EventBuffer_t();
                ushort numEvents;
                ushort eventBufSize = Csta.CSTA_MAX_HEAP;
                this.privData.length = Att.ATT_MAX_PRIVATE_DATA;
                Acs.acsGetEventBlock(this.acsHandle, evtBuf, ref eventBufSize, this.privData, out numEvents);
                if (evtBuf.evt.eventHeader.eventClass.eventClass == Csta.CSTACONFIRMATION && evtBuf.evt.eventHeader.eventType.eventType == Csta.CSTA_GETAPI_CAPS_CONF)
                {
                    System.Reflection.FieldInfo[] _PropertyInfos = evtBuf.evt.cstaConfirmation.getAPICaps.GetType().GetFields();
                    var sb = new StringBuilder();
                    sb.Append(Environment.NewLine);
                    sb.Append("Received API caps:" + Environment.NewLine);
                    foreach (var info in _PropertyInfos)
                    {
                        var value = info.GetValue(evtBuf.evt.cstaConfirmation.getAPICaps);
                        sb.Append(info.Name + "=" + value.ToString() + Environment.NewLine);
                    }
                    sb.Append(Environment.NewLine);
                    sb.Append("ATT Private API caps:" + Environment.NewLine);
                    var attEvt = new Att.ATTEvent_t();
                    retCode = Att.attPrivateData(this.privData, attEvt);
                    _PropertyInfos = attEvt.attV10GetApiCaps.GetType().GetFields();
                    foreach (var info in _PropertyInfos)
                    {
                        var value = info.GetValue(attEvt.attV10GetApiCaps);
                        sb.Append(info.Name + "=" + value.ToString() + Environment.NewLine);
                    }

                    Log(sb.ToString());
                    MessageBox.Show("Got API caps. Please refer to the log.");

                }
                else if (evtBuf.evt.eventHeader.eventClass.eventClass == Csta.CSTACONFIRMATION && evtBuf.evt.eventHeader.eventType.eventType == Csta.CSTA_UNIVERSAL_FAILURE_CONF)
                {
                    MessageBox.Show("Could not get API caps. Error: " + evtBuf.evt.cstaConfirmation.universalFailure.error);
                }
            }
        }
Пример #15
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;
        }
Пример #16
0
        private void attSelectiveListeningRetrieveButton_Click(object sender, EventArgs e)
        {
            if (!streamCheckbox.Checked || deviceTextBox.Text.Length == 0 || deviceTextBox.Text.Length > 5 || !streamCheckbox.Checked) { return; }

            Csta.DeviceID_t currentDevice = deviceTextBox.Text;
            Acs.InvokeID_t invokeId = new Acs.InvokeID_t();
            Acs.RetCode_t retCode = Csta.cstaSnapshotDeviceReq(this.acsHandle,
                                                 invokeId,
                                                 ref currentDevice,
                                                 this.privData);
            if (retCode._value < 0)
            {
                MessageBox.Show("cstaSnapshotDeviceReq error: " + retCode);
                return;
            }
            Csta.EventBuffer_t evtBuf = new Csta.EventBuffer_t();
            this.privData.length = Att.ATT_MAX_PRIVATE_DATA;
            ushort eventBufSize = Csta.CSTA_MAX_HEAP;
            ushort numEvt;
            retCode = Acs.acsGetEventBlock(this.acsHandle,
                                          evtBuf,
                                          ref eventBufSize,
                                          privData,
                                          out numEvt);
            if (retCode._value < 0)
            {
                MessageBox.Show("acsGetEventBlock error: " + retCode);
                return;
            }
            if (evtBuf.evt.eventHeader.eventClass.eventClass != Csta.CSTACONFIRMATION || evtBuf.evt.eventHeader.eventType.eventType != Csta.CSTA_SNAPSHOT_DEVICE_CONF)
            {
                if (evtBuf.evt.eventHeader.eventClass.eventClass == Csta.CSTACONFIRMATION && evtBuf.evt.eventHeader.eventType.eventType == Csta.CSTA_UNIVERSAL_FAILURE_CONF)
                {
                    MessageBox.Show("Snapshot device failed. Error: " + evtBuf.evt.cstaConfirmation.universalFailure.error);
                }
                return;
            }
            int callCountForSnapshotDevice = evtBuf.evt.cstaConfirmation.snapshotDevice.snapshotData.count;
            if (callCountForSnapshotDevice < 1)
            {
                MessageBox.Show("No active calls");
                return;
            }
            var snapDeviceInfoArray = (Csta.CSTASnapshotDeviceResponseInfo_t[])evtBuf.auxData["snapDeviceInfo"];
            var firstConn = snapDeviceInfoArray[0].callIdentifier;
            Csta.EventBuffer_t snapCallEvt = snapshotCall(firstConn);
            int callCountForSnapshotCall = snapCallEvt.evt.cstaConfirmation.snapshotCall.snapshotData.count;
            var snapCallInfoArray = (Csta.CSTASnapshotCallResponseInfo_t[])snapCallEvt.auxData["snapCallInfo"];

            var snapCallConnsArray = new Csta.ConnectionID_t[snapCallInfoArray.Length];
            for (int i = 0; i < snapCallInfoArray.Length; i++)
            {
                snapCallConnsArray[i] = snapCallInfoArray[i].callIdentifier;
            }

            var selectiveListeningRetruevePopup = new attSelectiveListeningRetrievePopupForm(snapCallConnsArray);
            selectiveListeningRetruevePopup._parent = this;
            selectiveListeningRetruevePopup.ShowDialog();
        }
Пример #17
0
        private void attSetAdviceOfChargeButton_Click(object sender, EventArgs e)
        {
            Acs.RetCode_t retCode = Att.attSetAdviceOfCharge(this.privData, true);

            var invokeId = new Acs.InvokeID_t();
            retCode = Csta.cstaEscapeService(this.acsHandle, invokeId, this.privData);

            ushort eventBufferSize = Csta.CSTA_MAX_HEAP;
            this.privData.length = Att.ATT_MAX_PRIVATE_DATA;
            var eventBuf = new Csta.EventBuffer_t();
            ushort numEvents;
            retCode = Acs.acsGetEventBlock(this.acsHandle, eventBuf, ref eventBufferSize, this.privData, out numEvents);
            this.Log("acsGetEventBlock result = " + retCode._value);
            if (retCode._value < 0) return;
            if (eventBuf.evt.eventHeader.eventClass.eventClass == Csta.CSTACONFIRMATION && eventBuf.evt.eventHeader.eventType.eventType == Csta.CSTA_ESCAPE_SVC_CONF)
            {
                Att.ATTEvent_t attEvt = new Att.ATTEvent_t();
                retCode = Att.attPrivateData(this.privData, attEvt);
                Debug.WriteLine("attPrivateData retCode = " + retCode._value);
                if (attEvt.eventType.eventType == Att.ATT_SET_ADVICE_OF_CHARGE_CONF)
                    MessageBox.Show("AdviceOfCharge is set");
                else
                    MessageBox.Show("Got wrong ATT Event... " + attEvt.eventType.eventType);
            }
            else
            {
                MessageBox.Show("SetAdviceOfCharge Failed. Error was: " + eventBuf.evt.cstaConfirmation.universalFailure.error);
            }
        }
Пример #18
0
        private void deflectCallButton_Click(object sender, EventArgs e)
        {
            if (!streamCheckbox.Checked || deviceTextBox.Text.Length == 0 || deviceTextBox.Text.Length > 5 || !streamCheckbox.Checked) { return; }
            Csta.ConnectionID_t[] conns = GetCurrentConnections(this.deviceTextBox.Text);

            if (conns == null || conns.Length == 0)
            {
                MessageBox.Show("No active calls");
                return;
            }
            var invokeId = new Acs.InvokeID_t();

            var deviceSelectDialog = new DeviceSelectPopupForm();
            deviceSelectDialog.ShowDialog();
            DialogResult deviceSelectResult = deviceSelectDialog.DialogResult;
            if (deviceSelectResult != DialogResult.OK)
            {
                //MessageBox.Show("No device selected");
                return;
            }
            Csta.DeviceID_t calledDevice = deviceSelectDialog.deviceIdTextBox.Text;

            Acs.RetCode_t retCode = Csta.cstaDeflectCall(this.acsHandle, invokeId, conns[0], ref calledDevice, null);
            Debug.WriteLine("cstaDeflectCall result = " + retCode._value);

            var evtBuf = new Csta.EventBuffer_t();
            ushort eventBufSize = Csta.CSTA_MAX_HEAP;
            ushort numEvents;
            retCode = Acs.acsGetEventBlock(this.acsHandle,
                                          evtBuf,
                                          ref eventBufSize,
                                          privData,
                                          out numEvents);
            if (evtBuf.evt.eventHeader.eventClass.eventClass == Csta.CSTACONFIRMATION && evtBuf.evt.eventHeader.eventType.eventType == Csta.CSTA_DEFLECT_CALL_CONF)
            {
                MessageBox.Show("cstaDeflectCall Succeded");
            }
            else
            {
                MessageBox.Show("cstaDeflectCall Failed. Error was: " + evtBuf.evt.cstaConfirmation.universalFailure.error);
            }
        }
Пример #19
0
        private void cstaAnswerCallButton_Click(object sender, EventArgs e)
        {
            if (!streamCheckbox.Checked || deviceTextBox.Text.Length == 0 || deviceTextBox.Text.Length > 5 || !streamCheckbox.Checked) { return; }
            Csta.ConnectionID_t[] conns = GetCurrentConnections(this.deviceTextBox.Text);
            if (conns == null || conns.Length == 0)
            {
                MessageBox.Show("No active calls");
                return;
            }
            var invokeId = new Acs.InvokeID_t();
            Acs.RetCode_t retCode = Csta.cstaAnswerCall(this.acsHandle, invokeId, conns[0], null);
            Debug.WriteLine("cstaAnswerCall result = " + retCode._value);

            var evtBuf = new Csta.EventBuffer_t();
            this.privData.length = Att.ATT_MAX_PRIVATE_DATA;
            ushort eventBufSize = Csta.CSTA_MAX_HEAP;
            ushort numEvents;
            retCode = Acs.acsGetEventBlock(this.acsHandle,
                                          evtBuf,
                                          ref eventBufSize,
                                          privData,
                                          out numEvents);
            if (evtBuf.evt.eventHeader.eventClass.eventClass == Csta.CSTACONFIRMATION && evtBuf.evt.eventHeader.eventType.eventType == Csta.CSTA_ANSWER_CALL_CONF)
            {
                MessageBox.Show("cstaAnswerCall Succeded");
            }
            else
            {
                MessageBox.Show("cstaAnswerCall Failed. Error was: " + evtBuf.evt.cstaConfirmation.universalFailure.error);
            }
        }
Пример #20
0
        private Csta.ConnectionID_t[] GetCurrentConnections(Csta.DeviceID_t device)
        {
            if (!this.configured)
            {
                MessageBox.Show("Application is not configured");
                this.mainTabs.SelectTab(configTab);
                return null;
            }
            if (!streamCheckbox.Checked || deviceTextBox.Text.Length == 0 || deviceTextBox.Text.Length > 5 || !streamCheckbox.Checked) { return null; }
            Csta.DeviceID_t currentDevice = device;
            Acs.InvokeID_t invokeId = new Acs.InvokeID_t();
            Acs.RetCode_t retCode = Csta.cstaSnapshotDeviceReq(this.acsHandle,
                                                 invokeId,
                                                 ref currentDevice,
                                                 privData);
            if (retCode._value < 0)
            {
                MessageBox.Show("cstaSnapshotDeviceReq error: " + retCode);
                return null;
            }
            var evtBuf = new Csta.EventBuffer_t();
            this.privData.length = Att.ATT_MAX_PRIVATE_DATA;
            ushort eventBufSize = Csta.CSTA_MAX_HEAP;
            ushort numEvents;
            retCode = Acs.acsGetEventBlock(this.acsHandle,
                                          evtBuf,
                                          ref eventBufSize,
                                          privData,
                                          out numEvents);

            if (retCode._value != Acs.ACSPOSITIVE_ACK)
            {
                MessageBox.Show("acsGetEventBlock error: " + retCode);
                return null;
            }
            if (evtBuf.evt.eventHeader.eventClass.eventClass != Csta.CSTACONFIRMATION || evtBuf.evt.eventHeader.eventType.eventType != Csta.CSTA_SNAPSHOT_DEVICE_CONF)
            {
                if (evtBuf.evt.eventHeader.eventClass.eventClass == Csta.CSTACONFIRMATION && evtBuf.evt.eventHeader.eventType.eventType == Csta.CSTA_UNIVERSAL_FAILURE_CONF)
                {
                    MessageBox.Show("Snapshot device failed. Error: " + evtBuf.evt.cstaConfirmation.universalFailure.error);
                }
                return null;
            }
            int callCount = evtBuf.evt.cstaConfirmation.snapshotDevice.snapshotData.count;
            Csta.ConnectionID_t[] conns = new Csta.ConnectionID_t[callCount];
            for (int i = 0; i < callCount; i++)
            {
                var snapDeviceInfoArray = (Csta.CSTASnapshotDeviceResponseInfo_t[])evtBuf.auxData["snapDeviceInfo"];
                conns[i] = snapDeviceInfoArray[i].callIdentifier;
            }
            return conns;
        }
Пример #21
0
        private void cstaConferenceCallButton_Click(object sender, EventArgs e)
        {
            if (!streamCheckbox.Checked || deviceTextBox.Text.Length == 0 || deviceTextBox.Text.Length > 5 || !streamCheckbox.Checked) { return; }
            Csta.ConnectionID_t[] conns = GetCurrentConnections(this.deviceTextBox.Text);

            if (conns == null || conns.Length < 2)
            {
                MessageBox.Show("Need 2 calls on the device to connect them in conference");
                return;
            }
            var invokeId = new Acs.InvokeID_t();
            Acs.RetCode_t retCode = Csta.cstaConferenceCall(this.acsHandle, invokeId, conns[0], conns[1], this.privData);
            Debug.WriteLine("cstaConferenceCall result = " + retCode._value);

            var evtBuf = new Csta.EventBuffer_t();
            this.privData.length = Att.ATT_MAX_PRIVATE_DATA;
            ushort eventBufSize = Csta.CSTA_MAX_HEAP;
            ushort numEvents;
            retCode = Acs.acsGetEventBlock(this.acsHandle,
                                          evtBuf,
                                          ref eventBufSize,
                                          privData,
                                          out numEvents);
            if (evtBuf.evt.eventHeader.eventClass.eventClass == Csta.CSTACONFIRMATION && evtBuf.evt.eventHeader.eventType.eventType == Csta.CSTA_CONFERENCE_CALL_CONF)
            {
                Att.ATTEvent_t attEvt = new Att.ATTEvent_t();
                retCode = Att.attPrivateData(this.privData, attEvt);
                Debug.WriteLine("attPrivateData retCode = " + retCode._value);
                MessageBox.Show("cstaConferenceCall Succeded. UCID of the new call = " + attEvt.conferenceCall.ucid);
            }
            else
            {
                MessageBox.Show("cstaConferenceCall Failed. Error was: " + evtBuf.evt.cstaConfirmation.universalFailure.error);
            }
        }
Пример #22
0
        private void openStream()
        {
            this.acsHandle = new Acs.ACSHandle_t();
            var invokeIdType = Acs.InvokeIDType_t.LIB_GEN_ID;
            var invokeId = new Acs.InvokeID_t();
            var streamType = Acs.StreamType_t.ST_CSTA;
            Acs.ServerID_t serverId = config.AppSettings.Settings["ServerID"].Value;
            Acs.LoginID_t loginId = config.AppSettings.Settings["TSAPI login"].Value;
            Acs.Passwd_t passwd = config.AppSettings.Settings["Password"].Value;
            Acs.AppName_t appName = config.AppSettings.Settings["ApplicationName"].Value;
            Acs.Level_t acsLevelReq = Acs.Level_t.ACS_LEVEL1;
            Acs.Version_t apiVer = config.AppSettings.Settings["ApiVersion"].Value;
            ushort sendQSize = 0;
            ushort sendExtraBufs = 0;
            ushort recvQSize = 0;
            ushort recvExtraBufs = 0;
            var currentDevice = deviceTextBox.Text;
            // Get supportedVersion string
            string requestedVersion = "3-10";
            System.Text.StringBuilder supportedVersion = new System.Text.StringBuilder();
            Acs.RetCode_t attrc = Att.attMakeVersionString(requestedVersion, supportedVersion);
            // Set PrivateData request
            this.privData = new Acs.PrivateData_t();
            this.privData.vendor = "VERSION";
            this.privData.data = new byte[Att.ATT_MAX_PRIVATE_DATA];
            this.privData.data[0] = Acs.PRIVATE_DATA_ENCODING;
            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 = Acs.acsOpenStream(out this.acsHandle,
                                                          invokeIdType,
                                                          invokeId,
                                                          streamType,
                                                          ref serverId,
                                                          ref loginId,
                                                          ref passwd,
                                                          ref appName,
                                                          acsLevelReq,
                                                          ref apiVer,
                                                          sendQSize,
                                                          sendExtraBufs,
                                                          recvQSize,
                                                          recvExtraBufs,
                                                          this.privData);
            Csta.EventBuffer_t evtBuf = new Csta.EventBuffer_t();
            ushort eventBufSize = Csta.CSTA_MAX_HEAP;
            ushort numEvents = 0;

            retCode = Acs.acsGetEventBlock(this.acsHandle,
                                     evtBuf,
                                     ref eventBufSize,
                                     this.privData,
                                     out numEvents);
            if (evtBuf.evt.eventHeader.eventClass.eventClass != 2 || evtBuf.evt.eventHeader.eventType.eventType != 2)
            {
                MessageBox.Show("Could not open stream. ErrorCode = " + evtBuf.evt.acsConfirmation.failureEvent.error);
                streamCheckbox.Checked = false;
                this.snapShotDeviceButton.Enabled = false;
                return;
            }
            else
            {
                streamCheckbox.Text = "Connected to AES server. Handle = " + this.acsHandle;
                streamCheckbox.Checked = true;
                this.snapShotDeviceButton.Enabled = true;
            }
        }
Пример #23
0
        private void SendDTMFToneButton_Click(object sender, EventArgs e)
        {
            if (!streamCheckbox.Checked || deviceTextBox.Text.Length == 0 || deviceTextBox.Text.Length > 5 || !streamCheckbox.Checked) { return; }
            Csta.ConnectionID_t[] conns = GetCurrentConnections(this.deviceTextBox.Text);

            if (conns == null || conns.Length == 0)
            {
                MessageBox.Show("No active calls");
                return;
            }

            var dtmfSelect = new DTMFSelectSubForm();
            DialogResult dtmfSelectDialog = dtmfSelect.ShowDialog();
            if (dtmfSelectDialog != DialogResult.OK) return;
            string tones = dtmfSelect.DTMFSequenceTextBox.Text;

            var ignored = new Att.ATTConnIDList_t();
            Acs.RetCode_t retCode = Att.attSendDTMFToneExt(this.privData, conns[0], ref ignored, tones, 0, 0);
            if (retCode._value != Acs.ACSPOSITIVE_ACK) return;

            var invokeId = new Acs.InvokeID_t();
            retCode = Csta.cstaEscapeService(this.acsHandle, invokeId, this.privData);

            var evtBuf = new Csta.EventBuffer_t();
            ushort eventBufSize = Csta.CSTA_MAX_HEAP;
            ushort numEvents;
            retCode = Acs.acsGetEventBlock(this.acsHandle,
                                          evtBuf,
                                          ref eventBufSize,
                                          privData,
                                          out numEvents);
            if (evtBuf.evt.eventHeader.eventClass.eventClass == Csta.CSTACONFIRMATION && evtBuf.evt.eventHeader.eventType.eventType == Csta.CSTA_ESCAPE_SVC_CONF)
            {
                MessageBox.Show("attSendDTMFToneExt Succeded");
            }
            else
            {
                MessageBox.Show("attSendDTMFToneExt Failed. Error was: " + evtBuf.evt.cstaConfirmation.universalFailure.error);
            }
        }
Пример #24
0
        public static Acs.RetCode_t OpenStream(out Acs.ACSHandle_t acsHandle, out Acs.InvokeID_t invokeId, ref Acs.PrivateData_t privData)
        {
            // Prepare
            Acs.InvokeIDType_t invokeIdType = Acs.InvokeIDType_t.LIB_GEN_ID;
            invokeId = new Acs.InvokeID_t();
            Acs.StreamType_t streamType = Acs.StreamType_t.ST_CSTA;
            Acs.ServerID_t serverId = "AVAYA#S8720SAMSUNG#CSTA#AESSERVER1";
            Acs.LoginID_t loginId = "tsuser";
            Acs.Passwd_t passwd = "tsuser";
            Acs.AppName_t appName = "XYITA";
            Acs.Level_t acsLevelReq = Acs.Level_t.ACS_LEVEL1;
            Acs.Version_t apiVer = "TS2";
            ushort sendQSize = 0;
            ushort sendExtraBufs = 0;
            ushort recvQSize = 0;
            ushort recvExtraBufs = 0;

            Acs.RetCode_t retCode = Acs.acsOpenStream(out acsHandle,
                                                      invokeIdType,
                                                      invokeId,
                                                      streamType,
                                                      ref serverId,
                                                      ref loginId,
                                                      ref passwd,
                                                      ref appName,
                                                      acsLevelReq,
                                                      ref apiVer,
                                                      sendQSize,
                                                      sendExtraBufs,
                                                      recvQSize,
                                                      recvExtraBufs,
                                                      ref privData);
            if (retCode._value < 0 )
            {
                return retCode;
            }
            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);
            //Console.WriteLine("acsGetEventBlock retCode = " + retCode + " Buffer size = " + eventBufSize + ", numEvents = " + numEvents);
            //Console.WriteLine("privData.Length = " + privData.length);

            return retCode;
        }