شركة التطبيقات المتكاملة لتصميم النظم البرمجية الخاصة

Integrated Applications Programming Company

Skip Navigation Links

Public general use code classes and xml files that we've compiled and used over the years:

Ericsson AXE support class of Next Generation Network'a (NGN's) business model.

   1:  using System;
   2:  using System.Collections.Generic;
   3:  using System.Configuration;
   4:  using System.IO;
   5:  using System.Linq;
   6:  using System.Text.RegularExpressions;
   7:   
   8:  namespace Ia.Ngn.Cl.Model.Business.Ericsson
   9:  {
  10:      ////////////////////////////////////////////////////////////////////////////
  11:   
  12:      /// <summary publish="true">
  13:      /// Ericsson AXE support class of Next Generation Network'a (NGN's) business model.
  14:      /// </summary>
  15:      /// 
  16:      /// <remarks> 
  17:      /// Copyright © 2018-2019 Jasem Y. Al-Shamlan (info@ia.com.kw), Internet Applications - Kuwait. All Rights Reserved.
  18:      ///
  19:      /// 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
  20:      /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
  21:      ///
  22:      /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
  23:      /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  24:      /// 
  25:      /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
  26:      /// 
  27:      /// Copyright notice: This notice may not be removed or altered from any source distribution.
  28:      /// </remarks> 
  29:      public class Axe
  30:      {
  31:          private static Queue<int> serviceQueue = new Queue<int>();
  32:   
  33:          /// <summary/>
  34:          public enum Opcode { Stsup, Suscp, Sulie }
  35:   
  36:          /// <summary/>
  37:          public static string Host { get { return ConfigurationManager.AppSettings["axeEricssonServerHost"].ToString(); } }
  38:   
  39:          /// <summary/>
  40:          public static int Port { get { return 23; } } // 23 telnet port
  41:   
  42:          /// <summary/>
  43:          public static string UserName { get { return ConfigurationManager.AppSettings["axeEricssonServerUserName"].ToString(); } }
  44:   
  45:          /// <summary/>
  46:          public static string Password { get { return ConfigurationManager.AppSettings["axeEricssonServerPassword"].ToString(); } }
  47:   
  48:          /// <summary/>
  49:          public static string LogoutCommand { get { return ConfigurationManager.AppSettings["axeEricssonServerLogoutCommand"].ToString(); } }
  50:   
  51:          public static List<string> ServiceSymbolList { get; } = new List<string>();
  52:   
  53:          ////////////////////////////////////////////////////////////////////////////
  54:   
  55:          /// <summary>
  56:          ///
  57:          /// </summary>
  58:          public Axe() { }
  59:   
  60:          ////////////////////////////////////////////////////////////////////////////
  61:   
  62:          /// <summary>
  63:          ///
  64:          /// </summary>
  65:          public static int ProperlySelectedSingleServiceQueueServiceNumber(string siteName)
  66:          {
  67:              int service;
  68:              Random random;
  69:              List<int> list;
  70:   
  71:              service = 0;
  72:   
  73:              if (serviceQueue.Count == 0)
  74:              {
  75:                  random = new Random();
  76:   
  77:                  list = AllPossiblePstnServiceNumbersWithinSite(siteName);
  78:   
  79:                  serviceQueue = new Queue<int>(list.Shuffle());
  80:              }
  81:   
  82:              if (serviceQueue.Count > 0) service = serviceQueue.Dequeue();
  83:   
  84:              return service;
  85:          }
  86:   
  87:          ////////////////////////////////////////////////////////////////////////////
  88:   
  89:          /// <summary>
  90:          ///
  91:          /// </summary>
  92:          public static List<int> AllPossiblePstnServiceNumbersWithinSite(string siteName)
  93:          {
  94:              List<int> servicelist;
  95:              HashSet<int> hashSet;
  96:   
  97:              servicelist = Ia.Ngn.Cl.Model.Data.Service.AllPossiblePstnServiceNumbersWithinSite(siteName);
  98:   
  99:              hashSet = new HashSet<int>(servicelist);
 100:   
 101:              return hashSet.ToList();
 102:          }
 103:   
 104:          ////////////////////////////////////////////////////////////////////////////
 105:   
 106:          /// <summary>
 107:          /// 
 108:          /// </summary>
 109:          public static Ia.Ngn.Cl.Model.Business.Service.ServiceSupplementaryService ServiceSupplementaryServiceStateFromServiceNetManagerOutputString(string content)
 110:          {
 111:              string service;
 112:              Match match;
 113:              Ia.Ngn.Cl.Model.Business.Service.ServiceSupplementaryService serviceSupplementaryService;
 114:   
 115:              serviceSupplementaryService = new Ia.Ngn.Cl.Model.Business.Service.ServiceSupplementaryService();
 116:   
 117:              /*
 118:  SUBSCRIBER DATA
 119:  SNB        DEV            DETY    SUT SCL         MIS             COS
 120:  25382234   LIMA-634                   CCB-1
 121:  
 122:  END
 123:  
 124:  SUBSCRIBER DATA
 125:  SNB        DEV            DETY    SUT SCL         MIS             COS
 126:  25381111                          PB  IPT-2
 127:                                        ANT-2
 128:                                        CBA-2
 129:  
 130:  END
 131:               */
 132:   
 133:   
 134:              /*
 135:  2019-07-25 08:53:54: ServiceSymbolList(): Service symbol list: 
 136:  CBA-2, IPT-2, ANT-2, FLA-2, GUG-5, CAW-1, ENQ-2, CCB-1, CDP-1, CFUF-1, IPT-3, APT-2, ENQ-1, CBP-1, CBB-1, CBA-7, CBA-15, CFUV-1, TBO-1, BIC-1, CBA-1, TBO-2, TBI-1, CBA-9, TCL-9, CBA-10, FDC-1, CCB-2, FLA-1, CBA-3, OCG-1, TLI-14, BAT-1, FDC-2, BOC-1, LIBAMA-14, MCIDSC-1, LNR-1, GUG-2, GUG-0, GUG-3, ADI-2
 137:               */
 138:   
 139:              /*
 140:  Unknown: IPT-2, CDP-1, APT-2, ENQ-1, CBP-1, CBB-1, CBA-7, CBA-15, CBA-1, CBA-9, TCL-9, CBA-10, FDC-1, CCB-2, FLA-1, CBA-3, OCG-1, TLI-14, BAT-1, FDC-2, LIBAMA-14, MCIDSC-1, LNR-1, GUG-2, GUG-0, GUG-3
 141:  
 142:  IPT-3,ANT-2    CallerId
 143:  CFUF-1,CFUV-1    CallForwarding
 144:  CAW-1,FLA-2    CallWaiting
 145:  ENQ-2,FLA-2    ConferenceCall
 146:  GUG-5    WakeupCall
 147:  ADI-2    AbbriviatedCalling
 148:  CCB-1    InternationalCallingUserControlled
 149:  CBA-2    InternationalCalling
 150:  TBO-1,TBI-1    ServiceSuspension
 151:  TBO-2,TBI-1    ServiceSuspension due to ServiceAdministrativelySuspendedByBillingDepartment
 152:  BIC-1,BOC-1    ServiceSuspension due to ServiceAdministrativelySuspendedForOtherReasons
 153:  BIC-1    ServiceSuspension
 154:  BOC-1    ServiceSuspension
 155:  
 156:               */
 157:              match = Regex.Match(content, @"\r\n(\d{8})\s+");
 158:   
 159:              if (match.Success)
 160:              {
 161:                  service = match.Groups[1].Value;
 162:   
 163:                  if (int.TryParse(service, out int snb))
 164:                  {
 165:                      serviceSupplementaryService.Service = snb;
 166:   
 167:                      if (content.Contains("IPT-3") && content.Contains("ANT-2") /*&& outputContent.Contains("APT-2")*/) serviceSupplementaryService.SupplementaryServiceList.Add(Ia.Ngn.Cl.Model.Business.Service.SupplementaryService.CallerId);
 168:                      if (/*outputContent.Contains("CDP-1") &&*/ content.Contains("CFUF-1") && content.Contains("CFUV-1")) serviceSupplementaryService.SupplementaryServiceList.Add(Ia.Ngn.Cl.Model.Business.Service.SupplementaryService.CallForwarding);
 169:                      //if (outputContent.Contains("OCG-1") && outputContent.Contains("TLI-14")) serviceSupplementaryService.SupplementaryServiceList.Add(Ia.Ngn.Cl.Model.Business.Service.SupplementaryService.MagneticCart);
 170:                      //if (outputContent.Contains("FLA-2") && outputContent.Contains("MCIDSC-1")) serviceSupplementaryService.SupplementaryServiceList.Add(Ia.Ngn.Cl.Model.Business.Service.SupplementaryService.CallMonitoring);
 171:                      if (content.Contains("CAW-1") && content.Contains("FLA-2")) serviceSupplementaryService.SupplementaryServiceList.Add(Ia.Ngn.Cl.Model.Business.Service.SupplementaryService.CallWaiting);
 172:                      if (content.Contains("ENQ-2") && content.Contains("FLA-2")) serviceSupplementaryService.SupplementaryServiceList.Add(Ia.Ngn.Cl.Model.Business.Service.SupplementaryService.ConferenceCall);
 173:                      if (content.Contains("GUG-5")) serviceSupplementaryService.SupplementaryServiceList.Add(Ia.Ngn.Cl.Model.Business.Service.SupplementaryService.WakeupCall);
 174:                      if (content.Contains("ADI-2")) serviceSupplementaryService.SupplementaryServiceList.Add(Ia.Ngn.Cl.Model.Business.Service.SupplementaryService.AbbriviatedCalling);
 175:                      if (content.Contains("CCB-1")) serviceSupplementaryService.SupplementaryServiceList.Add(Ia.Ngn.Cl.Model.Business.Service.SupplementaryService.InternationalCallingUserControlled);
 176:                      if (content.Contains("CBA-2")) serviceSupplementaryService.SupplementaryServiceList.Add(Ia.Ngn.Cl.Model.Business.Service.SupplementaryService.InternationalCalling);
 177:   
 178:                      //if (outputContent.Contains("FDC-1") && outputContent.Contains("LNR-1")) serviceSupplementaryService.SupplementaryServiceList.Add(Ia.Ngn.Cl.Model.Business.Service.SupplementaryService.OneWayHotoutputContent);
 179:                      //if (outputContent.Contains("FDC-2") && outputContent.Contains("LNR-1")) serviceSupplementaryService.SupplementaryServiceList.Add(Ia.Ngn.Cl.Model.Business.Service.SupplementaryService.TwoWayHotoutputContent);
 180:   
 181:                      //if (outputContent.Contains("SSI-1")) serviceSupplementaryService.SupplementaryServiceList.Add(Ia.Ngn.Cl.Model.Business.Service.SupplementaryService.???);
 182:   
 183:                      if (content.Contains("TBO-1") && content.Contains("TBI-1"))
 184:                      {
 185:                          //serviceSupplementaryService.SupplementaryServiceList.Add(Ia.Ngn.Cl.Model.Business.Service.SupplementaryService.ManualBillingDisconnect);
 186:                          serviceSupplementaryService.SupplementaryServiceList.Add(Ia.Ngn.Cl.Model.Business.Service.SupplementaryService.ServiceSuspension);
 187:                      }
 188:   
 189:                      if (content.Contains("TBO-2") && content.Contains("TBI-1"))
 190:                      {
 191:                          serviceSupplementaryService.ServiceAdministrativelySuspendedByBillingDepartment = true;
 192:                          serviceSupplementaryService.SupplementaryServiceList.Add(Ia.Ngn.Cl.Model.Business.Service.SupplementaryService.ServiceSuspension);
 193:                      }
 194:   
 195:                      if (content.Contains("BIC-1") && content.Contains("BOC-1"))
 196:                      {
 197:                          serviceSupplementaryService.ServiceAdministrativelySuspendedForOtherReasons = true;
 198:                          serviceSupplementaryService.SupplementaryServiceList.Add(Ia.Ngn.Cl.Model.Business.Service.SupplementaryService.ServiceSuspension);
 199:                      }
 200:                      else if (content.Contains("BIC-1"))
 201:                      {
 202:                          //serviceSupplementaryService.IncomingDisconnect = true;
 203:                          serviceSupplementaryService.SupplementaryServiceList.Add(Ia.Ngn.Cl.Model.Business.Service.SupplementaryService.ServiceSuspension);
 204:                      }
 205:                      else if (content.Contains("BOC-1"))
 206:                      {
 207:                          //serviceSupplementaryService.OutgoingDisconnect = true;
 208:                          serviceSupplementaryService.SupplementaryServiceList.Add(Ia.Ngn.Cl.Model.Business.Service.SupplementaryService.ServiceSuspension);
 209:                      }
 210:   
 211:                      if (content.Contains("PB")) serviceSupplementaryService.IsPbx = true;
 212:   
 213:                      Ia.Ngn.Cl.Model.Business.Ericsson.Axe.ExtractAndUpdateUniqueAxeServiceSymbolListFromOutputContent(content);
 214:                  }
 215:                  else
 216:                  {
 217:                  }
 218:              }
 219:              else
 220:              {
 221:              }
 222:   
 223:              return serviceSupplementaryService;
 224:          }
 225:   
 226:          /*
 227:          ////////////////////////////////////////////////////////////////////////////
 228:  
 229:          /// <summary>
 230:          /// 
 231:          /// </summary>
 232:          public static bool SupplementaryServiceStateFromServiceStringDesignation(Ia.Ngn.Cl.Model.Business.Service.SupplementaryService ss, string code)
 233:          {
 234:              bool b;
 235:  
 236:              if (ss == Ia.Ngn.Cl.Model.Business.Service.SupplementaryService.CallerId && code.Contains("IPT-3,ANT-2")) b = true;
 237:              else if (ss == Ia.Ngn.Cl.Model.Business.Service.SupplementaryService.CallForwarding && code.Contains("CFUF-1,CFUV-1")) b = true;
 238:              //else if (ss == Ia.Ngn.Cl.Model.Business.Service.SupplementaryService.MagneticCart && code.Contains("OCG-1,TLI-14")) b = true;
 239:              //else if (ss == Ia.Ngn.Cl.Model.Business.Service.SupplementaryService.CallMonitoring && code.Contains("FLA-2,MCIDSC-1")) b = true;
 240:              else if (ss == Ia.Ngn.Cl.Model.Business.Service.SupplementaryService.CallWaiting && code.Contains("CAW-1,FLA-2")) b = true;
 241:              else if (ss == Ia.Ngn.Cl.Model.Business.Service.SupplementaryService.ConferenceCall && code.Contains("ENQ-2,FLA-2")) b = true;
 242:  
 243:              //else if (ss == Ia.Ngn.Cl.Model.Business.Service.SupplementaryService.ManualBillingDisconnect && code.Contains("TBO-1,TBI-1")) b = true;
 244:              else if (ss == Ia.Ngn.Cl.Model.Business.Service.SupplementaryService.ServiceSuspension && code.Contains("TBO-1,TBI-1")) b = true;
 245:              //else if (ss == Ia.Ngn.Cl.Model.Business.Service.SupplementaryService.ProgrammedBillingDisconnect && code.Contains("TBO-2,TBI-1")) b = true;
 246:              else if (ss == Ia.Ngn.Cl.Model.Business.Service.SupplementaryService.ServiceSuspension && code.Contains("TBO-2,TBI-1")) b = true;
 247:              //else if (ss == Ia.Ngn.Cl.Model.Business.Service.SupplementaryService.AnnoyanceDisconnect && code.Contains("BIC-1,BOC-1")) b = true;
 248:              else if (ss == Ia.Ngn.Cl.Model.Business.Service.SupplementaryService.ServiceSuspension && code.Contains("BIC-1,BOC-1")) b = true;
 249:  
 250:              //else if (ss == Ia.Ngn.Cl.Model.Business.Service.SupplementaryService.OneWayHotline && code.Contains("FDC-1,LNR-1")) b = true;
 251:              //else if (ss == Ia.Ngn.Cl.Model.Business.Service.SupplementaryService.TwoWayHotline && code.Contains("FDC-2,LNR-1")) b = true;
 252:  
 253:              else if (ss == Ia.Ngn.Cl.Model.Business.Service.SupplementaryService.AbbriviatedCalling && code.Contains("ADI-2")) b = true;
 254:              else if (ss == Ia.Ngn.Cl.Model.Business.Service.SupplementaryService.InternationalCallingUserControlled && code.Contains("CCB-1")) b = true;
 255:              else if (ss == Ia.Ngn.Cl.Model.Business.Service.SupplementaryService.InternationalCalling && code.Contains("CBA-2")) b = false; // note the false
 256:                                                                                                                                              //else if (ss == Ia.Ngn.Cl.Model.Business.Service.SupplementaryService.Pbx && code.Contains("PB")) b = true;
 257:  
 258:              //else if (ss == Ia.Ngn.Cl.Model.Business.Service.SupplementaryService.IncomingDisconnect && code.Contains("BIC-1")_ b = true;
 259:              else if (ss == Ia.Ngn.Cl.Model.Business.Service.SupplementaryService.ServiceSuspension && code.Contains("BIC-1")) b = true;
 260:              //else if (ss == Ia.Ngn.Cl.Model.Business.Service.SupplementaryService.OutgoingDisconnect && code.Contains("BOC-1")) b = true;
 261:              else if (ss == Ia.Ngn.Cl.Model.Business.Service.SupplementaryService.ServiceSuspension && code.Contains("BOC-1")) b = true;
 262:  
 263:              else if (ss == Ia.Ngn.Cl.Model.Business.Service.SupplementaryService.WakeupCall && code.Contains("GUG-5")) b = true;
 264:              else b = false;
 265:  
 266:              return b;
 267:          }
 268:  
 269:          ////////////////////////////////////////////////////////////////////////////
 270:  
 271:          /// <summary>
 272:          /// 
 273:          /// </summary>
 274:          public static string CheckStateAndServiceFromServicePerAllNumbersFile(string line)
 275:          {
 276:              string s;
 277:  
 278:              if (line.Contains("IPT-3") && line.Contains("ANT-2") /*&& line.Contains("APT-2")* /) s = "IPT-3,ANT-2";//,APT-2";
 279:              else if (/*line.Contains("CDP-1") &&* / line.Contains("CFUF-1") && line.Contains("CFUV-1")) s = /*"CDP-1,* /"CFUF-1,CFUV-1";
 280:              else if (line.Contains("OCG-1") && line.Contains("TLI-14")) s = "OCG-1,TLI-14";
 281:              else if (line.Contains("FLA-2") && line.Contains("MCIDSC-1")) s = "FLA-2,MCIDSC-1";
 282:              else if (line.Contains("CAW-1") && line.Contains("FLA-2")) s = "CAW-1,FLA-2";
 283:              else if (line.Contains("ENQ-2") && line.Contains("FLA-2")) s = "ENQ-2,FLA-2";
 284:              else if (line.Contains("TBO-1") && line.Contains("TBI-1")) s = "TBO-1,TBI-1";
 285:              else if (line.Contains("TBO-2") && line.Contains("TBI-1")) s = "TBO-2,TBI-1";
 286:              else if (line.Contains("FDC-1") && line.Contains("LNR-1")) s = "FDC-1,LNR-1";
 287:              else if (line.Contains("FDC-2") && line.Contains("LNR-1")) s = "FDC-2,LNR-1";
 288:              else if (line.Contains("BIC-1") && line.Contains("BOC-1")) s = "BIC-1,BOC-1";
 289:              else if (line.Contains("ADI-2")) s = "ADI-2";
 290:              else if (line.Contains("CCB-1")) s = "CCB-1";
 291:              else if (line.Contains("CBA-2")) s = "CBA-2";
 292:              else if (line.Contains("NC")) s = "NC";
 293:              else if (line.Contains("PB")) s = "PB";
 294:              else if (line.Contains("BIC-1")) s = "BIC-1";
 295:              else if (line.Contains("BOC-1")) s = "BOC-1";
 296:              else if (line.Contains("GUG-5")) s = "GUG-5";
 297:              else if (line.Contains("SSI-1")) s = "SSI-1";
 298:              else s = string.Empty;
 299:  
 300:              return s;
 301:          }
 302:          */
 303:   
 304:          ////////////////////////////////////////////////////////////////////////////
 305:   
 306:          /// <summary>
 307:          /// Response of Ericsson AXE
 308:          /// </summary>
 309:          public class Response
 310:          {
 311:              public int Service { get; set; }
 312:              /// <summary/>
 313:              public bool IsSuccess { get { return ReturnCode == Ia.Ngn.Cl.Model.Client.Ericsson.Axe.ResultCode.OperationIsSuccessful; } }
 314:              /// <summary/>
 315:              public bool IsProvisioned { get; set; }
 316:              /// <summary/>
 317:              public Ia.Ngn.Cl.Model.Client.Ericsson.Axe.ResultCode ReturnCode { get; set; }
 318:              /// <summary/>
 319:              //public string Ctag { get; set; } // no need because the commad string is included in response body
 320:              /// <summary/>
 321:              public DateTime DateTime { get; set; }
 322:              /// <summary/>
 323:              public string CommandString { get; set; }
 324:   
 325:              public Ia.Ngn.Cl.Model.Business.Service.ServiceSupplementaryService ServiceSupplementaryService { get; set; }
 326:   
 327:              /// <summary/>
 328:              public Response() { }
 329:          }
 330:   
 331:          ////////////////////////////////////////////////////////////////////////////
 332:   
 333:          /// <summary>
 334:          ///
 335:          /// </summary>
 336:          public static string AxeCommand(Opcode opcode, int snb)
 337:          {
 338:              string command;
 339:   
 340:              if (opcode == Opcode.Suscp) command = "SUSCP:SNB=" + snb + ";";
 341:              else if (opcode == Opcode.Sulie) command = "SULIE:SNB=" + snb + ";";
 342:              else if (opcode == Opcode.Stsup) command = "STSUP:SNB=" + snb + ";";
 343:              else
 344:              {
 345:                  throw new System.ArgumentOutOfRangeException("AxeCommand(): Opcode unrecognized. ");
 346:              }
 347:   
 348:              return command;
 349:          }
 350:   
 351:          ////////////////////////////////////////////////////////////////////////////
 352:   
 353:          /// <summary>
 354:          ///
 355:          /// </summary>
 356:          public static string AxeDisplayTimeCommand
 357:          {
 358:              get
 359:              {
 360:                  return ";";
 361:              }
 362:          }
 363:   
 364:          ////////////////////////////////////////////////////////////////////////////
 365:   
 366:          /// <summary>
 367:          /// Extract unique AXE service symbols into array 
 368:          /// </summary>
 369:          public static void ExtractAndUpdateUniqueAxeServiceSymbolListFromOutputContent(string outputContent)
 370:          {
 371:              MatchCollection matchCollection;
 372:   
 373:              matchCollection = Regex.Matches(outputContent, @"\b[A-Z]{3,8}-\d+\b");
 374:   
 375:              if (matchCollection.Count > 0)
 376:              {
 377:                  foreach (Match match in matchCollection)
 378:                  {
 379:                      if (!match.Value.StartsWith("LIMA")) // LIMA-3445 is a circuit
 380:                      {
 381:                          if (!ServiceSymbolList.Contains(match.Value))
 382:                          {
 383:                              ServiceSymbolList.Add(match.Value);
 384:                          }
 385:                      }
 386:                  }
 387:              }
 388:          }
 389:   
 390:          ////////////////////////////////////////////////////////////////////////////
 391:          ////////////////////////////////////////////////////////////////////////////
 392:      }
 393:   
 394:      ////////////////////////////////////////////////////////////////////////////
 395:      ////////////////////////////////////////////////////////////////////////////    
 396:  }
 397: