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 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(); }