public static extern RetCode_t acsGetEventBlock( ACSHandle_t acsHandle, [In, Out, MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Csta.EventBuffer_t))] Csta.EventBuffer_t eventBuf, ref ushort eventBufSize, [In, Out] PrivateData_t privData, out ushort numEvents);
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); }
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; }
public static ICustomMarshaler GetInstance(string cookie) { if (instance == null) { instance = new EventBuffer_t(); } return(instance); }
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; }
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); }
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; }
public System.IntPtr MarshalManagedToNative(object managedObj) { if (!(managedObj is Csta.EventBuffer_t)) { throw new ArgumentException("Specified object is not a Csta.EventBuffer_t object.", "managedObj"); } else { this.marshaledObj = (Csta.EventBuffer_t)managedObj; } IntPtr ptr = Marshal.AllocHGlobal(this.GetNativeDataSize()); if (ptr == IntPtr.Zero) { throw new Exception("Unable to allocate memory to."); } // We need to pass only CSTAEvent_t part Marshal.StructureToPtr(this.marshaledObj.evt, ptr, false); return(ptr); }
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; } }
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); } }
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 Csta.EventBuffer_t getDeviceList(Acs.ACSHandle_t acsHandle) { Csta.EventBuffer_t evtBuf = new Csta.EventBuffer_t(); Acs.PrivateData_t privData = new Acs.PrivateData_t(); int idx = -1; Acs.RetCode_t retCode = Csta.cstaGetDeviceList(acsHandle, new Acs.InvokeID_t(), idx, Csta.CSTALevel_t.CSTA_HOME_WORK_TOP); this.privData.length = Att.ATT_MAX_PRIVATE_DATA; ushort eventBufSize = Csta.CSTA_MAX_HEAP * 2; ushort numEvents; Acs.acsGetEventBlock(this.acsHandle, evtBuf, ref eventBufSize, privData, out numEvents); idx = evtBuf.evt.cstaConfirmation.getDeviceList.index; retCode = Csta.cstaGetDeviceList(acsHandle, new Acs.InvokeID_t(), idx, Csta.CSTALevel_t.CSTA_HOME_WORK_TOP); this.privData.length = Att.ATT_MAX_PRIVATE_DATA; eventBufSize = Csta.CSTA_MAX_HEAP; Acs.acsGetEventBlock(this.acsHandle, evtBuf, ref eventBufSize, privData, out numEvents); return evtBuf; }
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 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 cstaSetDoNotDisturbButton_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.cstaSetDoNotDisturb(this.acsHandle, new Acs.InvokeID_t(), ref currentDevice, true, 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_SET_DND_CONF) MessageBox.Show("cstaSetDoNotDisturb succeded"); else MessageBox.Show("cstaSetDoNotDisturb Failed. Error was: " + eventBuf.evt.cstaConfirmation.universalFailure.error); }
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."); }
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); } } }
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 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); } }
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 cstaQueryForwardingButton_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.cstaQueryForwarding(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_FWD_CONF) { Log("Fwd enabled? " + eventBuf.evt.cstaConfirmation.queryFwd.forward.param[0].forwardingOn); if (eventBuf.evt.cstaConfirmation.queryFwd.forward.param[0].forwardingOn != 0) { Log("Fwd DN: " + eventBuf.evt.cstaConfirmation.queryFwd.forward.param[0].forwardDN); Log("Forwarding Type: " + eventBuf.evt.cstaConfirmation.queryFwd.forward.param[0].forwardingType); } MessageBox.Show("cstaQueryForwarding succeded. Look into the log for details"); } else MessageBox.Show("cstaQueryForwarding Failed. Error was: " + eventBuf.evt.cstaConfirmation.universalFailure.error); }
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; }
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 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(); }
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); } }
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(); }
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); } }
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 cstaQueryCallMonitorButton_Click(object sender, EventArgs e) { Acs.RetCode_t retCode = Csta.cstaQueryCallMonitor(this.acsHandle, new Acs.InvokeID_t()); 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 == Csta.CSTACONFIRMATION && evtBuf.evt.eventHeader.eventType.eventType == Csta.CSTA_QUERY_CALL_MONITOR_CONF) { if (evtBuf.evt.cstaConfirmation.queryCallMonitor.callMonitor) { MessageBox.Show("ACS stream has permission in the security database to do call/call monitoring."); } else { MessageBox.Show("ACS stream has NO permission in the security database to do call/call monitoring."); } } else if (evtBuf.evt.eventHeader.eventClass.eventClass == Csta.CSTACONFIRMATION && evtBuf.evt.eventHeader.eventType.eventType == Csta.CSTA_UNIVERSAL_FAILURE_CONF) { MessageBox.Show("Could not determine queryCallMonitor permissions. Error: " + evtBuf.evt.cstaConfirmation.universalFailure.error); } } }
private Csta.EventBuffer_t closeStream(Acs.ACSHandle_t acsHandle) { Csta.EventBuffer_t evtBuf = new Csta.EventBuffer_t(); Acs.RetCode_t retCode = Acs.acsCloseStream(acsHandle, new Acs.InvokeID_t(), null); ushort eventBufSize = Csta.CSTA_MAX_HEAP; ushort numEvents; retCode = Acs.acsGetEventBlock(this.acsHandle, evtBuf, ref eventBufSize, null, out numEvents); if (retCode._value < 0) { MessageBox.Show("acsGetEventBlock error: " + retCode); return null; } if (evtBuf.evt.eventHeader.eventClass.eventClass != Acs.ACSCONFIRMATION || evtBuf.evt.eventHeader.eventType.eventType != Acs.ACS_CLOSE_STREAM_CONF) { if (evtBuf.evt.eventHeader.eventClass.eventClass == Acs.ACSCONFIRMATION && evtBuf.evt.eventHeader.eventType.eventType == Acs.ACS_UNIVERSAL_FAILURE_CONF) { MessageBox.Show("Clear call failed. Error: " + evtBuf.evt.cstaConfirmation.universalFailure.error); } } return evtBuf; }
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); } }
private void cstaSetMsgWaitingIndButton_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 cstaSetMsgWaitingIndPopupForm(); var dialogResult = popup.ShowDialog(); if (dialogResult != DialogResult.OK) return; bool mwiEnabled = popup.mwiEnabled; Acs.RetCode_t retCode = Csta.cstaSetMsgWaitingInd(this.acsHandle, new Acs.InvokeID_t(), ref currentDevice, mwiEnabled, 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); 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_MWI_CONF) MessageBox.Show("cstaSetMsgWaitingInd succeded"); else MessageBox.Show("cstaSetMsgWaitingInd Failed. Error was: " + eventBuf.evt.cstaConfirmation.universalFailure.error); }
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; }
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 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); } }