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

Integrated Applications Programming Company

Skip Navigation LinksHome » Code Library » Ims

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

Optical Fiber Network Management Intranet Portal (OFN) support class for Huawei's Next Generation Network (NGN) data model

   1:  using System;
   2:  using System.Collections.Generic;
   3:  using System.Linq;
   4:   
   5:  namespace Ia.Ngn.Cl.Model.Data.Huawei
   6:  {
   7:      ////////////////////////////////////////////////////////////////////////////
   8:   
   9:      /// <summary publish="true">
  10:      /// Optical Fiber Network Management Intranet Portal (OFN) support class for Huawei's Next Generation Network (NGN) data model
  11:      /// </summary>
  12:      /// 
  13:      /// <remarks> 
  14:      /// Copyright © 2014-2020 Jasem Y. Al-Shamlan (info@ia.com.kw), Integrated Applications - Kuwait. All Rights Reserved.
  15:      ///
  16:      /// 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
  17:      /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
  18:      ///
  19:      /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
  20:      /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  21:      /// 
  22:      /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
  23:      /// 
  24:      /// Copyright notice: This notice may not be removed or altered from any source distribution.
  25:      /// </remarks> 
  26:      public class Ims
  27:      {
  28:          ////////////////////////////////////////////////////////////////////////////
  29:   
  30:          /// <summary>
  31:          ///
  32:          /// </summary>
  33:          public Ims()
  34:          {
  35:          }
  36:   
  37:          ////////////////////////////////////////////////////////////////////////////
  38:   
  39:          /// <summary>
  40:          ///
  41:          /// </summary>
  42:          public static bool UpdateSbr(string impu, Ia.Ngn.Cl.Model.Huawei.HuSbr newHuSbr, Ia.Ngn.Cl.Model.Client.Huawei.Ims.ResultCode resultCode)
  43:          {
  44:              bool isOk;
  45:              Ia.Ngn.Cl.Model.Huawei.HuSbr huSbr;
  46:   
  47:              isOk = false;
  48:   
  49:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
  50:              {
  51:                  huSbr = (from s in db.HuSbrs where s.IMPU == impu select s).SingleOrDefault();
  52:   
  53:                  switch (resultCode)
  54:                  {
  55:                      case Ia.Ngn.Cl.Model.Client.Huawei.Ims.ResultCode.OperationSucceeded:
  56:                          {
  57:                              if (huSbr == null)
  58:                              {
  59:                                  newHuSbr.Created = newHuSbr.Updated = DateTime.UtcNow.AddHours(3);
  60:   
  61:                                  db.HuSbrs.Add(newHuSbr);
  62:                              }
  63:                              else
  64:                              {
  65:                                  if (huSbr.Update(newHuSbr))
  66:                                  {
  67:                                      db.HuSbrs.Attach(huSbr);
  68:                                      db.Entry(huSbr).State = Microsoft.EntityFrameworkCore.EntityState.Modified;
  69:                                  }
  70:                              }
  71:   
  72:                              break;
  73:                          }
  74:                      case Ia.Ngn.Cl.Model.Client.Huawei.Ims.ResultCode.TheSubscriberIsNotDefinedInTheHssOrAtsOrServiceDataIsNotConfiguredForTheSubscriber:
  75:                      case Ia.Ngn.Cl.Model.Client.Huawei.Ims.ResultCode.NoServiceData:
  76:                          {
  77:                              if (huSbr == null) { }
  78:                              else db.HuSbrs.Remove(huSbr);
  79:   
  80:                              break;
  81:                          }
  82:                      default:
  83:                          {
  84:                              throw new Exception("Undefined result code seen in Ia.Ngn.Cl.Model.Client.Huawei.Ims.ResultCode");
  85:                          }
  86:                  }
  87:   
  88:                  db.SaveChanges();
  89:   
  90:                  isOk = true;
  91:              }
  92:   
  93:              return isOk;
  94:          }
  95:   
  96:          ////////////////////////////////////////////////////////////////////////////
  97:   
  98:          /// <summary>
  99:          ///
 100:          /// </summary>
 101:          public static bool UpdateOwsbr(string impu, Ia.Ngn.Cl.Model.Huawei.Owsbr newOwsbr, Ia.Ngn.Cl.Model.Client.Huawei.Ims.ResultCode resultCode)
 102:          {
 103:              bool isOk;
 104:              Ia.Ngn.Cl.Model.Huawei.Owsbr owsbr;
 105:   
 106:              isOk = false;
 107:   
 108:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
 109:              {
 110:                  owsbr = (from o in db.Owsbrs where o.IMPU == impu select o).SingleOrDefault();
 111:   
 112:                  switch (resultCode)
 113:                  {
 114:                      case Ia.Ngn.Cl.Model.Client.Huawei.Ims.ResultCode.OperationSucceeded:
 115:                          {
 116:                              if (owsbr == null)
 117:                              {
 118:                                  newOwsbr.Created = newOwsbr.Updated = DateTime.UtcNow.AddHours(3);
 119:   
 120:                                  db.Owsbrs.Add(newOwsbr);
 121:                              }
 122:                              else
 123:                              {
 124:                                  if (owsbr.Update(newOwsbr))
 125:                                  {
 126:                                      db.Owsbrs.Attach(owsbr);
 127:                                      db.Entry(owsbr).State = Microsoft.EntityFrameworkCore.EntityState.Modified;
 128:                                  }
 129:                              }
 130:   
 131:                              break;
 132:                          }
 133:                      case Ia.Ngn.Cl.Model.Client.Huawei.Ims.ResultCode.TheSubscriberIsNotDefinedInTheHssOrAtsOrServiceDataIsNotConfiguredForTheSubscriber:
 134:                      case Ia.Ngn.Cl.Model.Client.Huawei.Ims.ResultCode.NoServiceData:
 135:                          {
 136:                              if (owsbr == null) { }
 137:                              else db.Owsbrs.Remove(owsbr);
 138:   
 139:                              break;
 140:                          }
 141:                      default:
 142:                          {
 143:                              throw new Exception("Undefined result code seen in Ia.Ngn.Cl.Model.Client.Huawei.Ims.ResultCode");
 144:                          }
 145:                  }
 146:   
 147:                  db.SaveChanges();
 148:   
 149:                  isOk = true;
 150:              }
 151:   
 152:              return isOk;
 153:          }
 154:   
 155:          ////////////////////////////////////////////////////////////////////////////
 156:   
 157:          /// <summary>
 158:          ///
 159:          /// </summary>
 160:          public static bool UpdateServiceForSbr(string impu, string accessId)
 161:          {
 162:              bool insert, update, delete;
 163:              int number, serviceType;
 164:              string serviceId, service, impi, impuAid;//, prividUser;
 165:              Ia.Ngn.Cl.Model.Service2 service2, newService;
 166:              Ia.Ngn.Cl.Model.Huawei.HuSbr sbr;
 167:   
 168:              insert = update = delete = false;
 169:              //result = new Ia.Cl.Model.Result();
 170:   
 171:              number = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.Number(impu);
 172:              impi = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.Impi(impu);
 173:              impuAid = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.ImpuAid(impu);
 174:   
 175:              service = number.ToString();
 176:   
 177:              serviceType = Ia.Ngn.Cl.Model.Business.Service.ServiceType.GponService;
 178:              serviceId = Ia.Ngn.Cl.Model.Business.Service2.ServiceId(service, serviceType);
 179:   
 180:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
 181:              {
 182:                  sbr = (from s in db.HuSbrs where s.IMPU == impu select s).SingleOrDefault();
 183:   
 184:                  if (sbr != null)
 185:                  {
 186:                      newService = new Ia.Ngn.Cl.Model.Service2();
 187:   
 188:                      newService.Id = serviceId;
 189:                      newService.AreaCode = Ia.Ngn.Cl.Model.Business.Service.CountryCode;
 190:                      newService.Service = service;
 191:                      newService.ServiceType = serviceType;
 192:   
 193:                      //newService.Port = "Hu?";
 194:   
 195:                      newService.AbbriviatedCalling = sbr.NSABRC;
 196:                      newService.CallerId = sbr.NSCLIP;
 197:                      newService.CallForwarding = sbr.NSCFU;
 198:                      newService.CallWaiting = sbr.NSCW;
 199:                      newService.ConferenceCall = sbr.NS3PTY;
 200:   
 201:                      newService.AlarmCall = sbr.NSWAKE_UP;
 202:                      newService.WakeupCall = sbr.NSWAKE_UP;
 203:   
 204:                      newService.InternationalCallingUserControlled = sbr.NSCBA;
 205:                      newService.InternationalCalling = sbr.ITT;
 206:   
 207:                      //newService.ServiceSuspension = sbr.NSWAKE_UP;
 208:   
 209:                      newService.Pin = (int.TryParse(sbr.COP, out int i)) ? i : 0;
 210:   
 211:                      if (!string.IsNullOrEmpty(accessId)) newService.Access = (from a in db.Accesses where a.Id == accessId select a).SingleOrDefault();
 212:                      else newService.Access = null;
 213:   
 214:                      service2 = (from s in db.Service2
 215:                                  where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.GponService && s.Id == newService.Id
 216:                                  select s).SingleOrDefault();
 217:   
 218:                      if (service2 == null)
 219:                      {
 220:                          newService.Created = newService.Updated = DateTime.UtcNow.AddHours(3);
 221:                          db.Service2.Add(newService);
 222:   
 223:                          insert = true;
 224:                      }
 225:                      else
 226:                      {
 227:                          if (service2.Update(newService))
 228:                          {
 229:                              db.Service2.Attach(service2);
 230:                              db.Entry(service2).State = Microsoft.EntityFrameworkCore.EntityState.Modified;
 231:   
 232:                              update = true;
 233:                          }
 234:                          else update = false;
 235:                      }
 236:                  }
 237:                  else
 238:                  {
 239:                      service2 = (from s in db.Service2
 240:                                  where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.GponService && s.Id == serviceId
 241:                                  select s).SingleOrDefault();
 242:   
 243:                      if (service2 != null)
 244:                      {
 245:                          db.Service2.Remove(service2);
 246:   
 247:                          delete = true;
 248:                      }
 249:                  }
 250:   
 251:                  db.SaveChanges();
 252:              }
 253:   
 254:              //result.AddSuccess(service + ": state: " + Ia.Ngn.Cl.Model.Ui.Text.ExpressionOfInsertOrUpdateOrDelete(insert, update, delete));
 255:   
 256:              return insert || update || delete;
 257:          }
 258:   
 259:          ////////////////////////////////////////////////////////////////////////////
 260:   
 261:          /// <summary>
 262:          ///
 263:          /// </summary>
 264:          public static bool UpdateServiceServiceSuspensionForOwsbr(string impu, out Ia.Cl.Model.Result result)
 265:          {
 266:              bool isOk, serviceSuspensionState;
 267:              int n, serviceType;
 268:              string serviceId;
 269:              Ia.Ngn.Cl.Model.Service2 service;
 270:              Ia.Ngn.Cl.Model.Huawei.Owsbr owsbr;
 271:   
 272:              isOk = false;
 273:              serviceType = Ia.Ngn.Cl.Model.Business.Service.ServiceType.GponService;
 274:              result = new Ia.Cl.Model.Result();
 275:   
 276:              n = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.Number(impu);
 277:              serviceId = Ia.Ngn.Cl.Model.Business.Service2.ServiceId(n.ToString(), serviceType);
 278:   
 279:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
 280:              {
 281:                  owsbr = (from o in db.Owsbrs where o.IMPU == impu select o).SingleOrDefault();
 282:   
 283:                  if (owsbr != null)
 284:                  {
 285:                      service = (from s in db.Service2
 286:                                 where s.ServiceType == Ia.Ngn.Cl.Model.Business.Service.ServiceType.GponService && s.Id == serviceId
 287:                                 select s).SingleOrDefault();
 288:   
 289:                      if (service != null)
 290:                      {
 291:                          serviceSuspensionState = Ia.Ngn.Cl.Model.Business.Huawei.Owsbr.ServiceSuspensionState(owsbr);
 292:   
 293:                          if (service.ServiceSuspension != serviceSuspensionState)
 294:                          {
 295:                              service.ServiceSuspension = serviceSuspensionState;
 296:                              //service.UserId = userId;
 297:   
 298:                              db.Service2.Attach(service);
 299:                              db.Entry(service).Property(u => u.ServiceSuspension).IsModified = true;
 300:   
 301:                              db.SaveChanges();
 302:   
 303:                              result.AddSuccess("ServiceSuspension updated. ");
 304:                          }
 305:                          else
 306:                          {
 307:                              result.AddWarning("Warning: ServiceRequestService ServiceSuspension value was not updated because its the same. ");
 308:                          }
 309:                      }
 310:                      else
 311:                      {
 312:                          result.AddError("Error: serviceRequestService is null. ");
 313:                      }
 314:   
 315:                      db.SaveChanges();
 316:   
 317:                      isOk = true;
 318:                  }
 319:                  else
 320:                  {
 321:                      result.AddError("Error: owsbr is null. ");
 322:                  }
 323:              }
 324:   
 325:              return isOk;
 326:          }
 327:   
 328:          ////////////////////////////////////////////////////////////////////////////
 329:   
 330:          /// <summary>
 331:          ///
 332:          /// </summary>
 333:          public static bool CreateSubscriber(Ia.Ngn.Cl.Model.Client.Huawei.Ims ims, string service, out string result)
 334:          {
 335:              bool subscriberCreated;
 336:              string resultCodeString;
 337:   
 338:              resultCodeString = string.Empty;
 339:   
 340:              // ME:name=techss;
 341:              // ADD HSDAINF:IMPI="+96522220000@ims.moc.kw",HUSERNAME="+96522220000@ims.moc.kw",PWD=admin,REALM="ims.moc.kw";
 342:              ims.AddHsdainf(service, out Client.Huawei.Ims.ResultCode addHsdainfResultCode);
 343:              resultCodeString += "AddHsdainf: " + addHsdainfResultCode.ToString() + ", ";
 344:   
 345:              // ADD HSUB:SUBID="+96522220000@ims.moc.kw",IMPI="+96522220000@ims.moc.kw",IMPU="sip:+96522220000@ims.moc.kw";
 346:              ims.AddHsub(service, out Client.Huawei.Ims.ResultCode addHsubResultCode);
 347:              resultCodeString += "AddHsub: " + addHsubResultCode.ToString() + ", ";
 348:   
 349:              // ADD HIMPU:IMPI="+96522220000@ims.moc.kw",IMPU="tel:+96522220000";
 350:              ims.AddHimpu(service, out Client.Huawei.Ims.ResultCode addHimpuResultCode);
 351:              resultCodeString += "AddHimpu: " + addHimpuResultCode.ToString() + ", ";
 352:   
 353:              // SET HREGAUTH:IMPU="sip:+96522220000@ims.moc.kw",REGAUTH=TRUE;
 354:              ims.SetHregauth(service, out Client.Huawei.Ims.ResultCode setHregauthResultCode);
 355:              resultCodeString += "SetHregauth: " + setHregauthResultCode.ToString() + ", ";
 356:   
 357:              // SET HVNTPLID: IMPU="sip:+96522220000@ims.moc.kw", VNTPLID=0;
 358:              ims.SetHvntplidForImpuSipDomain(service, out Client.Huawei.Ims.ResultCode setHvntplidForImpuSipDomainResultCode);
 359:              resultCodeString += "SetHvntplidForImpuSipDomain: " + setHvntplidForImpuSipDomainResultCode.ToString() + ", ";
 360:   
 361:              // SET HVNTPLID: IMPU="tel:+96522220000", VNTPLID=0;
 362:              ims.SetHvntplidForImpu(service, out Client.Huawei.Ims.ResultCode setHvntplidForImpuResultCode);
 363:              resultCodeString += "SetHvntplidForImpu: " + setHvntplidForImpuResultCode.ToString() + ", ";
 364:   
 365:              // SET HIRS:IRSID=1,IMPULIST="\"sip:+96522220000@ims.moc.kw\"&\"tel:+96522220000\""; 
 366:              ims.SetHirs(service, out Client.Huawei.Ims.ResultCode setHirsResultCode);
 367:              resultCodeString += "SetHirs: " + setHirsResultCode.ToString() + ", ";
 368:   
 369:              // SET HDEFIMPU: IRSID=1, IMPU="sip:+96522220000@ims.moc.kw";
 370:              ims.SetHdefimpu(service, out Client.Huawei.Ims.ResultCode setHdefimpuResultCode);
 371:              resultCodeString += "SetHdefimpu: " + setHdefimpuResultCode.ToString() + ", ";
 372:   
 373:              // SET HSPSHARE:BASEIMPU="sip:+96522220000@ims.moc.kw",IMPU="tel:+96522220000";
 374:              ims.SetHspshare(service, out Client.Huawei.Ims.ResultCode setHspshareResultCode);
 375:              resultCodeString += "SetHspshare: " + setHspshareResultCode.ToString() + ", ";
 376:   
 377:              // SET HALIASPU:ALIASID=1,IMPULIST="\"sip:+96522220000@ims.moc.kw\"&\"tel:+96522220000\"";
 378:              ims.SetHaliaspu(service, out Client.Huawei.Ims.ResultCode setHaliaspuResultCode);
 379:              resultCodeString += "SetHaliaspu: " + setHaliaspuResultCode.ToString() + ", ";
 380:   
 381:              // ADD HSIFC:IMPU="sip:+96522220000@ims.moc.kw",SIFCID=1;
 382:              ims.AddHsifc(service, out Client.Huawei.Ims.ResultCode addHsifcResultCode);
 383:              resultCodeString += "AddHsifc: " + addHsifcResultCode.ToString() + ", ";
 384:   
 385:              // ME:name=tecats0; 
 386:              // ADD SBR:IMPU="sip:+96522xxxxxx@ims.moc.kw",TEMPLATEIDX=65535,DSPIDX=65534,LP=0,CSC=0,UTYPE=1,VCCFLAG=0,VTFLAG=0,NSCFU=0,NSCFUVM=0,NSCFB=0,NSCFBVM=0,NSCFNR=0,NSCFNRVM=0,NSCFNL=0,NSCFNLVM=0,NSCD=0,NSCDVM=0,NSCFNRC=0,NSCFNRCVM=0,NSCLIP=0,NSCIDCW=0,NSRIO=0,NSCNIP=0,NSCLIR=0,NSRIP=0,NSCNIR=0,NSRID=0,NSNRID=0,NSRND=0,NSNRND=0,NSCW=0,NSCCW=0,NSOIP=0,NSACRM=0,NSGOIR=0,NSMOIR=0,NSTIP=0,NSTIR=0,NSOTIR=0,NSCLIPNOSCREENING=0,NSCR=0,NSWAKE_UP=0,NSAOC_D=0,NSAOC_E=0,NSXEXH=0,NSXEGJ=0,NSCWCFNR=0,NSIIFC=0,NSDN_CALL_OUT_BAR=0,NSCCBS=0,NSCCNR=0,NSCCBSR=0,NSCCNRR=0,NS3PTY=0,NSNPTY=0,NSDND=0,NSMCR=0,NSCBA=0,NSTMP_LIN=0,NSCODEC_CNTRL=0,NSMWI=0,NSDC=0,NSHOLD=0,NSECT=0,NSCFTB=0,NSDAN=0,NSSTOP_SECRET=0,NSMCID=0,NSEBO=0,NSICO=0,NSOUTG=0,NSINQYH=0,NSUINFO=0,NSDN_CALL_OUT_ALLOW=0,NSSIC=0,NSSOC=0,NSSETCFNRTIME=0,NSCFS=0,NSCFSB=0,NSFAX=0,NSABRC=0,NSACRTOVM=0,NSPREPAID=0,NSCRBT=0,NSICB=0,NSMRINGING=0,NSCIS=0,NSCBEG=0,NSCOLP=0,NSCOLR=0,NSCOLPOVR=0,NSBAOC=0,NSBOIC=0,NSBOICEXHC=0,NSBAIC=0,NSBICROM=0,NSSPEED_DIAL=0,NSSD1D=0,NSSD2D=0,NSGRNCALL=0,NSCPARK=0,NSGAA=0,NSQSNS=0,NSMSN=0,NSHOTLINE=0,NSAOC_S=0,NSNIGHTSRV=0,NSBACKNUM=0,NSAUTOCON=0,NSCAMPON=0,NSCTD=0,NSCLICKHOLD=0,NSQUEUE=0,NSSANSWER=0,NSICENCF=0,NSCFGO=0,NSCECT=0,NSCTGO=0,NSCTIO=0,NSSETBUSY=0,NSOVERSTEP=0,NSABSENT=0,NSMONITOR=0,NSFMONITOR=0,NSDISCNT=0,NSFDISCNT=0,NSINSERT=0,NSFINSERT=0,NSASI=0,NSPWCB=0,NSRD=0,NSLCPS=0,NSNCPS=0,NSICPS=0,NSCBCLOCK=0,NSMINIBAR=0,NSMCN=0,NSDSTR=0,NSOPRREG=0,NSONEKEY=0,NSINBOUND=0,NSOUTBOUND=0,NSCALLERID=0,NSCUN=0,NSIPTVVC=0,NSNP=0,NSSEC=0,NSSECSTA=0,NSHRCN=0,NSSB=0,LCO=1,LC=1,LCT=1,NTT=1,ITT=0,ICTX=1,OCTX=1,INTT=0,IITT=0,ICLT=0,ICDDD=0,ICIDD=0,IOLT=0,CTLCO=1,CTLCT=1,CTLD=1,CTINTNANP=1,CTINTWORLD=1,CTDA=1,CTOSM=1,CTOSP=0,CTOSP1=0,CCO1=0,CCO2=0,CCO3=0,CCO4=0,CCO5=0,CCO6=0,CCO7=0,CCO8=0,CCO9=0,CCO10=0,CCO11=0,CCO12=0,CCO13=0,CCO14=0,CCO15=0,CCO16=0,HIGHENTCO=0,OPERATOR=1,SUPYSRV=1,IDDCI=1,NTCI=1,LTCI=1,RSC=65535,CIG=4294967295,OUTRST=0,INRST=0,NOAT=20,VMAIND=65535,VDMAIND=65535,TGRP=65534,TIDHLD=28,TIDCW=23,SCF=0,LMTGRP=65534,FLBGRP=65535,SLBGRP=65535,COP="0000",G711_64K_A_LAW=1,G711_64K_U_LAW=1,G722=1,G723=1,G726=1,G728=1,G729=1,CODEC_MP4A=1,CODEC2833=1,CODEC2198=1,G726_40=1,G726_32=1,G726_24=1,G726_16=1,AMR=1,CLEARMODE=1,ILBC=1,SPEEX=1,G729EV=1,EVRC=1,EVRCB=1,H261=1,H263=1,CODEC_MP4V=1,H264=1,T38=1,T120=1,G711A_VBD=1,G711U_VBD=1,G726_VBD=1,G726_40_VBD=1,G726_32_VBD=1,G726_24_VBD=1,G726_16_VBD=1,WIND_BAND_AMR=1,GSM610=1,H263_2000=1,BROADVOICE_32=1,UNKNOWN_CODEC=1,ACODEC=255,VCODEC=255,POLIDX=255,NCPI=255,ICPI=255,EBOCL=0,EBOPL=0,EBOIT=2,RM=0,CPC=0,PCHG=65535,TFPT=4,CHT=0,MCIDMODE=0,MCIDCMODE=255,MCIDAMODE=0,PREPAIDIDX=65535,CRBTID=65535,ODBBICTYPE=0,ODBBOCTYPE=0,ODBBARTYPE=0,ODBSS=0,ODBBRCFTYPE=0,PNOTI=0,MAXPARACALL=1,ATSDTMBUSY=1,CALLCOUNT=1,CDNOTICALLER=0,ISCHGFLAG=0,CHC=0,CUSER=0,STCF=0,CHARSC=65535,REGUIDX=0,SOCBFUNC=255,SOCBPTONEIDX=65535,ADMINCBA=0,ADCONTROL_DIVERSION=0,CPCRUS=255,CUSCAT=0,SPT100REL=1;
 387:              ims.AddSbr(service, out Client.Huawei.Ims.ResultCode addSbrResultCode);
 388:              resultCodeString += "AddSbr: " + addSbrResultCode.ToString() + ", ";
 389:   
 390:              // ME:name=tecens; 
 391:              // ADD DNAPTRREC: NAME="0.0.0.0.2.2.2.2.5.6.9.e164.arpa", ZONENAME="5.6.9.e164.arpa", ORDER=0, PREFERENCE=10, FLAGS="U", SERVICE="E2U+sip", REGEXP="!^..*$!sip:+96522220000@ims.moc.kw!", REPLACEMENT="ims.moc.kw.";
 392:              ims.AddDnaptrrec(service, out Client.Huawei.Ims.ResultCode addDnaptrrecResultCode);
 393:              resultCodeString += "AddDnaptrrec: " + addDnaptrrecResultCode.ToString();
 394:   
 395:              if (true) // check that all is OK in CreateH248Subscriber part
 396:              {
 397:                  subscriberCreated = true;
 398:              }
 399:              else
 400:              {
 401:   
 402:              }
 403:   
 404:              result = "Create subscriber: " + service + ", resultCodeString: " + resultCodeString + ". ";
 405:   
 406:              return subscriberCreated;
 407:          }
 408:   
 409:          ////////////////////////////////////////////////////////////////////////////
 410:   
 411:          /// <summary>
 412:          ///
 413:          /// </summary>
 414:          public static void DeleteSubscriber(Ia.Ngn.Cl.Model.Client.Huawei.Ims ims, string service, out string result)
 415:          {
 416:              string resultCodeString;
 417:              Ia.Ngn.Cl.Model.Client.Huawei.Ims.ResultCode rmvDnaptrrecResultCode, rmvSbrResultCode, rmvHsubResultCode, rmvHsdainfResultCode;
 418:   
 419:              result = resultCodeString = string.Empty;
 420:   
 421:              // ME:name=tecens; 
 422:              // RMV DNAPTRREC: NAME="0.0.0.0.2.2.2.2.5.6.9.e164.arpa";
 423:              ims.RmvDnaptrrec(service, out rmvDnaptrrecResultCode);
 424:              resultCodeString += "RmvDnaptrrec: " + rmvDnaptrrecResultCode.ToString() + ", ";
 425:   
 426:              // ME:name=tecats0; 
 427:              // RMV SBR: IMPU="tel:+96522220000";
 428:              ims.RmvSbr(service, out rmvSbrResultCode);
 429:              resultCodeString += "RmvSbr: " + rmvSbrResultCode.ToString() + ", ";
 430:   
 431:              // ME:name=techss; 
 432:              // RMV HSUB: SUBID="+96522220000@ims.moc.kw";
 433:              ims.RmvHsub(service, out rmvHsubResultCode);
 434:              resultCodeString += "RmvHsub: " + rmvHsubResultCode.ToString() + ", ";
 435:   
 436:              // RMV HSDAINF: IMPI="+96522220000@ims.moc.kw";
 437:              ims.RmvHsdainf(service, out rmvHsdainfResultCode);
 438:              resultCodeString += "RmvHsdainf: " + rmvHsdainfResultCode.ToString();
 439:   
 440:              result = service + ", delete subscriber: " + resultCodeString + ". ";
 441:          }
 442:   
 443:          ////////////////////////////////////////////////////////////////////////////
 444:   
 445:          /// <summary>
 446:          ///
 447:          /// </summary>
 448:          public static void AssignSupplementaryService(Ia.Ngn.Cl.Model.Client.Huawei.Ims ims, string service, Ia.Ngn.Cl.Model.Business.Service.SupplementaryService supplementaryService, bool supplementaryServiceState, out string result)
 449:          {
 450:              string impu;
 451:              Ia.Ngn.Cl.Model.Client.Huawei.Ims.ResultCode resultCode;
 452:   
 453:              result = string.Empty;
 454:   
 455:              impu = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.ImpuSipDomain(service);
 456:   
 457:              switch (supplementaryService)
 458:              {
 459:                  //newService.ServiceSuspension =;
 460:                  // newService.Pin = (int.TryParse(huSbr.COP, out i)) ? i : 0;
 461:   
 462:                  case (Ia.Ngn.Cl.Model.Business.Service.SupplementaryService.AbbriviatedCalling):
 463:                      {
 464:                          ims.ModSbrNsabrc(service, supplementaryServiceState, out resultCode);
 465:                          result = service + ",AbbriviatedCalling: " + supplementaryServiceState.ToString().ToLower() + "," + resultCode.ToString();
 466:                          break;
 467:                      }
 468:                  case (Ia.Ngn.Cl.Model.Business.Service.SupplementaryService.CallerId):
 469:                      {
 470:                          ims.ModSbrNsclip(service, supplementaryServiceState, out resultCode);
 471:                          result = service + ",CallerId: " + supplementaryServiceState.ToString().ToLower() + "," + resultCode.ToString();
 472:                          break;
 473:                      }
 474:                  case (Ia.Ngn.Cl.Model.Business.Service.SupplementaryService.CallForwarding):
 475:                      {
 476:                          ims.ModSbrNscfu(service, supplementaryServiceState, out resultCode);
 477:                          result = service + ",CallForwarding: " + supplementaryServiceState.ToString().ToLower() + "," + resultCode.ToString();
 478:                          break;
 479:                      }
 480:                  case (Ia.Ngn.Cl.Model.Business.Service.SupplementaryService.CallWaiting):
 481:                      {
 482:                          ims.ModSbrNscw(service, supplementaryServiceState, out resultCode);
 483:                          result = service + ",CallWaiting: " + supplementaryServiceState.ToString().ToLower() + "," + resultCode.ToString();
 484:                          break;
 485:                      }
 486:                  case (Ia.Ngn.Cl.Model.Business.Service.SupplementaryService.ConferenceCall):
 487:                      {
 488:                          ims.ModSbrNs3pty(service, supplementaryServiceState, out resultCode);
 489:                          result = service + ",ConferenceCall: " + supplementaryServiceState.ToString().ToLower() + "," + resultCode.ToString();
 490:                          break;
 491:                      }
 492:                  case (Ia.Ngn.Cl.Model.Business.Service.SupplementaryService.WakeupCall):
 493:                      {
 494:                          ims.ModSbrNswakeup(service, supplementaryServiceState, out resultCode);
 495:                          result = service + ",WakeupCall: " + supplementaryServiceState.ToString().ToLower() + "," + resultCode.ToString();
 496:                          break;
 497:                      }
 498:                  case (Ia.Ngn.Cl.Model.Business.Service.SupplementaryService.InternationalCallingUserControlled):
 499:                      {
 500:                          ims.ModSbrNscba(service, supplementaryServiceState, out resultCode);
 501:                          result = service + ",InternationalCallingUserControlled: " + supplementaryServiceState.ToString().ToLower() + "," + resultCode.ToString();
 502:                          break;
 503:                      }
 504:                  case (Ia.Ngn.Cl.Model.Business.Service.SupplementaryService.InternationalCalling):
 505:                      {
 506:                          ims.ModSbrItt(service, supplementaryServiceState, out resultCode);
 507:                          result = service + ",InternationalCalling: " + supplementaryServiceState.ToString().ToLower() + "," + resultCode.ToString();
 508:                          break;
 509:                      }
 510:                  default:
 511:                      {
 512:                          result = service + ",unknown SupplementaryService: " + supplementaryServiceState.ToString().ToLower();
 513:                          break;
 514:                      }
 515:              }
 516:          }
 517:   
 518:          ////////////////////////////////////////////////////////////////////////////
 519:   
 520:          /// <summary>
 521:          ///
 522:          /// </summary>
 523:          public static void AssignServiceSuspensionStateToServiceSubscriber(Ia.Ngn.Cl.Model.Client.Huawei.Ims client, string service, bool serviceSuspensionState, out string result)
 524:          {
 525:              Ia.Ngn.Cl.Model.Client.Huawei.Ims.ResultCode resultCode;
 526:   
 527:              client.SetOwSbr(service, serviceSuspensionState, out resultCode);
 528:   
 529:              result = service + ",service suspension: " + serviceSuspensionState.ToString().ToLower() + "," + resultCode.ToString();
 530:          }
 531:   
 532:          ////////////////////////////////////////////////////////////////////////////
 533:          ////////////////////////////////////////////////////////////////////////////
 534:   
 535:          /// <summary>
 536:          ///
 537:          /// </summary>
 538:          public static List<Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Ont> NddOntInHuaweiSwitchNokiaGponWithAccessList()
 539:          {
 540:              List<string> accessIdList;
 541:              List<Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Ont> list;
 542:   
 543:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
 544:              {
 545:                  var oltIdList = Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.HuaweiSwitchNokiaGponOltIdList;
 546:   
 547:                  accessIdList = (from a in db.Accesses where oltIdList.Contains(a.Olt) select a.Id).ToList();
 548:   
 549:                  list = (from o in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.OntList
 550:                          where accessIdList.Contains(o.Access.Id) 
 551:                          && o.Pon.PonGroup.Olt.Odf.Router.Vendor == Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Huawei
 552:                          && o.Pon.PonGroup.Olt.Odf.Vendor == Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Nokia
 553:                          select o).ToList();
 554:              }
 555:   
 556:              return list;
 557:          }
 558:   
 559:          ////////////////////////////////////////////////////////////////////////////
 560:   
 561:          /// <summary>
 562:          ///
 563:          /// </summary>
 564:          public static List<Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Ont> NddOntInHuaweiSwitchNokiaGponList()
 565:          {
 566:              List<Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Ont> list;
 567:   
 568:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
 569:              {
 570:                  var oltIdList = Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.HuaweiSwitchNokiaGponOltIdList;
 571:   
 572:                  list = (from o in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.OntList
 573:                          where o.Pon.PonGroup.Olt.Odf.Router.Vendor == Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Huawei
 574:                          && o.Pon.PonGroup.Olt.Odf.Vendor == Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Nokia
 575:                          select o).ToList();
 576:              }
 577:   
 578:              return list;
 579:          }
 580:   
 581:          ////////////////////////////////////////////////////////////////////////////
 582:   
 583:          /// <summary>
 584:          ///
 585:          /// </summary>
 586:          public static List<Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Ont> NddHuaweiSwitchAndNokiaGponOntWithAccessButNoMgwRecord()
 587:          {
 588:              List<string> accessIdList;
 589:              List<Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Ont> nddOntList, nddOntWithinAccessList;
 590:   
 591:              using (var db = new Ia.Ngn.Cl.Model.Ngn())
 592:              {
 593:                  var oltIdList = Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.HuaweiSwitchNokiaGponOltIdList;
 594:   
 595:                  accessIdList = (from a in db.Accesses where oltIdList.Contains(a.Olt) select a.Id).ToList();
 596:   
 597:                  nddOntWithinAccessList = (from o in Ia.Ngn.Cl.Model.Data.NetworkDesignDocument.OntList
 598:                                            where accessIdList.Contains(o.Access.Id) 
 599:                                            && o.Pon.PonGroup.Olt.Odf.Router.Vendor == Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Huawei
 600:                                            && o.Pon.PonGroup.Olt.Odf.Vendor == Ia.Ngn.Cl.Model.Business.NetworkDesignDocument.Vendor.Nokia
 601:                                            select o).ToList();
 602:   
 603:                  var mgwList = (from m in db.Mgws select new { NetworkElement = m.NetworkElement, RA1 = m.RA1 }).ToList();
 604:   
 605:                  // below: ONTs in Accesses but not in Mgws list
 606:                  var tecNddOntList = (from no in nddOntWithinAccessList
 607:                                       join m in mgwList.Where(u => u.NetworkElement == Ia.Ngn.Cl.Model.Business.Huawei.SoftX.TecNetworkElement.Domain) on no.Ip equals m.RA1
 608:                                       into gj
 609:                                       from sub in gj.DefaultIfEmpty()
 610:                                       where sub == null
 611:                                       select no).ToList();
 612:   
 613:                  var skbNddOntList = (from no in nddOntWithinAccessList
 614:                                       join m in mgwList.Where(u => u.NetworkElement == Ia.Ngn.Cl.Model.Business.Huawei.SoftX.SkbNetworkElement.Domain) on no.Ip equals m.RA1
 615:                                       into gj
 616:                                       from sub in gj.DefaultIfEmpty()
 617:                                       where sub == null
 618:                                       select no).ToList();
 619:   
 620:                  nddOntList = tecNddOntList.Except(skbNddOntList).Union(skbNddOntList.Except(tecNddOntList)).ToList(); // tecNddOntList.Union(skbNddOntList).ToList();
 621:              }
 622:   
 623:              return nddOntList;
 624:          }
 625:   
 626:          ////////////////////////////////////////////////////////////////////////////
 627:          ////////////////////////////////////////////////////////////////////////////
 628:      }
 629:   
 630:      ////////////////////////////////////////////////////////////////////////////
 631:      ////////////////////////////////////////////////////////////////////////////
 632:  }