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); } } } }
private void okButton_Click(object sender, EventArgs e) { this.ReturnDeviceId = this.deviceIdTextBox.Text; this.DialogResult = DialogResult.OK; }
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); } }
private void goButton_Click(object sender, EventArgs e) { this.device = DeviceTextBox.Text; this.split = splitTextBox.Text; this.DialogResult = DialogResult.OK; }