Ejemplo n.º 1
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;
        }
Ejemplo n.º 2
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);
                    }
                }
            }
        }
Ejemplo n.º 3
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);
            }
        }
Ejemplo n.º 4
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);
            }
        }
Ejemplo n.º 5
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);
            }
        }