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); } }
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 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); } }
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; }
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); } }
private void attSetBillRateButton_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 popup = new attSetBillRatePopupForm(); DialogResult dialogResult = popup.ShowDialog(); if (dialogResult != DialogResult.OK) return; Att.ATTBillType_t billType = popup.billType; float billRate = popup.billRate; Acs.RetCode_t retCode = Att.attSetBillRate(this.privData, conns[0], billType, billRate); retCode = Csta.cstaEscapeService(this.acsHandle, new Acs.InvokeID_t(), 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_BILL_RATE_CONF) MessageBox.Show("Bill rate is set"); else MessageBox.Show("Got wrong ATT Event... " + attEvt.eventType.eventType); } else { MessageBox.Show("attSetBillRate Failed. Error was: " + eventBuf.evt.cstaConfirmation.universalFailure.error); } }
private void cstaSetAgentStateButton_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; var popup = new cstaSetAgentStatePopupForm(); DialogResult dialogResult = popup.ShowDialog(); if (dialogResult != DialogResult.OK) return; Csta.AgentID_t agentId = popup.agentId; Csta.AgentMode_t agentMode = popup.agentMode; Att.ATTWorkMode_t workMode = popup.workMode; int reasonCode = popup.reasonCode; bool enablePending = popup.enablePending; Csta.AgentGroup_t agentGroup = new Csta.AgentGroup_t(); Csta.AgentPassword_t agentPass = ""; Acs.RetCode_t retCode = Att.attV6SetAgentState(this.privData, workMode, reasonCode, enablePending); Log("attV6SetAgentState result = " + retCode._value); retCode = Csta.cstaSetAgentState(this.acsHandle, new Acs.InvokeID_t(), ref currentDevice, agentMode, agentId, agentGroup, agentPass, this.privData); this.Log("cstaSetAgentState result = " + retCode._value); if (retCode._value < 0) 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_SET_AGENT_STATE_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_AGENT_STATE_CONF) MessageBox.Show(string.Format("cstaSetAgentState {0} succeded. Pending? {1}", agentMode, attEvt.setAgentState.isPending)); else MessageBox.Show("Got wrong ATT Event... " + attEvt.eventType.eventType); } else { MessageBox.Show("cstaSetAgentState Failed. Error was: " + eventBuf.evt.cstaConfirmation.universalFailure.error); } }
private void cstaTransferCallButton_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; } Acs.RetCode_t retCode = Csta.cstaTransferCall(this.acsHandle, new Acs.InvokeID_t(), conns[1], conns[0], 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_TRANSFER_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_TRANSFER_CALL_CONF) MessageBox.Show("TransferCall Succeded. New call UCID = " + attEvt.transferCall.ucid); else MessageBox.Show("Got wrong ATT Event... " + attEvt.eventType.eventType); } else { MessageBox.Show("TransferCall Failed. Error was: " + eventBuf.evt.cstaConfirmation.universalFailure.error); } }
private void cstaQueryDeviceInfoButton_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.RetCode_t retCode = Csta.cstaQueryDeviceInfo(this.acsHandle, new Acs.InvokeID_t(), ref currentDevice, this.privData); if (retCode._value < 0) 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); if (retCode._value < 0) return; if (eventBuf.evt.eventHeader.eventClass.eventClass == Csta.CSTACONFIRMATION && eventBuf.evt.eventHeader.eventType.eventType == Csta.CSTA_QUERY_DEVICE_INFO_CONF) { Log("Device: " + eventBuf.evt.cstaConfirmation.queryDeviceInfo.device); Log("Device Class: " + eventBuf.evt.cstaConfirmation.queryDeviceInfo.deviceClass); Log("Device Type: " + eventBuf.evt.cstaConfirmation.queryDeviceInfo.deviceType); Att.ATTEvent_t attEvt = new Att.ATTEvent_t(); retCode = Att.attPrivateData(this.privData, attEvt); if (attEvt.eventType.eventType == Att.ATT_QUERY_DEVICE_INFO_CONF) { Log("Associated Class: " + attEvt.queryDeviceInfo.associatedClass); Log("Associated Device: " + attEvt.queryDeviceInfo.associatedDevice); Log("Extension Class: " + attEvt.queryDeviceInfo.extensionClass); } MessageBox.Show("cstaQueryDeviceInfo succeded. Look into the log for details"); } else MessageBox.Show("cstaQueryDeviceInfo Failed. Error was: " + eventBuf.evt.cstaConfirmation.universalFailure.error); }
private void cstaQueryMsgWaitingIndButton_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.RetCode_t retCode = Csta.cstaQueryMsgWaitingInd(this.acsHandle, new Acs.InvokeID_t(), ref currentDevice, this.privData); if (retCode._value < 0) 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); if (retCode._value < 0) return; if (eventBuf.evt.eventHeader.eventClass.eventClass == Csta.CSTACONFIRMATION && eventBuf.evt.eventHeader.eventType.eventType == Csta.CSTA_QUERY_MWI_CONF) { Log("Got messages on " + currentDevice + "? " + eventBuf.evt.cstaConfirmation.queryMwi.messages); if (eventBuf.evt.cstaConfirmation.queryMwi.messages == false) { return; } Att.ATTEvent_t attEvt = new Att.ATTEvent_t(); retCode = Att.attPrivateData(this.privData, attEvt); if (attEvt.eventType.eventType == Att.ATT_QUERY_MWI_CONF) { Log("Application type = " + attEvt.queryMwi.applicationType._value); } MessageBox.Show("cstaQueryMsgWaitingInd succeded. Look into the log for details"); } else MessageBox.Show("cstaQueryMsgWaitingInd Failed. Error was: " + eventBuf.evt.cstaConfirmation.universalFailure.error); }
private void cstaQueryAgentStateButton_Click(object sender, EventArgs e) { var popup = new cstaQueryAgentStatePopupForm(); popup.ShowDialog(); if (popup.DialogResult != DialogResult.OK) return; var agentId = popup.device; var split = popup.split; // Prepare ATT request Acs.RetCode_t retCode = Att.attQueryAgentState(this.privData, ref split); if (retCode._value < 0 ) { Log ("ATT error during attQueryAgentState. Error = " + retCode._value); return; } // Make CSTA call retCode = Csta.cstaQueryAgentState(this.acsHandle, new Acs.InvokeID_t(), ref agentId, this.privData); if (retCode._value < 0) { Log("CSTA error during cstaQueryAgentState. Error = " + retCode._value); return; } // Get CSTA results 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) { Log("CSTA error during acsGetEventBlock. Error = " + retCode._value); return; } if (eventBuf.evt.eventHeader.eventClass.eventClass != Csta.CSTACONFIRMATION || eventBuf.evt.eventHeader.eventType.eventType != Csta.CSTA_QUERY_AGENT_STATE_CONF ) { Log("cstaQueryAgentState failed. Error = " + eventBuf.evt.cstaConfirmation.universalFailure.error); return; } if (eventBuf.evt.cstaConfirmation.queryAgentState.agentState == Csta.AgentState_t.AG_NULL) { Log("AgentID status:" + eventBuf.evt.cstaConfirmation.queryAgentState.agentState); return; } // Decode ATT Results var attEvt = new Att.ATTEvent_t(); retCode = Att.attPrivateData(this.privData, attEvt); if (retCode._value < 0) { Log("ATT error during attPrivateData. Error = " + retCode._value); return; } if (attEvt.eventType.eventType != Att.ATT_QUERY_AGENT_STATE_CONF) if (retCode._value < 0) { Log("Wrong ATT Event recieved: " + retCode._value); return; } // Get the output Log("AgentID status:" + eventBuf.evt.cstaConfirmation.queryAgentState.agentState); Log("Work mode: " + attEvt.queryAgentState.workMode); Log("Talk state: " + attEvt.queryAgentState.talkState); Log("Reason code: " + attEvt.queryAgentState.reasonCode); Log("Pending work mode: " + attEvt.queryAgentState.pendingWorkMode); Log("Pending reason code: " + attEvt.queryAgentState.pendingReasonCode); }
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 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); } }
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); } } }
public void GetAttEvents(Acs.ACSHandle_t acsHandle, Acs.PrivateData_t privData) { this.cstaReturnCode = Csta.cstaEscapeService(acsHandle, new Acs.InvokeID_t(), privData); if (this.cstaReturnCode._value < 0) return; var cstaEvtBuf = new Csta.EventBuffer_t(); ushort eventBufferSize = Csta.CSTA_MAX_HEAP; privData.length = Att.ATT_MAX_PRIVATE_DATA; ushort numEvents; this.cstaReturnCode = Acs.acsGetEventBlock(acsHandle, cstaEvtBuf, ref eventBufferSize, privData, out numEvents); if (this.cstaReturnCode._value < 0) return; if (cstaEvtBuf.evt.eventHeader.eventClass.eventClass != Csta.CSTACONFIRMATION || cstaEvtBuf.evt.eventHeader.eventType.eventType != Csta.CSTA_ESCAPE_SVC_CONF) { this.cstaError = cstaEvtBuf.evt.cstaConfirmation.universalFailure; return; } List<Att.ATTEvent_t> attEvtsList = new List<ATTEvent_t>(); var attEvt = new Att.ATTEvent_t(); this.attReturnCode = Att.attPrivateData(privData, attEvt); if (this.attReturnCode._value < 0) return; attEvtsList.Add(attEvt); if (attEvt.eventType.eventType == Att.ATT_QUERY_AGENT_LOGIN_CONF) { // The number of events is sometimes erroneously set to 0, // but there should always be at least one additional event // with attQueryAgentLogin() numEvents = 1; while (numEvents > 0 || attEvt.queryAgentLoginResp.count > 0) { attEvt = new Att.ATTEvent_t(); eventBufferSize = Csta.CSTA_MAX_HEAP; privData.length = Att.ATT_MAX_PRIVATE_DATA; this.cstaReturnCode = Acs.acsGetEventBlock(acsHandle, cstaEvtBuf, ref eventBufferSize, privData, out numEvents); if (this.cstaReturnCode._value < 0) return; if ((cstaEvtBuf.evt.eventHeader.eventClass.eventClass == Csta.CSTACONFIRMATION || cstaEvtBuf.evt.eventHeader.eventClass.eventClass == Csta.CSTAEVENTREPORT) && (cstaEvtBuf.evt.eventHeader.eventType.eventType == Csta.CSTA_ESCAPE_SVC_CONF || cstaEvtBuf.evt.eventHeader.eventType.eventType == Csta.CSTA_PRIVATE)) { this.attReturnCode = Att.attPrivateData(privData, attEvt); if (this.attReturnCode._value >= 0) attEvtsList.Add(attEvt); } else { this.cstaError = cstaEvtBuf.evt.cstaConfirmation.universalFailure; return; } } } else { while (numEvents > 0) { attEvt = new Att.ATTEvent_t(); eventBufferSize = Csta.CSTA_MAX_HEAP; privData.length = Att.ATT_MAX_PRIVATE_DATA; this.cstaReturnCode = Acs.acsGetEventBlock(acsHandle, cstaEvtBuf, ref eventBufferSize, privData, out numEvents); if (this.cstaReturnCode._value < 0) return; if ((cstaEvtBuf.evt.eventHeader.eventClass.eventClass == Csta.CSTACONFIRMATION || cstaEvtBuf.evt.eventHeader.eventClass.eventClass == Csta.CSTAEVENTREPORT) && (cstaEvtBuf.evt.eventHeader.eventType.eventType == Csta.CSTA_ESCAPE_SVC_CONF || cstaEvtBuf.evt.eventHeader.eventType.eventType == Csta.CSTA_PRIVATE)) { this.attReturnCode = Att.attPrivateData(privData, attEvt); if (this.attReturnCode._value >= 0) attEvtsList.Add(attEvt); } else { this.cstaError = cstaEvtBuf.evt.cstaConfirmation.universalFailure; return; } } } this.attEvts = attEvtsList.ToArray(); }