)>}]
شركة التطبيقات المتكاملة لتصميم وبرمجة البرمجيات الخاصة ش.ش.و.
Integrated Applications Programming Company
Home » Code Library » Ims (Ia.Ftn.Cl.Model.Data.Huawei)

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

Fixed Telecommunications Network's Operations Support System Management Intranet (FTN OSS) support class for Huawei's Fixed Telecommunications Network (FTN) data model

    1: using Microsoft.EntityFrameworkCore;
    2: using System;
    3: using System.Collections.Generic;
    4: using System.Linq;
    5:  
    6: namespace Ia.Ftn.Cl.Model.Data.Huawei
    7: {
    8:     ////////////////////////////////////////////////////////////////////////////
    9:  
   10:     /// <summary publish="true">
   11:     /// Fixed Telecommunications Network's Operations Support System Management Intranet (FTN OSS) support class for Huawei's Fixed Telecommunications Network (FTN) data model
   12:     /// </summary>
   13:     /// 
   14:     /// <remarks> 
   15:     /// Copyright © 2014-2020 Jasem Y. Al-Shamlan (info@ia.com.kw), Integrated Applications - Kuwait. All Rights Reserved.
   16:     ///
   17:     /// 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
   18:     /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
   19:     ///
   20:     /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
   21:     /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
   22:     /// 
   23:     /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
   24:     /// 
   25:     /// Copyright notice: This notice may not be removed or altered from any source distribution.
   26:     /// </remarks> 
   27:     public class Ims
   28:     {
   29:         ////////////////////////////////////////////////////////////////////////////
   30:  
   31:         /// <summary>
   32:         ///
   33:         /// </summary>
   34:         public Ims()
   35:         {
   36:         }
   37:  
   38:         ////////////////////////////////////////////////////////////////////////////
   39:  
   40:         /// <summary>
   41:         ///
   42:         /// </summary>
   43:         public static bool UpdateSbr(string impu, Ia.Ftn.Cl.Model.Huawei.Sbr newSbr, Ia.Ftn.Cl.Model.Client.Huawei.Ims.ResultCode resultCode)
   44:         {
   45:             bool isOk;
   46:             Ia.Ftn.Cl.Model.Huawei.Sbr sbr;
   47:  
   48:             isOk = false;
   49:  
   50:             using (var db = new Ia.Ftn.Cl.Model.Db())
   51:             {
   52:                 sbr = (from s in db.Sbrs where s.IMPU == impu select s).SingleOrDefault();
   53:  
   54:                 switch (resultCode)
   55:                 {
   56:                     case Ia.Ftn.Cl.Model.Client.Huawei.Ims.ResultCode.OperationSucceeded:
   57:                         {
   58:                             if (sbr == null)
   59:                             {
   60:                                 newSbr.Created = newSbr.Updated = DateTime.UtcNow.AddHours(3);
   61:  
   62:                                 db.Sbrs.Add(newSbr);
   63:                             }
   64:                             else
   65:                             {
   66:                                 if (sbr.Update(newSbr))
   67:                                 {
   68:                                     db.Sbrs.Attach(sbr);
   69:                                     db.Entry(sbr).State = Microsoft.EntityFrameworkCore.EntityState.Modified;
   70:                                 }
   71:                             }
   72:  
   73:                             break;
   74:                         }
   75:                     case Ia.Ftn.Cl.Model.Client.Huawei.Ims.ResultCode.TheSubscriberIsNotDefinedInTheHssOrAtsOrServiceDataIsNotConfiguredForTheSubscriber:
   76:                     case Ia.Ftn.Cl.Model.Client.Huawei.Ims.ResultCode.NoServiceData:
   77:                         {
   78:                             if (sbr == null) { }
   79:                             else db.Sbrs.Remove(sbr);
   80:  
   81:                             break;
   82:                         }
   83:                     default:
   84:                         {
   85:                             throw new Exception("Undefined result code seen in Ia.Ftn.Cl.Model.Client.Huawei.Ims.ResultCode");
   86:                         }
   87:                 }
   88:  
   89:                 db.SaveChanges();
   90:  
   91:                 isOk = true;
   92:             }
   93:  
   94:             return isOk;
   95:         }
   96:  
   97:         ////////////////////////////////////////////////////////////////////////////
   98:  
   99:         /// <summary>
  100:         ///
  101:         /// </summary>
  102:         public static bool UpdateOwsbr(string impu, Ia.Ftn.Cl.Model.Huawei.Owsbr newOwsbr, Ia.Ftn.Cl.Model.Client.Huawei.Ims.ResultCode resultCode)
  103:         {
  104:             bool isOk;
  105:             Ia.Ftn.Cl.Model.Huawei.Owsbr owsbr;
  106:  
  107:             isOk = false;
  108:  
  109:             using (var db = new Ia.Ftn.Cl.Model.Db())
  110:             {
  111:                 owsbr = (from o in db.Owsbrs where o.IMPU == impu select o).SingleOrDefault();
  112:  
  113:                 switch (resultCode)
  114:                 {
  115:                     case Ia.Ftn.Cl.Model.Client.Huawei.Ims.ResultCode.OperationSucceeded:
  116:                         {
  117:                             if (owsbr == null)
  118:                             {
  119:                                 newOwsbr.Created = newOwsbr.Updated = DateTime.UtcNow.AddHours(3);
  120:  
  121:                                 db.Owsbrs.Add(newOwsbr);
  122:                             }
  123:                             else
  124:                             {
  125:                                 if (owsbr.Update(newOwsbr))
  126:                                 {
  127:                                     db.Owsbrs.Attach(owsbr);
  128:                                     db.Entry(owsbr).State = Microsoft.EntityFrameworkCore.EntityState.Modified;
  129:                                 }
  130:                             }
  131:  
  132:                             break;
  133:                         }
  134:                     case Ia.Ftn.Cl.Model.Client.Huawei.Ims.ResultCode.TheSubscriberIsNotDefinedInTheHssOrAtsOrServiceDataIsNotConfiguredForTheSubscriber:
  135:                     case Ia.Ftn.Cl.Model.Client.Huawei.Ims.ResultCode.NoServiceData:
  136:                         {
  137:                             if (owsbr == null) { }
  138:                             else db.Owsbrs.Remove(owsbr);
  139:  
  140:                             break;
  141:                         }
  142:                     default:
  143:                         {
  144:                             throw new Exception("Undefined result code seen in Ia.Ftn.Cl.Model.Client.Huawei.Ims.ResultCode");
  145:                         }
  146:                 }
  147:  
  148:                 db.SaveChanges();
  149:  
  150:                 isOk = true;
  151:             }
  152:  
  153:             return isOk;
  154:         }
  155:  
  156:         ////////////////////////////////////////////////////////////////////////////
  157:  
  158:         /// <summary>
  159:         ///
  160:         /// </summary>
  161:         public static bool UpdateServiceForSbr(string impu, string accessId)
  162:         {
  163:             bool insert, update, delete;
  164:             int number, serviceType;
  165:             string serviceId, service, impi, impuAid;//, prividUser;
  166:             Ia.Ftn.Cl.Model.Service2 service2, newService;
  167:             Ia.Ftn.Cl.Model.Huawei.Sbr sbr;
  168:  
  169:             insert = update = delete = false;
  170:             //result = new Ia.Cl.Models.Result();
  171:  
  172:             number = Ia.Ftn.Cl.Model.Business.NumberFormatConverter.Number(impu);
  173:             impi = Ia.Ftn.Cl.Model.Business.NumberFormatConverter.Impi(impu);
  174:             impuAid = Ia.Ftn.Cl.Model.Business.NumberFormatConverter.ImpuAid(impu);
  175:  
  176:             service = number.ToString();
  177:  
  178:             serviceType = Ia.Ftn.Cl.Model.Business.Service.ServiceType.ImsService;
  179:             serviceId = Ia.Ftn.Cl.Model.Business.Service2.ServiceId(service, serviceType);
  180:  
  181:             using (var db = new Ia.Ftn.Cl.Model.Db())
  182:             {
  183:                 sbr = (from s in db.Sbrs where s.IMPU == impu select s).SingleOrDefault();
  184:  
  185:                 if (sbr != null)
  186:                 {
  187:                     newService = new Ia.Ftn.Cl.Model.Service2();
  188:  
  189:                     newService.Id = serviceId;
  190:                     newService.AreaCode = Ia.Ftn.Cl.Model.Business.Service.CountryCode;
  191:                     newService.Service = service;
  192:                     newService.ServiceType = serviceType;
  193:  
  194:                     //newService.Port = "Hu?";
  195:  
  196:                     newService.AbbriviatedCalling = sbr.NSABRC;
  197:                     newService.CallerId = sbr.NSCLIP;
  198:                     newService.CallForwarding = sbr.NSCFU;
  199:                     newService.CallWaiting = sbr.NSCW;
  200:                     newService.ConferenceCall = sbr.NS3PTY;
  201:  
  202:                     newService.AlarmCall = sbr.NSWAKE_UP;
  203:                     newService.WakeupCall = sbr.NSWAKE_UP;
  204:  
  205:                     newService.InternationalCallingUserControlled = sbr.NSCBA;
  206:                     newService.InternationalCalling = sbr.ITT;
  207:  
  208:                     //newService.ServiceSuspension = sbr.NSWAKE_UP;
  209:  
  210:                     newService.Pin = (int.TryParse(sbr.COP, out int i)) ? i : 0;
  211:  
  212:                     if (!string.IsNullOrEmpty(accessId)) newService.Access = (from a in db.Accesses where a.Id == accessId select a).SingleOrDefault();
  213:                     else newService.Access = null;
  214:  
  215:                     service2 = (from s in db.Service2
  216:                                 where s.ServiceType == Ia.Ftn.Cl.Model.Business.Service.ServiceType.ImsService && s.Id == newService.Id
  217:                                 select s).SingleOrDefault();
  218:  
  219:                     if (service2 == null)
  220:                     {
  221:                         newService.Created = newService.Updated = DateTime.UtcNow.AddHours(3);
  222:                         db.Service2.Add(newService);
  223:  
  224:                         insert = true;
  225:                     }
  226:                     else
  227:                     {
  228:                         if (service2.Update(newService))
  229:                         {
  230:                             db.Service2.Attach(service2);
  231:                             db.Entry(service2).State = Microsoft.EntityFrameworkCore.EntityState.Modified;
  232:  
  233:                             update = true;
  234:                         }
  235:                         else update = false;
  236:                     }
  237:                 }
  238:                 else
  239:                 {
  240:                     service2 = (from s in db.Service2
  241:                                 where s.ServiceType == Ia.Ftn.Cl.Model.Business.Service.ServiceType.ImsService && s.Id == serviceId
  242:                                 select s).SingleOrDefault();
  243:  
  244:                     if (service2 != null)
  245:                     {
  246:                         db.Service2.Remove(service2);
  247:  
  248:                         delete = true;
  249:                     }
  250:                 }
  251:  
  252:                 db.SaveChanges();
  253:             }
  254:  
  255:             //result.AddSuccess(service + ": state: " + Ia.Ftn.Cl.Model.Ui.Text.ExpressionOfInsertOrUpdateOrDelete(insert, update, delete));
  256:  
  257:             return insert || update || delete;
  258:         }
  259:  
  260:         ////////////////////////////////////////////////////////////////////////////
  261:  
  262:         /// <summary>
  263:         ///
  264:         /// </summary>
  265:         public static bool UpdateServiceServiceSuspensionForOwsbr(string impu, out Ia.Cl.Models.Result result)
  266:         {
  267:             bool isOk, serviceSuspensionState;
  268:             int n, serviceType;
  269:             string serviceId;
  270:             Ia.Ftn.Cl.Model.Service2 service;
  271:             Ia.Ftn.Cl.Model.Huawei.Owsbr owsbr;
  272:  
  273:             isOk = false;
  274:             serviceType = Ia.Ftn.Cl.Model.Business.Service.ServiceType.ImsService;
  275:             result = new Ia.Cl.Models.Result();
  276:  
  277:             n = Ia.Ftn.Cl.Model.Business.NumberFormatConverter.Number(impu);
  278:             serviceId = Ia.Ftn.Cl.Model.Business.Service2.ServiceId(n.ToString(), serviceType);
  279:  
  280:             using (var db = new Ia.Ftn.Cl.Model.Db())
  281:             {
  282:                 owsbr = (from o in db.Owsbrs where o.IMPU == impu select o).SingleOrDefault();
  283:  
  284:                 if (owsbr != null)
  285:                 {
  286:                     service = (from s in db.Service2
  287:                                where s.ServiceType == Ia.Ftn.Cl.Model.Business.Service.ServiceType.ImsService && s.Id == serviceId
  288:                                select s).SingleOrDefault();
  289:  
  290:                     if (service != null)
  291:                     {
  292:                         serviceSuspensionState = Ia.Ftn.Cl.Model.Business.Huawei.Owsbr.ServiceSuspensionState(owsbr);
  293:  
  294:                         if (service.ServiceSuspension != serviceSuspensionState)
  295:                         {
  296:                             service.ServiceSuspension = serviceSuspensionState;
  297:                             //service.UserId = userId;
  298:  
  299:                             db.Service2.Attach(service);
  300:                             db.Entry(service).Property(u => u.ServiceSuspension).IsModified = true;
  301:  
  302:                             db.SaveChanges();
  303:  
  304:                             result.AddSuccess("ServiceSuspension updated. ");
  305:                         }
  306:                         else
  307:                         {
  308:                             result.AddWarning("Warning: ServiceRequestService ServiceSuspension value was not updated because its the same. ");
  309:                         }
  310:                     }
  311:                     else
  312:                     {
  313:                         result.AddError("Error: serviceRequestService is null. ");
  314:                     }
  315:  
  316:                     db.SaveChanges();
  317:  
  318:                     isOk = true;
  319:                 }
  320:                 else
  321:                 {
  322:                     result.AddError("Error: owsbr is null. ");
  323:                 }
  324:             }
  325:  
  326:             return isOk;
  327:         }
  328:  
  329:         ////////////////////////////////////////////////////////////////////////////
  330:  
  331:         /// <summary>
  332:         ///
  333:         /// </summary>
  334:         public static bool CreateSubscriber(Ia.Ftn.Cl.Model.Client.Huawei.Ims ims, string service, out string result)
  335:         {
  336:             bool subscriberCreated;
  337:             string resultCodeString;
  338:  
  339:             resultCodeString = string.Empty;
  340:  
  341:             // ME:name=techss;
  342:             // ADD HSDAINF:IMPI="+96522220000@ims.moc.kw",HUSERNAME="+96522220000@ims.moc.kw",PWD=admin,REALM="ims.moc.kw";
  343:             ims.AddHsdainf(service, out Client.Huawei.Ims.ResultCode addHsdainfResultCode);
  344:             resultCodeString += "AddHsdainf: " + addHsdainfResultCode.ToString() + ", ";
  345:  
  346:             // ADD HSUB:SUBID="+96522220000@ims.moc.kw",IMPI="+96522220000@ims.moc.kw",IMPU="sip:+96522220000@ims.moc.kw";
  347:             ims.AddHsub(service, out Client.Huawei.Ims.ResultCode addHsubResultCode);
  348:             resultCodeString += "AddHsub: " + addHsubResultCode.ToString() + ", ";
  349:  
  350:             // ADD HIMPU:IMPI="+96522220000@ims.moc.kw",IMPU="tel:+96522220000";
  351:             ims.AddHimpu(service, out Client.Huawei.Ims.ResultCode addHimpuResultCode);
  352:             resultCodeString += "AddHimpu: " + addHimpuResultCode.ToString() + ", ";
  353:  
  354:             // SET HREGAUTH:IMPU="sip:+96522220000@ims.moc.kw",REGAUTH=TRUE;
  355:             ims.SetHregauth(service, out Client.Huawei.Ims.ResultCode setHregauthResultCode);
  356:             resultCodeString += "SetHregauth: " + setHregauthResultCode.ToString() + ", ";
  357:  
  358:             // SET HVNTPLID: IMPU="sip:+96522220000@ims.moc.kw", VNTPLID=0;
  359:             ims.SetHvntplidForImpuSipDomain(service, out Client.Huawei.Ims.ResultCode setHvntplidForImpuSipDomainResultCode);
  360:             resultCodeString += "SetHvntplidForImpuSipDomain: " + setHvntplidForImpuSipDomainResultCode.ToString() + ", ";
  361:  
  362:             // SET HVNTPLID: IMPU="tel:+96522220000", VNTPLID=0;
  363:             ims.SetHvntplidForImpu(service, out Client.Huawei.Ims.ResultCode setHvntplidForImpuResultCode);
  364:             resultCodeString += "SetHvntplidForImpu: " + setHvntplidForImpuResultCode.ToString() + ", ";
  365:  
  366:             // SET HIRS:IRSID=1,IMPULIST="\"sip:+96522220000@ims.moc.kw\"&\"tel:+96522220000\""; 
  367:             ims.SetHirs(service, out Client.Huawei.Ims.ResultCode setHirsResultCode);
  368:             resultCodeString += "SetHirs: " + setHirsResultCode.ToString() + ", ";
  369:  
  370:             // SET HDEFIMPU: IRSID=1, IMPU="sip:+96522220000@ims.moc.kw";
  371:             ims.SetHdefimpu(service, out Client.Huawei.Ims.ResultCode setHdefimpuResultCode);
  372:             resultCodeString += "SetHdefimpu: " + setHdefimpuResultCode.ToString() + ", ";
  373:  
  374:             // SET HSPSHARE:BASEIMPU="sip:+96522220000@ims.moc.kw",IMPU="tel:+96522220000";
  375:             ims.SetHspshare(service, out Client.Huawei.Ims.ResultCode setHspshareResultCode);
  376:             resultCodeString += "SetHspshare: " + setHspshareResultCode.ToString() + ", ";
  377:  
  378:             // SET HALIASPU:ALIASID=1,IMPULIST="\"sip:+96522220000@ims.moc.kw\"&\"tel:+96522220000\"";
  379:             ims.SetHaliaspu(service, out Client.Huawei.Ims.ResultCode setHaliaspuResultCode);
  380:             resultCodeString += "SetHaliaspu: " + setHaliaspuResultCode.ToString() + ", ";
  381:  
  382:             // ADD HSIFC:IMPU="sip:+96522220000@ims.moc.kw",SIFCID=1;
  383:             ims.AddHsifc(service, out Client.Huawei.Ims.ResultCode addHsifcResultCode);
  384:             resultCodeString += "AddHsifc: " + addHsifcResultCode.ToString() + ", ";
  385:  
  386:             // ME:name=tecats0; 
  387:             // 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;
  388:             ims.AddSbr(service, out Client.Huawei.Ims.ResultCode addSbrResultCode);
  389:             resultCodeString += "AddSbr: " + addSbrResultCode.ToString() + ", ";
  390:  
  391:             // ME:name=tecens; 
  392:             // 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.";
  393:             ims.AddDnaptrrec(service, out Client.Huawei.Ims.ResultCode addDnaptrrecResultCode);
  394:             resultCodeString += "AddDnaptrrec: " + addDnaptrrecResultCode.ToString();
  395:  
  396:             if (true) // check that all is OK in CreateH248Subscriber part
  397:             {
  398:                 subscriberCreated = true;
  399:             }
  400:             else
  401:             {
  402:  
  403:             }
  404:  
  405:             result = "Create subscriber: " + service + ", resultCodeString: " + resultCodeString + ". ";
  406:  
  407:             return subscriberCreated;
  408:         }
  409:  
  410:         ////////////////////////////////////////////////////////////////////////////
  411:  
  412:         /// <summary>
  413:         ///
  414:         /// </summary>
  415:         public static void DeleteSubscriber(Ia.Ftn.Cl.Model.Client.Huawei.Ims ims, string service, out string result)
  416:         {
  417:             string resultCodeString;
  418:             Ia.Ftn.Cl.Model.Client.Huawei.Ims.ResultCode rmvDnaptrrecResultCode, rmvSbrResultCode, rmvHsubResultCode, rmvHsdainfResultCode;
  419:  
  420:             result = resultCodeString = string.Empty;
  421:  
  422:             // ME:name=tecens; 
  423:             // RMV DNAPTRREC: NAME="0.0.0.0.2.2.2.2.5.6.9.e164.arpa";
  424:             ims.RmvDnaptrrec(service, out rmvDnaptrrecResultCode);
  425:             resultCodeString += "RmvDnaptrrec: " + rmvDnaptrrecResultCode.ToString() + ", ";
  426:  
  427:             // ME:name=tecats0; 
  428:             // RMV SBR: IMPU="tel:+96522220000";
  429:             ims.RmvSbr(service, out rmvSbrResultCode);
  430:             resultCodeString += "RmvSbr: " + rmvSbrResultCode.ToString() + ", ";
  431:  
  432:             // ME:name=techss; 
  433:             // RMV HSUB: SUBID="+96522220000@ims.moc.kw";
  434:             ims.RmvHsub(service, out rmvHsubResultCode);
  435:             resultCodeString += "RmvHsub: " + rmvHsubResultCode.ToString() + ", ";
  436:  
  437:             // RMV HSDAINF: IMPI="+96522220000@ims.moc.kw";
  438:             ims.RmvHsdainf(service, out rmvHsdainfResultCode);
  439:             resultCodeString += "RmvHsdainf: " + rmvHsdainfResultCode.ToString();
  440:  
  441:             result = service + ", delete subscriber: " + resultCodeString + ". ";
  442:         }
  443:  
  444:         ////////////////////////////////////////////////////////////////////////////
  445:  
  446:         /// <summary>
  447:         ///
  448:         /// </summary>
  449:         public static void UpdateSupplementaryService(Ia.Ftn.Cl.Model.Client.Huawei.Ims ims, string service, Ia.Ftn.Cl.Model.Business.Service.SupplementaryService supplementaryService, bool supplementaryServiceState, out string result)
  450:         {
  451:             string impu;
  452:             Ia.Ftn.Cl.Model.Client.Huawei.Ims.ResultCode resultCode;
  453:  
  454:             result = string.Empty;
  455:  
  456:             impu = Ia.Ftn.Cl.Model.Business.NumberFormatConverter.ImpuSipDomain(service);
  457:  
  458:             switch (supplementaryService)
  459:             {
  460:                 //newService.ServiceSuspension =;
  461:                 // newService.Pin = (int.TryParse(sbr.COP, out i)) ? i : 0;
  462:  
  463:                 case (Ia.Ftn.Cl.Model.Business.Service.SupplementaryService.AbbriviatedCalling):
  464:                     {
  465:                         ims.ModSbrNsabrc(service, supplementaryServiceState, out resultCode);
  466:                         result = service + ",AbbriviatedCalling: " + supplementaryServiceState.ToString().ToLower() + "," + resultCode.ToString();
  467:                         break;
  468:                     }
  469:                 case (Ia.Ftn.Cl.Model.Business.Service.SupplementaryService.CallerId):
  470:                     {
  471:                         ims.ModSbrNsclip(service, supplementaryServiceState, out resultCode);
  472:                         result = service + ",CallerId: " + supplementaryServiceState.ToString().ToLower() + "," + resultCode.ToString();
  473:                         break;
  474:                     }
  475:                 case (Ia.Ftn.Cl.Model.Business.Service.SupplementaryService.CallForwarding):
  476:                     {
  477:                         ims.ModSbrNscfu(service, supplementaryServiceState, out resultCode);
  478:                         result = service + ",CallForwarding: " + supplementaryServiceState.ToString().ToLower() + "," + resultCode.ToString();
  479:                         break;
  480:                     }
  481:                 case (Ia.Ftn.Cl.Model.Business.Service.SupplementaryService.CallWaiting):
  482:                     {
  483:                         ims.ModSbrNscw(service, supplementaryServiceState, out resultCode);
  484:                         result = service + ",CallWaiting: " + supplementaryServiceState.ToString().ToLower() + "," + resultCode.ToString();
  485:                         break;
  486:                     }
  487:                 case (Ia.Ftn.Cl.Model.Business.Service.SupplementaryService.ConferenceCall):
  488:                     {
  489:                         ims.ModSbrNs3pty(service, supplementaryServiceState, out resultCode);
  490:                         result = service + ",ConferenceCall: " + supplementaryServiceState.ToString().ToLower() + "," + resultCode.ToString();
  491:                         break;
  492:                     }
  493:                 case (Ia.Ftn.Cl.Model.Business.Service.SupplementaryService.WakeupCall):
  494:                     {
  495:                         ims.ModSbrNswakeup(service, supplementaryServiceState, out resultCode);
  496:                         result = service + ",WakeupCall: " + supplementaryServiceState.ToString().ToLower() + "," + resultCode.ToString();
  497:                         break;
  498:                     }
  499:                 case (Ia.Ftn.Cl.Model.Business.Service.SupplementaryService.InternationalCallingUserControlled):
  500:                     {
  501:                         ims.ModSbrNscba(service, supplementaryServiceState, out resultCode);
  502:                         result = service + ",InternationalCallingUserControlled: " + supplementaryServiceState.ToString().ToLower() + "," + resultCode.ToString();
  503:                         break;
  504:                     }
  505:                 case (Ia.Ftn.Cl.Model.Business.Service.SupplementaryService.InternationalCalling):
  506:                     {
  507:                         ims.ModSbrItt(service, supplementaryServiceState, out resultCode);
  508:                         result = service + ",InternationalCalling: " + supplementaryServiceState.ToString().ToLower() + "," + resultCode.ToString();
  509:                         break;
  510:                     }
  511:                 case (Ia.Ftn.Cl.Model.Business.Service.SupplementaryService.ServiceSuspension):
  512:                     {
  513:                         ims.SetOwSbr(service, supplementaryServiceState, out resultCode);
  514:                         result = service + ",ServiceSuspension: " + supplementaryServiceState.ToString().ToLower() + "," + resultCode.ToString();
  515:                         break;
  516:                     }
  517:                 default:
  518:                     {
  519:                         result = service + ",unknown SupplementaryService: " + supplementaryServiceState.ToString().ToLower();
  520:                         break;
  521:                     }
  522:             }
  523:         }
  524:  
  525:         ////////////////////////////////////////////////////////////////////////////
  526:  
  527:         /// <summary>
  528:         ///
  529:         /// </summary>
  530:         public static void AssignServiceSuspensionStateToServiceSubscriber(Ia.Ftn.Cl.Model.Client.Huawei.Ims client, string service, bool serviceSuspensionState, out string result)
  531:         {
  532:             Ia.Ftn.Cl.Model.Client.Huawei.Ims.ResultCode resultCode;
  533:  
  534:             client.SetOwSbr(service, serviceSuspensionState, out resultCode);
  535:  
  536:             result = service + ",service suspension: " + serviceSuspensionState.ToString().ToLower() + "," + resultCode.ToString();
  537:         }
  538:  
  539:         ////////////////////////////////////////////////////////////////////////////
  540:         ////////////////////////////////////////////////////////////////////////////
  541:  
  542:         /// <summary>
  543:         ///
  544:         /// </summary>
  545:         public static List<Ia.Ftn.Cl.Model.Business.NetworkDesignDocument.Ont> NddOntInHuaweiSwitchNokiaAccessWithAccessList()
  546:         {
  547:             List<string> accessIdList;
  548:             List<Ia.Ftn.Cl.Model.Business.NetworkDesignDocument.Ont> list;
  549:  
  550:             using (var db = new Ia.Ftn.Cl.Model.Db())
  551:             {
  552:                 var oltIdList = Ia.Ftn.Cl.Model.Data.NetworkDesignDocument.HuaweiRouterNokiaAccessOltIdList;
  553:  
  554:                 accessIdList = (from a in db.Accesses where oltIdList.Contains(a.Olt) select a.Id).ToList();
  555:  
  556:                 list = (from o in Ia.Ftn.Cl.Model.Data.NetworkDesignDocument.OntList
  557:                         where o.Pon.PonGroup.Olt.Odf.Router.Vendor == Ia.Ftn.Cl.Model.Business.NetworkDesignDocument.Vendor.Huawei
  558:                         && o.Pon.PonGroup.Olt.Odf.Vendor == Ia.Ftn.Cl.Model.Business.NetworkDesignDocument.Vendor.Nokia
  559:                         && accessIdList.Contains(o.Access.Id)
  560:                         select o).ToList();
  561:             }
  562:  
  563:             return list;
  564:         }
  565:  
  566:         ////////////////////////////////////////////////////////////////////////////
  567:  
  568:         /// <summary>
  569:         ///
  570:         /// </summary>
  571:         public static List<Ia.Ftn.Cl.Model.Business.NetworkDesignDocument.Ont> NddOntInHuaweiSwitchNokiaAccessList()
  572:         {
  573:             List<Ia.Ftn.Cl.Model.Business.NetworkDesignDocument.Ont> list;
  574:  
  575:             using (var db = new Ia.Ftn.Cl.Model.Db())
  576:             {
  577:                 var oltIdList = Ia.Ftn.Cl.Model.Data.NetworkDesignDocument.HuaweiRouterNokiaAccessOltIdList;
  578:  
  579:                 list = (from o in Ia.Ftn.Cl.Model.Data.NetworkDesignDocument.OntList
  580:                         where o.Pon.PonGroup.Olt.Odf.Router.Vendor == Ia.Ftn.Cl.Model.Business.NetworkDesignDocument.Vendor.Huawei
  581:                         && o.Pon.PonGroup.Olt.Odf.Vendor == Ia.Ftn.Cl.Model.Business.NetworkDesignDocument.Vendor.Nokia
  582:                         select o).ToList();
  583:             }
  584:  
  585:             return list;
  586:         }
  587:  
  588:         ////////////////////////////////////////////////////////////////////////////
  589:  
  590:         /// <summary>
  591:         ///
  592:         /// </summary>
  593:         public static List<Ia.Ftn.Cl.Model.Business.NetworkDesignDocument.Ont> NddHuaweiSwitchAndNokiaAccessOntWithAccessButNoMgwRecord()
  594:         {
  595:             List<string> accessIdList;
  596:             List<Ia.Ftn.Cl.Model.Business.NetworkDesignDocument.Ont> nddOntList, nddOntWithinAccessList;
  597:  
  598:             using (var db = new Ia.Ftn.Cl.Model.Db())
  599:             {
  600:                 var oltIdList = Ia.Ftn.Cl.Model.Data.NetworkDesignDocument.HuaweiRouterNokiaAccessOltIdList;
  601:  
  602:                 accessIdList = (from a in db.Accesses
  603:                                 where oltIdList.Contains(a.Olt)
  604:                                 select a.Id).AsNoTracking().ToList(); // change accessIdList to Dictionary
  605:  
  606:                 var ontList = Ia.Ftn.Cl.Model.Data.NetworkDesignDocument.OntList;
  607:  
  608:                 nddOntWithinAccessList = (from o in ontList
  609:                                           where o.Pon.PonGroup.Olt.Odf.Router.Vendor == Ia.Ftn.Cl.Model.Business.NetworkDesignDocument.Vendor.Huawei
  610:                                           && o.Pon.PonGroup.Olt.Odf.Vendor == Ia.Ftn.Cl.Model.Business.NetworkDesignDocument.Vendor.Nokia
  611:                                           && accessIdList.Contains(o.Access.Id)
  612:                                           select o).ToList();
  613:  
  614:                 var mgwList = (from m in db.Mgws
  615:                                select new { NetworkElement = m.NetworkElement, RA1 = m.RA1 }).AsNoTracking().ToList();
  616:  
  617:                 // below: ONTs in Accesses but not in Mgws list
  618:                 var tecNddOntList = (from no in nddOntWithinAccessList
  619:                                      join m in mgwList.Where(u => u.NetworkElement == Ia.Ftn.Cl.Model.Business.Huawei.SoftX.TecNetworkElement.Domain) on no.Ip equals m.RA1
  620:                                      into gj
  621:                                      from sub in gj.DefaultIfEmpty()
  622:                                      where sub == null
  623:                                      select no).ToList();
  624:  
  625:                 var skbNddOntList = (from no in nddOntWithinAccessList
  626:                                      join m in mgwList.Where(u => u.NetworkElement == Ia.Ftn.Cl.Model.Business.Huawei.SoftX.SkbNetworkElement.Domain) on no.Ip equals m.RA1
  627:                                      into gj
  628:                                      from sub in gj.DefaultIfEmpty()
  629:                                      where sub == null
  630:                                      select no).ToList();
  631:  
  632:                 //nddOntList = tecNddOntList.Except(skbNddOntList).Union(skbNddOntList.Except(tecNddOntList)).ToList();
  633:                 nddOntList = tecNddOntList.Union(skbNddOntList).ToList();
  634:             }
  635:  
  636:             return nddOntList;
  637:         }
  638:  
  639:         ////////////////////////////////////////////////////////////////////////////
  640:         ////////////////////////////////////////////////////////////////////////////
  641:     }
  642:  
  643:     ////////////////////////////////////////////////////////////////////////////
  644:     ////////////////////////////////////////////////////////////////////////////
  645: }