1: using System;
2:
3: namespace Ia.Ngn.Cl.Model.Business.Huawei
4: {
5: ////////////////////////////////////////////////////////////////////////////
6:
7: /// <summary publish="true">
8: /// Huawei's EMS VOIP PSTN User support class of Optical Fiber Network (OFN) business model.
9: /// </summary>
10: ///
11: /// <remarks>
12: /// Copyright © 2017-2022 Jasem Y. Al-Shamlan (info@ia.com.kw), Integrated Applications - Kuwait. All Rights Reserved.
13: ///
14: /// This library is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by
15: /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
16: ///
17: /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
18: /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
19: ///
20: /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
21: ///
22: /// Copyright notice: This notice may not be removed or altered from any source distribution.
23: /// </remarks>
24: public class VoipPstnUser
25: {
26: private static int fixedLengthOfVoipPstnUserNddOntId = Ia.Ngn.Cl.Model.Business.Default.FixedLengthOfOntId + 3 + 3;
27: private static int fixedLengthOfVoipPstnUserMsanDevId = Ia.Ngn.Cl.Model.Business.Huawei.Dev.MsanDev.FixedLengthOfMsanDevId + 3 + 3;
28:
29: /// <summary/>
30: public static int FixedLengthOfVoipPstnUserNddOntId { get { return fixedLengthOfVoipPstnUserNddOntId; } }
31:
32: /// <summary/>
33: public static int FixedLengthOfVoipPstnUserMsanDevId { get { return fixedLengthOfVoipPstnUserMsanDevId; } }
34:
35: ////////////////////////////////////////////////////////////////////////////
36:
37: /// <summary>
38: ///
39: /// </summary>
40: public class DidFnSnPnDn
41: {
42: /// <summary/>
43: public int Did { get; set; }
44:
45: /// <summary/>
46: public int Fn { get; set; }
47:
48: /// <summary/>
49: public int Sn { get; set; }
50:
51: /// <summary/>
52: public int Pn { get; set; }
53:
54: /// <summary/>
55: public string Dn { get; set; }
56:
57: ////////////////////////////////////////////////////////////////////////////
58:
59: /// <summary>
60: ///
61: /// </summary>
62: public DidFnSnPnDn()
63: {
64: this.Did = 0;
65: this.Fn = 0;
66: this.Sn = 0;
67: this.Pn = 0;
68: this.Dn = string.Empty;
69: }
70:
71: ////////////////////////////////////////////////////////////////////////////
72:
73: /// <summary>
74: ///
75: /// </summary>
76: public DidFnSnPnDn(int did, int fn, int sn, int pn, string dn)
77: {
78: this.Did = did;
79: this.Fn = fn;
80: this.Sn = sn;
81: this.Pn = pn;
82: this.Dn = dn;
83: }
84:
85: ////////////////////////////////////////////////////////////////////////////
86:
87: /// <summary>
88: ///
89: /// </summary>
90: public string ToSimpleDidFnSnPnDnTextString()
91: {
92: var s = "DID: " + this.Did + ", FN: " + this.Fn + ", SN: " + this.Sn + ", PN: " + this.Pn + ", DN: " + this.Dn;
93:
94: return s;
95: }
96:
97: ////////////////////////////////////////////////////////////////////////////
98: }
99:
100: ////////////////////////////////////////////////////////////////////////////
101: ////////////////////////////////////////////////////////////////////////////
102:
103: /// <summary>
104: ///
105: /// </summary>
106: public VoipPstnUser() { }
107:
108: ////////////////////////////////////////////////////////////////////////////
109:
110: /// <summary>
111: ///
112: /// </summary>
113: public static string VoipPstnUserId(string ontId, int sn, int pn)
114: {
115: var id = ontId + sn.ToString().PadLeft(3, '0') + pn.ToString().PadLeft(3, '0'); // 3 because an MDU might have more than 100 numbers
116:
117: // fix code to include all MSAN DEV devs then use the code below (e.g. check the msanDev NOC_??_??...)
118: /*
119: if (id.Length != fixedLengthOfVoipPstnUserNddOntId && id.Length != fixedLengthOfVoipPstnUserMsanDevId)
120: {
121: throw new ArgumentOutOfRangeException(@"VoipPstnUserId(): Id length is neither " + fixedLengthOfVoipPstnUserNddOntId + " nor " + fixedLengthOfVoipPstnUserMsanDevId);
122: }
123: */
124:
125: return id;
126: }
127:
128: ////////////////////////////////////////////////////////////////////////////
129:
130: /// <summary>
131: ///
132: /// </summary>
133: public static int SpecialIntegerParameterHandling(string parameterName, string parameterValue)
134: {
135: int i;
136:
137: if (parameterName == "TID")
138: {
139: /// TID INTEGER 0-9999 Indicates the terminal ID
140:
141: parameterValue = parameterValue.Replace("--", "-1");
142: }
143: else if (parameterName == "PITime")
144: {
145: /// PITime INTEGER 0-20 Indicates the duration of waiting to collect digits. Unit: 10 ms. The MA5600T, MA5603T, MA5606T, MA5620E, MA5620G, MA5610, and MA5616 do not support this parameter.
146:
147: parameterValue = parameterValue.Replace("--", "-1");
148: }
149: else
150: {
151:
152: }
153:
154: i = int.Parse(parameterValue);
155:
156: return i;
157: }
158:
159: ////////////////////////////////////////////////////////////////////////////
160:
161: /// <summary>
162: ///
163: /// </summary>
164: public static Ia.Ngn.Cl.Model.Business.Huawei.Dev.Type DevTypeFromDn(string dn)
165: {
166: Ia.Ngn.Cl.Model.Business.Huawei.Dev.Type emsDevType;
167:
168: // this is inaccurate because sometimes staff will assign impuAid numbers to MDUs.
169: if (Ia.Ngn.Cl.Model.Business.NumberFormatConverter.IsMatchToServiceWithCountryCode(dn)) emsDevType = Ia.Ngn.Cl.Model.Business.Huawei.Dev.Type.Mdu;
170: else if (Ia.Ngn.Cl.Model.Business.NumberFormatConverter.IsMatchToImpuAid(dn)) emsDevType = Ia.Ngn.Cl.Model.Business.Huawei.Dev.Type.Msan;
171: else emsDevType = Ia.Ngn.Cl.Model.Business.Huawei.Dev.Type.Unknown;
172:
173: return emsDevType;
174: }
175:
176: ////////////////////////////////////////////////////////////////////////////
177: ////////////////////////////////////////////////////////////////////////////
178: }
179:
180: ////////////////////////////////////////////////////////////////////////////
181: ////////////////////////////////////////////////////////////////////////////
182: }