Skip to content

Commit d77d471

Browse files
committed
add TelcoGeneratorCore project
1 parent 3ab49b4 commit d77d471

File tree

7 files changed

+730
-0
lines changed

7 files changed

+730
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 16
4+
VisualStudioVersion = 16.0.32602.290
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TelcoGeneratorCore", "TelcoGeneratorCore\TelcoGeneratorCore.csproj", "{57B6140A-E68A-4BEB-93CD-E4184EA46F9D}"
7+
EndProject
8+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TwitterClientCore", "TwitterClientCore\TwitterClientCore.csproj", "{4B42D4AE-A957-4BC5-B8D0-381F772CFBAB}"
9+
EndProject
10+
Global
11+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
12+
Debug|Any CPU = Debug|Any CPU
13+
Release|Any CPU = Release|Any CPU
14+
EndGlobalSection
15+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
16+
{57B6140A-E68A-4BEB-93CD-E4184EA46F9D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
17+
{57B6140A-E68A-4BEB-93CD-E4184EA46F9D}.Debug|Any CPU.Build.0 = Debug|Any CPU
18+
{57B6140A-E68A-4BEB-93CD-E4184EA46F9D}.Release|Any CPU.ActiveCfg = Release|Any CPU
19+
{57B6140A-E68A-4BEB-93CD-E4184EA46F9D}.Release|Any CPU.Build.0 = Release|Any CPU
20+
{4B42D4AE-A957-4BC5-B8D0-381F772CFBAB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21+
{4B42D4AE-A957-4BC5-B8D0-381F772CFBAB}.Debug|Any CPU.Build.0 = Debug|Any CPU
22+
{4B42D4AE-A957-4BC5-B8D0-381F772CFBAB}.Release|Any CPU.ActiveCfg = Release|Any CPU
23+
{4B42D4AE-A957-4BC5-B8D0-381F772CFBAB}.Release|Any CPU.Build.0 = Release|Any CPU
24+
EndGlobalSection
25+
GlobalSection(SolutionProperties) = preSolution
26+
HideSolutionNode = FALSE
27+
EndGlobalSection
28+
GlobalSection(ExtensibilityGlobals) = postSolution
29+
SolutionGuid = {5CFD7572-EC31-45E4-91E1-316F3472DB63}
30+
EndGlobalSection
31+
EndGlobal
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<appSettings>
4+
<!-- Event Hub specific app setings for messaging connections -->
5+
<add key="EventHubName" value="***ENTER YOUR EVENT HUB NAME***"/>
6+
<add key="EventHubConnectionString" value="***ENTER YOUR KEY***"/>
7+
</appSettings>
8+
</configuration>
Lines changed: 265 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,265 @@
1+
//*********************************************************
2+
//
3+
// Copyright (c) Microsoft. All rights reserved.
4+
// This code is licensed under the Microsoft Public License.
5+
// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
6+
// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
7+
// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
8+
// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
9+
//
10+
//*********************************************************
11+
using System;
12+
using System.Collections;
13+
using System.Runtime.Serialization;
14+
using System.Text;
15+
16+
namespace telcodatagen
17+
{
18+
19+
[DataContract]
20+
public class CDRrecord
21+
{
22+
[DataMember]
23+
public String RecordType { get; set; }
24+
25+
[DataMember]
26+
public String SystemIdentity { get; set; }
27+
28+
[DataMember]
29+
public String FileNum { get; set; }
30+
31+
[DataMember]
32+
public String SwitchNum { get; set; }
33+
34+
35+
[DataMember]
36+
public String CallingNum { get; set; }
37+
38+
[DataMember]
39+
public String CallingIMSI { get; set; }
40+
41+
[DataMember]
42+
public String CalledNum { get; set; }
43+
44+
[DataMember]
45+
public String CalledIMSI { get; set; }
46+
47+
[DataMember]
48+
public String DateS { get; set; }
49+
50+
51+
[DataMember]
52+
public String TimeS { get; set; }
53+
54+
55+
[DataMember]
56+
public int TimeType { get; set; }
57+
58+
[DataMember]
59+
public int CallPeriod { get; set; }
60+
61+
[DataMember]
62+
public String CallingCellID { get; set; }
63+
64+
[DataMember]
65+
public String CalledCellID { get; set; }
66+
67+
[DataMember]
68+
public String ServiceType { get; set; }
69+
70+
[DataMember]
71+
public int Transfer { get; set; }
72+
73+
[DataMember]
74+
public String IncomingTrunk { get; set; }
75+
76+
[DataMember]
77+
public String OutgoingTrunk { get; set; }
78+
79+
[DataMember]
80+
public String MSRN { get; set; }
81+
82+
[DataMember]
83+
public String CalledNum2 { get; set; }
84+
85+
[DataMember]
86+
public String FCIFlag { get; set; }
87+
88+
[DataMember]
89+
public DateTime callrecTime { get; set; }
90+
91+
92+
93+
94+
static string[] columns = {"RecordType","SystemIdentity","FileNum","SwitchNum","CallingNum","CallingIMSI",
95+
"CalledNum","CalledIMSI","Date","Time","TimeType","CallPeriod","CallingCellID","CalledCellID",
96+
"ServiceType","Transfer","IMEI","EndType","IncomingTrunk","OutgoingTrunk","MSRN","CalledNum2","FCIFlag","DateTime"};
97+
98+
static string[] ServiceTypeList = { "a", "b", "S", "V" };
99+
static string[] TimeTypeList = { "a", "d", "r", "s" };
100+
static string[] EndTypeList = { "0", "3", "4" };
101+
static string[] OutgoingTrunkList = { "F", "442", "623", "418", "425", "443", "426", "621", "614", "609", "419", "402", "411", "422", "420", "423", "421", "300", "400", "405", "409", "424" };
102+
static string[] IMSIList = { "466923300507919", "466921602131264", "466923200348594", "466922002560205", "466922201102759", "466922702346260", "466920400352400", "466922202546859", "466923000886460", "466921302209862", "466923101048691", "466921200135361", "466922202613463", "466921402416657", "466921402237651", "466922202679249", "466923300236137", "466921602343040", "466920403025604", "262021390056324", "466920401237309", "466922000696024", "466923100098619", "466922702341485", "466922200432822", "466923000464324", "466923200779222", "466923100807296", "466923200408045" };
103+
static string[] MSRNList = { "886932428687", "886932429021", "886932428306", "1415982715962", "886932429979", "1416916990491", "886937415371", "886932428876", "886932428688", "1412983121877", "886932429242", "1416955584542", "886932428258", "1412930064972", "886932429155", "886932423548", "1415980332015", "14290800303585", "14290800033338", "886932429626", "886932428112", "1417955696232", "1418986850453", "886932428927", "886932429827", "886932429507", "1416960750071", "886932428242", "886932428134", "886932429825", "" };
104+
105+
static Random coin = new Random();
106+
Hashtable data;
107+
108+
public CDRrecord()
109+
{
110+
data = new Hashtable();
111+
_init();
112+
}
113+
114+
public void _init()
115+
{
116+
int idx = 0;
117+
// Initialize default values
118+
data.Add("SystemIdentity", "d0");
119+
data.Add("RecordType", "MO");
120+
this.SystemIdentity = "d0";
121+
this.RecordType = "MO";
122+
123+
124+
idx = coin.Next(0, TimeTypeList.Length);
125+
data.Add("TimeType", idx);
126+
this.TimeType = idx;
127+
128+
idx = coin.Next(0, ServiceTypeList.Length);
129+
data.Add("ServiceType", ServiceTypeList[idx]);
130+
this.ServiceType = ServiceTypeList[idx];
131+
132+
idx = coin.Next(0, EndTypeList.Length);
133+
data.Add("EndType", EndTypeList[idx]);
134+
135+
136+
idx = coin.Next(0, OutgoingTrunkList.Length);
137+
data.Add("OutgoingTrunk", OutgoingTrunkList[idx]);
138+
this.OutgoingTrunk = OutgoingTrunkList[idx];
139+
140+
data.Add("Transfer", coin.Next(0, 2));
141+
this.Transfer = coin.Next(0, 2);
142+
143+
idx = coin.Next(0, IMSIList.Length);
144+
data.Add("CallingIMSI", IMSIList[idx]);
145+
this.CallingIMSI = IMSIList[idx];
146+
147+
idx = coin.Next(0, IMSIList.Length);
148+
data.Add("CalledIMSI", IMSIList[idx]);
149+
this.CalledIMSI = IMSIList[idx];
150+
151+
idx = coin.Next(0, MSRNList.Length);
152+
data.Add("MSRN", MSRNList[idx]);
153+
this.MSRN = MSRNList[idx];
154+
}
155+
156+
// set the data for the CDR record
157+
public void setData(string key, string value)
158+
{
159+
if (data.ContainsKey(key))
160+
data[key] = value;
161+
else
162+
data.Add(key, value);
163+
164+
switch (key)
165+
{
166+
case "RecordType":
167+
this.RecordType = value;
168+
break;
169+
case "SystemIdentity":
170+
this.SystemIdentity = value;
171+
break;
172+
case "FileNum":
173+
this.FileNum = value;
174+
break;
175+
case "SwitchNum":
176+
this.SwitchNum = value;
177+
break;
178+
case "CallingNum":
179+
this.CallingNum = value;
180+
break;
181+
case "CallingIMSI":
182+
this.CallingIMSI = value;
183+
break;
184+
case "CalledNum":
185+
this.CalledNum = value;
186+
break;
187+
case "CalledIMSI":
188+
this.CalledIMSI = value;
189+
break;
190+
case "Date":
191+
this.DateS = value;
192+
break;
193+
case "Time":
194+
break;
195+
this.TimeS = value;
196+
case "TimeType":
197+
this.TimeType = Int32.Parse(value);
198+
break;
199+
case "CallPeriod":
200+
this.CallPeriod = Int32.Parse(value);
201+
break;
202+
case "CallingCellID":
203+
this.CallingCellID = value;
204+
break;
205+
case "CalledCellID":
206+
this.CalledCellID = value;
207+
break;
208+
case "ServiceType":
209+
this.ServiceType = value;
210+
break;
211+
case "Transfer":
212+
this.Transfer = Int32.Parse(value);
213+
break;
214+
case "IncomingTrunk":
215+
this.IncomingTrunk = value;
216+
break;
217+
case "OutgoingTrunk":
218+
this.OutgoingTrunk = value;
219+
break;
220+
case "MSRN":
221+
this.MSRN = value;
222+
break;
223+
case "CalledNum2":
224+
this.CalledNum2 = value;
225+
break;
226+
case "FCIFlag":
227+
this.FCIFlag = value;
228+
break;
229+
case "DateTime":
230+
if (value.Length > 13)
231+
{
232+
int hour = Int32.Parse(value.Substring(9, 2));
233+
int min = Int32.Parse(value.Substring(11, 2));
234+
int secs = Int32.Parse(value.Substring(13, 2));
235+
236+
int year = Int32.Parse(value.Substring(0, 4));
237+
int month = Int32.Parse(value.Substring(4, 2));
238+
int day = Int32.Parse(value.Substring(6, 2));
239+
240+
this.callrecTime = new DateTime(year, month, day, hour, min, secs).ToUniversalTime();
241+
}
242+
243+
break;
244+
}
245+
}
246+
247+
override public String ToString()
248+
{
249+
StringBuilder sb = new StringBuilder();
250+
251+
for (int i = 0; i < columns.Length; i++)
252+
{
253+
if (!data.ContainsKey(columns[i]) || data[columns[i]] == null)
254+
sb.Append("");
255+
else
256+
sb.Append(data[columns[i]]);
257+
258+
if (i < columns.Length - 1)
259+
sb.Append(",");
260+
}
261+
262+
return sb.ToString();
263+
}
264+
}
265+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
//*********************************************************
2+
//
3+
// Copyright (c) Microsoft. All rights reserved.
4+
// This code is licensed under the Microsoft Public License.
5+
// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
6+
// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
7+
// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
8+
// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
9+
//
10+
//*********************************************************
11+
using System;
12+
13+
namespace telcodatagen
14+
{
15+
class CallStore
16+
{
17+
public string[] CallNos;
18+
public string[] switchCountries = { "US", "China", "UK", "Germany", "Australia" };
19+
static string[] NumPrefix = { "0123", "1234", "2345", "3456", "4567", "5678", "6789", "7890" };
20+
21+
public CallStore(int size)
22+
{
23+
Random coin = new Random();
24+
25+
// CallNoStore
26+
CallNos = new String[size];
27+
28+
// Start generating the n numbers and putting it into the store
29+
for (int i = 0; i < size; i++)
30+
{
31+
int prefixIdx = coin.Next(0, NumPrefix.Length);
32+
string prefix = NumPrefix[prefixIdx];
33+
CallNos[i] = prefix + String.Format("{0:00000}", i);
34+
}
35+
36+
37+
}
38+
}
39+
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
//*********************************************************
2+
//
3+
// Copyright (c) Microsoft. All rights reserved.
4+
// This code is licensed under the Microsoft Public License.
5+
// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
6+
// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
7+
// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
8+
// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
9+
//
10+
//*********************************************************
11+
using System;
12+
13+
namespace telcodatagen
14+
{
15+
16+
class GenConfig
17+
{
18+
public int nSets { get; set; }
19+
public int nFilesPerDump { get; set; }
20+
public int nCDRPerFile { get; set; }
21+
public float nCallBackPercent { get; set; }
22+
public int nDurationHours { get; set; }
23+
24+
// Constructor
25+
public GenConfig(int _set, int _files, int _cdr, float _callback, int hours)
26+
{
27+
nSets = _set;
28+
nFilesPerDump = _files;
29+
nCDRPerFile = _cdr;
30+
nCallBackPercent = _callback;
31+
nDurationHours = hours;
32+
}
33+
34+
35+
// Assume there is only 1 file, and 1 set
36+
public GenConfig(int _cdr, float _callback, int hours)
37+
{
38+
nSets = 1;
39+
nFilesPerDump = 1;
40+
nCDRPerFile = _cdr;
41+
nCallBackPercent = _callback;
42+
nDurationHours = hours;
43+
}
44+
45+
override public String ToString()
46+
{
47+
return "#Sets: " + nSets + ",#FilesDump: " + nFilesPerDump + ",#CDRPerFile: " + nCDRPerFile + ",%CallBack: " + nCallBackPercent + ", #DurationHours: " + nDurationHours;
48+
}
49+
}
50+
}

0 commit comments

Comments
 (0)