private ATTSnapshotCall_t ReadSnapshotCall(IStructReader reader) { try { if ((reader.BaseStream.Length - reader.BaseStream.Position) >= 4) { logger.Info("ATTMonitorCallConfParser.ReadSnapshotCall: read count from stream..."); uint count = reader.ReadUInt32(); logger.Info("ATTMonitorCallConfParser.ReadSnapshotCall: count={0}", count); List <CSTASnapshotCallResponseInfo_t> snapshotCalls = new List <CSTASnapshotCallResponseInfo_t>(); if (count > 0) { if ((reader.BaseStream.Length - reader.BaseStream.Position) >= 8) { logger.Info("ATTMonitorCallConfParser.ReadSnapshotCall: advance the base stream 8 positions..."); reader.BaseStream.Position += 8; } int size = Marshal.SizeOf(typeof(CSTASnapshotCallResponseInfo_t)); for (int i = 0; i < count; i++) { logger.Info("ATTMonitorCallConfParser.ReadSnapshotCall: read snap shot call response from the stream..."); if ((reader.BaseStream.Length - reader.BaseStream.Position) >= size) { object result; if (reader.TryReadStruct(typeof(CSTASnapshotCallResponseInfo_t), out result)) { logger.Info("ATTMonitorCallConfParser.ReadSnapshotCall: successfully read snap shot call response from the stream!"); CSTASnapshotCallResponseInfo_t snapshotCallInfo = (CSTASnapshotCallResponseInfo_t)result; logger.Info("ATTMonitorCallConfParser.ReadSnapshotCall: snapshotCallInfo.deviceOnCall.deviceID.device={0};snapshotCallInfo.deviceOnCall.deviceIDType={1};snapshotCallInfo.deviceOnCall.deviceIDStatus={2};snapshotCallInfo.callIdentifier.callID={3};snapshotCallInfo.callIdentifier.deviceID.device={4};snapshotCallInfo.callIdentifier.devIDType={5};snapshotCallInfo.localConnectionState={6}", snapshotCallInfo.deviceOnCall.deviceID.device, snapshotCallInfo.deviceOnCall.deviceIDType, snapshotCallInfo.deviceOnCall.deviceIDStatus, snapshotCallInfo.callIdentifier.callID, snapshotCallInfo.callIdentifier.deviceID.device, snapshotCallInfo.callIdentifier.devIDType, snapshotCallInfo.localConnectionState); snapshotCalls.Add(snapshotCallInfo); } } } } return(new ATTSnapshotCall_t() { count = count, pInfo = snapshotCalls.ToArray() }); } } catch (Exception err) { logger.Error(string.Format("Error in ATTMonitorCallConfParser.ReadSnapshotCall: {0}", err)); } return(new ATTSnapshotCall_t()); }
private DeviceHistory_t ReadDeviceHistory(IStructReader reader) { try { DeviceHistory_t deviceHistory = new DeviceHistory_t(); logger.Info("ATTDivertedParser.ReadDeviceHistory: read device history count from stream..."); uint count = reader.ReadUInt32(); logger.Info("ATTDivertedParser.ReadDeviceHistory: count={0}", count); if (count == 1) { reader.BaseStream.Position += 4; object result; logger.Info("ATTDivertedParser.ReadDeviceHistory: try to read a device history entry from the stream..."); if (reader.TryReadStruct(typeof(DeviceHistoryEntry_t), out result)) { logger.Info("ATTDivertedParser.ReadDeviceHistory: successfully read device history entry from stream!"); DeviceHistoryEntry_t deviceHistoryEntry = (DeviceHistoryEntry_t)result; logger.Info("ATTDivertedParser.ReadDeviceHistory: deviceHistoryEntry.olddeviceID={0};deviceHistoryEntry.oldconnectionID.callID={1};deviceHistoryEntry.oldconnectionID.deviceID={2};", deviceHistoryEntry.olddeviceID.device, deviceHistoryEntry.oldconnectionID.callID, deviceHistoryEntry.oldconnectionID.deviceID.device); deviceHistory = new DeviceHistory_t() { count = 1, deviceHistoryList = new DeviceHistoryEntry_t[] { deviceHistoryEntry } }; } } else { deviceHistory = new DeviceHistory_t() { count = 0, deviceHistoryList = new DeviceHistoryEntry_t[] { } }; } return(deviceHistory); } catch (Exception err) { logger.Error(string.Format("Error in ATTDivertedParser.ReadDeviceHistory: {0}", err)); } return(new DeviceHistory_t() { count = 0, deviceHistoryList = new DeviceHistoryEntry_t[] { } }); }
public ATTEvent_t Parse(IStructReader reader) { try { logger.Info("ATTSnapshotDeviceConfParser.Parse: eventType=ATT_SNAPSHOT_DEVICE_CONF"); ATTSnapshotDeviceConfEvent_t snapshotDevice = new ATTSnapshotDeviceConfEvent_t(); logger.Info("ATTSnapshotDeviceConfParser.Parse: read count from stream..."); uint count = reader.ReadUInt32(); logger.Info("ATTSnapshotDeviceConfParser.Parse: count={0}", count); List <ATTSnapshotDevice_t> snapshotDeviceList = new List <ATTSnapshotDevice_t>(); for (int i = 0; i < count; i++) { object result; logger.Info("ATTSnapshotDeviceConfParser.Parse: read snapshot device from the stream..."); if (reader.TryReadStruct(typeof(ATTSnapshotDevice_t), out result)) { logger.Info("ATTSnapshotDeviceConfParser.Parse: successfully read snapshot device from the stream!"); ATTSnapshotDevice_t device = (ATTSnapshotDevice_t)result; logger.Info("ATTSnapshotDeviceConfParser.Parse: index={0};snapshot.pSnapshotDevice.call.callID={1};snapshot.pSnapshotDevice.call.deviceID.device={2}, snapshot.pSnapshotDevice.call.devIDType={3};snapshot.pSnapshotDevice.state={4}", i, device.call.callID, device.call.deviceID.device, device.call.devIDType, device.state); snapshotDeviceList.Add(device); } } snapshotDevice.count = count; snapshotDevice.pSnapshotDevice = snapshotDeviceList.ToArray(); ATTEvent_t attEvent = new ATTEvent_t() { eventType = (ushort)eventType }; attEvent.u.snapshotDevice = snapshotDevice; return(attEvent); } catch (Exception err) { logger.Error(string.Format("Error in ATTSnapshotDeviceConfParser.Parse: {0}", err)); } return(null); }
private CSTASnapshotCallData_t ReadSnapshotCallData(IStructReader reader) { try { logger.Info("CSTASnapshotCallConfParser.ReadSnapshotCallData: read count from stream..."); uint count = reader.ReadUInt32(); logger.Info("CSTASnapshotCallConfParser.ReadSnapshotCallData: count={0}", count); logger.Info("CSTASnapshotCallConfParser.ReadSnapshotCallData: advance the base stream 4 positions..."); reader.BaseStream.Position = 20; List <CSTASnapshotCallResponseInfo_t> infoList = new List <CSTASnapshotCallResponseInfo_t>(); for (int i = 0; i < count; i++) { object result; logger.Info("CSTASnapshotCallConfParser.ReadSnapshotCallData: read snapshot call info from the stream..."); if (reader.TryReadStruct(typeof(CSTASnapshotCallResponseInfo_t), out result)) { logger.Info("CSTASnapshotCallConfParser.ReadSnapshotCallData: successfully read snapshot call info from the stream!"); CSTASnapshotCallResponseInfo_t info = (CSTASnapshotCallResponseInfo_t)result; logger.Info("CSTASnapshotCallConfParser.ReadSnapshotCallData: deviceOnCall.deviceID.device={0};deviceOnCall.deviceIDType={1};deviceOnCall.deviceIDStatus={2};callIdentifier.callID={3};callIdentifier.deviceID.device={4};callIdentifier.devIDType={5};localConnectionState={6};", info.deviceOnCall.deviceID.device, info.deviceOnCall.deviceIDType, info.deviceOnCall.deviceIDStatus, info.callIdentifier.callID, info.callIdentifier.deviceID.device, info.callIdentifier.devIDType, info.localConnectionState); infoList.Add(info); } } return(new CSTASnapshotCallData_t() { count = count, info = infoList.ToArray() }); } catch (Exception err) { logger.Error(string.Format("Error in CSTASnapshotCallConfParser.ReadSnapshotCallData: {0}", err)); } return(new CSTASnapshotCallData_t() { count = 0, info = new CSTASnapshotCallResponseInfo_t[] { } }); }
private ConnectionList_t ReadConnList(IStructReader reader) { try { logger.Info("CSTAConferenceCallConfParser.ReadConnList: BaseStream.Position={0};BaseStream.Length={1};", reader.BaseStream.Position, reader.BaseStream.Length); if ((reader.BaseStream.Length - reader.BaseStream.Position) >= 4) { logger.Info("CSTAConferenceCallConfParser.ReadConnList: read count of transferred connections..."); uint count = reader.ReadUInt32(); logger.Info("CSTAConferenceCallConfParser.ReadConnList: count={0}", count); List <Connection_t> connections = new List <Connection_t>(); if (count > 0) { if ((reader.BaseStream.Length - reader.BaseStream.Position) >= 12) { logger.Info("CSTAConferenceCallConfParser.ReadConnList: advance the base stream 12 positions..."); reader.BaseStream.Position += 12; } int size = Marshal.SizeOf(typeof(Connection_t)); for (int i = 0; i < count; i++) { logger.Info("CSTAConferenceCallConfParser.ReadConnList: try to read connection from stream..."); if ((reader.BaseStream.Length - reader.BaseStream.Position) >= size) { object result; if (reader.TryReadStruct(typeof(Connection_t), out result)) { logger.Info("CSTAConferenceCallConfParser.ReadConnList: successfully read connection from stream!"); Connection_t connection = (Connection_t)result; logger.Info("CSTAConferenceCallConfParser.ReadConnList: connection.party.callID={0};connection.party.deviceID.device={1};connection.party.devIDType={2};connection.staticDevice.deviceID.device={3};connection.staticDevice.deviceIDType={4};connection.staticDevice.deviceIDType={4};", connection.party.callID, connection.party.deviceID.device, connection.party.devIDType, connection.staticDevice.deviceID.device, connection.staticDevice.deviceIDType); connections.Add(connection); } } } } return(new ConnectionList_t() { count = count, connections = connections.ToArray() }); } } catch (Exception err) { logger.Error(string.Concat("Error in CSTAConferenceCallConfParser.ReadConnList: ", err.ToString())); } return(new ConnectionList_t() { count = 0, connections = new Connection_t[] { } }); }
private ATTOriginalCallInfo_t ReadOriginalCallInfo(IStructReader reader) { try { object result; ATTOriginalCallInfo_t originalCallInfo = new ATTOriginalCallInfo_t(); logger.Info("ATTConferencedParser.ReadOriginalCallInfo: read reason code from stream..."); int intReason = reader.ReadInt32(); logger.Info("ATTConferencedParser.ReadOriginalCallInfo: ReasonCode={0}", intReason); if (Enum.IsDefined(typeof(ATTReasonForCallInfo_t), intReason)) { ATTReasonForCallInfo_t reason = (ATTReasonForCallInfo_t)intReason; logger.Info("ATTConferencedParser.ReadOriginalCallInfo: reason={0}", reason); originalCallInfo.reason = reason; } logger.Info("ATTConferencedParser.ReadOriginalCallInfo: read calling device from stream..."); if (reader.TryReadStruct(typeof(CallingDeviceID_t), out result)) { CallingDeviceID_t callingDevice = (CallingDeviceID_t)result; logger.Info("ATTConferencedParser.ReadOriginalCallInfo: callingDevice.deviceID={0};callingDevice.deviceIDType={1};callingDevice.deviceIDStatus={2};", callingDevice.value.deviceID.device, callingDevice.value.deviceIDType, callingDevice.value.deviceIDStatus); originalCallInfo.callingDevice = callingDevice; } logger.Info("ATTConferencedParser.ReadOriginalCallInfo: read called device from stream..."); if (reader.TryReadStruct(typeof(CalledDeviceID_t), out result)) { CalledDeviceID_t calledDevice = (CalledDeviceID_t)result; logger.Info("ATTConferencedParser.ReadOriginalCallInfo: calledDevice.deviceID={0};calledDevice.deviceIDType={1};calledDevice.deviceIDStatus={2};", calledDevice.value.deviceID.device, calledDevice.value.deviceIDType, calledDevice.value.deviceIDStatus); originalCallInfo.calledDevice = calledDevice; } logger.Info("ATTConferencedParser.ReadOriginalCallInfo: read trunk group from stream..."); if (reader.TryReadStruct(typeof(DeviceID_t), out result)) { DeviceID_t trunkGroup = (DeviceID_t)result; logger.Info("ATTConferencedParser.ReadOriginalCallInfo: trunkGroup={0}", trunkGroup.device); originalCallInfo.trunkGroup = trunkGroup; } logger.Info("ATTConferencedParser.ReadOriginalCallInfo: read trunk member from stream..."); if (reader.TryReadStruct(typeof(DeviceID_t), out result)) { DeviceID_t trunkMember = (DeviceID_t)result; logger.Info("ATTConferencedParser.ReadOriginalCallInfo: trunkMember={0}", trunkMember.device); originalCallInfo.trunkMember = trunkMember; } logger.Info("ATTConferencedParser.ReadOriginalCallInfo: read look ahead info from stream..."); if (reader.TryReadStruct(typeof(ATTLookaheadInfo_t), out result)) { ATTLookaheadInfo_t lookaheadInfo = (ATTLookaheadInfo_t)result; logger.Info("ATTConferencedParser.ReadOriginalCallInfo: lookaheadInfo.type={0};lookaheadInfo.priority{1};lookaheadInfo.hours={2};lookaheadInfo.minutes={3};lookaheadInfo.seconds={4};lookaheadInfo.sourceVDN={5};lookaheadInfo.uSourceVDN.count={6};lookaheadInfo.uSourceVDN.value={7};", lookaheadInfo.type, lookaheadInfo.priority, lookaheadInfo.hours, lookaheadInfo.minutes, lookaheadInfo.seconds, lookaheadInfo.sourceVDN.device, lookaheadInfo.uSourceVDN.count, lookaheadInfo.uSourceVDN.value); originalCallInfo.lookaheadInfo = lookaheadInfo; } logger.Info("ATTConferencedParser.ReadOriginalCallInfo: read user entered code from stream..."); if (reader.TryReadStruct(typeof(ATTUserEnteredCode_t), out result)) { ATTUserEnteredCode_t userEnteredCode = (ATTUserEnteredCode_t)result; logger.Info("ATTConferencedParser.ReadOriginalCallInfo: userEnteredCode.type={0};userEnteredCode.indicator={1};userEnteredCode.data={2};userEnteredCode.collectVDN={3};", userEnteredCode.type, userEnteredCode.indicator, userEnteredCode.data, userEnteredCode.collectVDN.device); originalCallInfo.userEnteredCode = userEnteredCode; } logger.Info("ATTConferencedParser.ReadOriginalCallInfo: read user to user info from stream..."); if (reader.TryReadStruct(typeof(ATTUserToUserInfo_t), out result)) { ATTUserToUserInfo_t userInfo = (ATTUserToUserInfo_t)result; logger.Info("ATTConferencedParser.ReadOriginalCallInfo: userInfo.type={0};userInfo.length={1};userInfo.data={2};", userInfo.type, userInfo.length, userInfo.data); originalCallInfo.userInfo = userInfo; } logger.Info("ATTConferencedParser.ReadOriginalCallInfo: read ucid from stream..."); if (reader.TryReadStruct(typeof(ATTUCID_t), out result)) { ATTUCID_t ucid = (ATTUCID_t)result; logger.Info("ATTConferencedParser.ReadOriginalCallInfo: ucid={0}", ucid.value); originalCallInfo.ucid = ucid; } logger.Info("ATTConferencedParser.ReadOriginalCallInfo: read call originator info from stream..."); if (reader.TryReadStruct(typeof(ATTCallOriginatorInfo_t), out result)) { ATTCallOriginatorInfo_t callOriginatorInfo = (ATTCallOriginatorInfo_t)result; logger.Info("ATTConferencedParser.ReadOriginalCallInfo: callOriginatorInfo.hasInfo={0};callOriginatorInfo.callOriginatorType={1};", callOriginatorInfo.hasInfo, callOriginatorInfo.callOriginatorType); originalCallInfo.callOriginatorInfo = callOriginatorInfo; } logger.Info("ATTConferencedParser.ReadOriginalCallInfo: read flexible billing from stream..."); bool flexibleBilling = reader.ReadBoolean(); logger.Info("ATTConferencedParser.ReadOriginalCallInfo: flexibleBilling={0}", flexibleBilling); originalCallInfo.flexibleBilling = flexibleBilling; logger.Info("ATTConferencedParser.ReadOriginalCallInfo: advance base stream 3 positions due to pack size of 4..."); reader.BaseStream.Position += 3; DeviceHistory_t deviceHistory = new DeviceHistory_t(); logger.Info("ATTConferencedParser.ReadOriginalCallInfo: read device history count from stream..."); uint count = reader.ReadUInt32(); logger.Info("ATTConferencedParser.ReadOriginalCallInfo: count={0}", count); if (count == 1) { reader.BaseStream.Position += 4; logger.Info("ATTConferencedParser.ReadDeviceHistory: try to read a device history entry from the stream..."); if (reader.TryReadStruct(typeof(DeviceHistoryEntry_t), out result)) { logger.Info("ATTConferencedParser.ReadDeviceHistory: successfully read device history entry from stream!"); DeviceHistoryEntry_t deviceHistoryEntry = (DeviceHistoryEntry_t)result; logger.Info("ATTConferencedParser.ReadDeviceHistory: deviceHistoryEntry.olddeviceID={0};deviceHistoryEntry.oldconnectionID.callID={1};deviceHistoryEntry.oldconnectionID.deviceID={2};", deviceHistoryEntry.olddeviceID.device, deviceHistoryEntry.oldconnectionID.callID, deviceHistoryEntry.oldconnectionID.deviceID.device); deviceHistory = new DeviceHistory_t() { count = 1, deviceHistoryList = new DeviceHistoryEntry_t[] { deviceHistoryEntry } }; } } else { deviceHistory = new DeviceHistory_t() { count = 0, deviceHistoryList = new DeviceHistoryEntry_t[] { } }; } originalCallInfo.deviceHistory = deviceHistory; return(originalCallInfo); } catch (Exception err) { logger.Error(string.Format("Error in ATTConferencedParser.ReadOriginalCallInfo: {0}", err)); } return(new ATTOriginalCallInfo_t()); }
public ATTEvent_t Parse(IStructReader reader) { try { logger.Info("ATTLinkStatusParser.Parse: eventType=ATT_LINK_STATUS"); ATTLinkStatusEvent_t linkStatus = new ATTLinkStatusEvent_t(); logger.Info("ATTLinkStatusParser.Parse: read count from stream..."); uint count = reader.ReadUInt32(); logger.Info("ATTLinkStatusParser.Parse: count={0}", count); List <ATTLinkStatus_t> linkStatusList = new List <ATTLinkStatus_t>(); for (int i = 0; i < count; i++) { short linkID = 0; if ((reader.BaseStream.Length - reader.BaseStream.Position) >= 2) { logger.Info("ATTLinkStatusParser.Parse: read link id from stream..."); linkID = reader.ReadInt16(); logger.Info("ATTLinkStatusParser.Parse: linkID={0}", linkID); } if ((reader.BaseStream.Length - reader.BaseStream.Position) >= 2) { logger.Info("ATTLinkStatusParser.Parse: advance position of base stream by 2 positions..."); reader.BaseStream.Position += 2; } ATTLinkState_t linkState = ATTLinkState_t.LS_LINK_UNAVAIL; if ((reader.BaseStream.Length - reader.BaseStream.Position) >= 4) { logger.Info("ATTLinkStatusParser.Parse: read link state from stream..."); var value = reader.ReadInt32(); logger.Info("ATTLinkStatusParser.Parse: value={0}", value); if (Enum.IsDefined(typeof(ATTLinkState_t), value)) { linkState = (ATTLinkState_t)value; logger.Info("ATTLinkStatusParser.Parse: linkState={0}", linkState); } } ATTLinkStatus_t status = new ATTLinkStatus_t() { linkID = linkID, linkState = linkState }; linkStatusList.Add(status); } linkStatus.count = count; linkStatus.pLinkStatus = linkStatusList.ToArray(); ATTEvent_t attEvent = new ATTEvent_t() { eventType = (ushort)eventType }; attEvent.u.linkStatus = linkStatus; return(attEvent); } catch (Exception err) { logger.Error(string.Format("Error in ATTLinkStatusParser.Parse: {0}", err)); } return(null); }