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

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) business model

   1:  using System.Collections.Generic;
   2:  using System.Configuration;
   3:  using System.Linq;
   4:   
   5:  namespace Ia.Ngn.Cl.Model.Business.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) business model
  11:      /// </summary>
  12:      /// 
  13:      /// <value>
  14:      ///   <appSettings>
  15:      ///     <add key="imsHuaweiServerHost" value="https://*" />
  16:      ///     <add key="imsHuaweiServerPort" value="*" />
  17:      ///     <add key="imsHuaweiServerServiceUrl" value="*" />
  18:      ///     <add key="imsHuaweiServerUser" value="*" />
  19:      ///     <add key="imsHuaweiServerUserPassword" value="*" />
  20:      ///   </appSettings>
  21:      /// </value>
  22:      /// 
  23:      /// <remarks> 
  24:      /// Copyright © 2014-2017 Jasem Y. Al-Shamlan (info@ia.com.kw), Integrated Applications - Kuwait. All Rights Reserved.
  25:      ///
  26:      /// 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
  27:      /// the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
  28:      ///
  29:      /// This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
  30:      /// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
  31:      /// 
  32:      /// You should have received a copy of the GNU General Public License along with this library. If not, see http://www.gnu.org/licenses.
  33:      /// 
  34:      /// Copyright notice: This notice may not be removed or altered from any source distribution.
  35:      /// </remarks> 
  36:      public class Ims
  37:      {
  38:          //private static int serviceRequestServiceServiceOfUnmatchedServicesListIndex;
  39:          private const string sipSubscriberRegistrationPassword = "admin"; // as per Huawei spec
  40:   
  41:          private static List<int> allPossibleServiceWithinHuaweiSwitchList = new List<int>();
  42:   
  43:          /// <summary/>
  44:          public static string BaseAddress { get { return ConfigurationManager.AppSettings["imsHuaweiServerHost"].ToString() + ":" + ConfigurationManager.AppSettings["imsHuaweiServerPort"].ToString(); } }
  45:          /// <summary/>
  46:          public static string ServiceUrl { get { return ConfigurationManager.AppSettings["imsHuaweiServerServiceUrl"].ToString(); } }
  47:          /// <summary/>
  48:          public static string UserName { get { return ConfigurationManager.AppSettings["imsHuaweiServerUser"].ToString(); } }
  49:          /// <summary/>
  50:          public static string Password { get { return ConfigurationManager.AppSettings["imsHuaweiServerUserPassword"].ToString(); } }
  51:   
  52:          public class ImsBasicService
  53:          {
  54:              public string MgcIp;
  55:              public string MgcSecondaryIp;
  56:              public string MgcSubnetMask;
  57:              public int Service;
  58:              public string Fsdb;
  59:              public string PrimarySwitch;
  60:          }
  61:   
  62:          public static ImsBasicService[] ImsBasicServiceList =
  63:              {
  64:              new ImsBasicService { MgcIp="10.10.9.10", MgcSecondaryIp="10.10.13.10", MgcSubnetMask="255.255.248.0", Service=0, Fsdb=string.Empty, PrimarySwitch=string.Empty },
  65:              new ImsBasicService { MgcIp="10.10.13.10", MgcSecondaryIp="10.10.9.10", MgcSubnetMask="255.255.248.0", Service=0, Fsdb=string.Empty, PrimarySwitch=string.Empty },
  66:              new ImsBasicService { MgcIp="10.10.9.253", MgcSecondaryIp="10.10.13.253", MgcSubnetMask="255.255.248.0", Service=0, Fsdb=string.Empty, PrimarySwitch=string.Empty },
  67:              new ImsBasicService { MgcIp="10.10.9.254", MgcSecondaryIp="10.10.13.254", MgcSubnetMask="255.255.248.0", Service=0, Fsdb=string.Empty, PrimarySwitch=string.Empty },
  68:              new ImsBasicService { MgcIp="10.133.0.1", MgcSecondaryIp="10.133.13.1", MgcSubnetMask="255.255.248.0", Service=0, Fsdb=string.Empty, PrimarySwitch=string.Empty },
  69:              new ImsBasicService { MgcIp="10.16.5.142", MgcSecondaryIp="10.16.0.142", MgcSubnetMask="255.255.248.0", Service=0, Fsdb=string.Empty, PrimarySwitch=string.Empty },
  70:          };
  71:   
  72:          public static string SipSubscriberRegistrationPassword { get { return sipSubscriberRegistrationPassword; } }
  73:   
  74:          ////////////////////////////////////////////////////////////////////////////
  75:   
  76:          /// <summary>
  77:          ///
  78:          /// </summary>
  79:          public Ims()
  80:          {
  81:          }
  82:   
  83:          ////////////////////////////////////////////////////////////////////////////
  84:   
  85:          /// <summary>
  86:          /// Return the IMS basic service for given MGC IP
  87:          /// </summary>
  88:          public static ImsBasicService ImsBasicServiceItem(string mgcIp)
  89:          {
  90:              ImsBasicService imsBasicService;
  91:   
  92:              imsBasicService = (from ibs in ImsBasicServiceList where ibs.MgcIp == mgcIp select ibs).Single();
  93:   
  94:              return imsBasicService;
  95:          }
  96:   
  97:          ////////////////////////////////////////////////////////////////////////////
  98:   
  99:          /// <summary>
 100:          ///
 101:          /// </summary>
 102:          public static string ServiceToReadServiceData(ref int referenceIndex, out int itemIndex, out int listCount)
 103:          {
 104:              if (allPossibleServiceWithinHuaweiSwitchList.JustStartedOrRolledOver())
 105:              {
 106:                  allPossibleServiceWithinHuaweiSwitchList = Ia.Ngn.Cl.Model.Data.Service.AllPossibleServiceNumberListWithinHuaweiSwitch;
 107:              }
 108:   
 109:              var service = allPossibleServiceWithinHuaweiSwitchList.Next(ref referenceIndex, out itemIndex, out listCount);
 110:   
 111:              return service.ToString();
 112:          }
 113:   
 114:          ////////////////////////////////////////////////////////////////////////////
 115:   
 116:          /// <summary>
 117:          ///
 118:          /// </summary>
 119:          public static void ReadSbrForService(Ia.Ngn.Cl.Model.Client.Huawei.Ims client, string service, out string result)
 120:          {
 121:              ReadUpdateSbrAndServiceForService(client, service, null, out result);
 122:          }
 123:   
 124:          ////////////////////////////////////////////////////////////////////////////
 125:   
 126:          /// <summary>
 127:          ///
 128:          /// </summary>
 129:          public static void ReadUpdateSbrAndServiceForService(Ia.Ngn.Cl.Model.Client.Huawei.Ims client, string service, string accessId, out string result)
 130:          {
 131:              bool sbrUpdated, owSbrUpdated, serviceSbrUpdated, serviceOwSbrUpdated;
 132:              string impuSipDomain;
 133:              Ia.Ngn.Cl.Model.Huawei.Owsbr owsbr;
 134:              Ia.Ngn.Cl.Model.Huawei.HuSbr sbr;
 135:   
 136:              result = "service: " + service + " ";
 137:   
 138:              sbr = client.LstSbr(service, out Client.Huawei.Ims.ResultCode lstSbrResultCode);
 139:   
 140:              if (lstSbrResultCode == Ia.Ngn.Cl.Model.Client.Huawei.Ims.ResultCode.OperationSucceeded
 141:                  || lstSbrResultCode == Ia.Ngn.Cl.Model.Client.Huawei.Ims.ResultCode.TheSubscriberIsNotDefinedInTheHssOrAtsOrServiceDataIsNotConfiguredForTheSubscriber
 142:                  || lstSbrResultCode == Ia.Ngn.Cl.Model.Client.Huawei.Ims.ResultCode.NoServiceData)
 143:              {
 144:                  impuSipDomain = Ia.Ngn.Cl.Model.Business.NumberFormatConverter.ImpuSipDomain(service);
 145:   
 146:                  sbrUpdated = Ia.Ngn.Cl.Model.Data.Huawei.Ims.UpdateSbr(impuSipDomain, sbr, lstSbrResultCode);
 147:   
 148:                  serviceSbrUpdated = Ia.Ngn.Cl.Model.Data.Huawei.Ims.UpdateServiceForSbr(impuSipDomain, accessId);
 149:   
 150:                  owsbr = client.LstOwSbr(service, out Client.Huawei.Ims.ResultCode lstOwSbrResultCode);
 151:   
 152:                  if (lstOwSbrResultCode == Ia.Ngn.Cl.Model.Client.Huawei.Ims.ResultCode.OperationSucceeded
 153:                      || lstOwSbrResultCode == Ia.Ngn.Cl.Model.Client.Huawei.Ims.ResultCode.TheSubscriberIsNotDefinedInTheHssOrAtsOrServiceDataIsNotConfiguredForTheSubscriber
 154:                      || lstOwSbrResultCode == Ia.Ngn.Cl.Model.Client.Huawei.Ims.ResultCode.NoServiceData)
 155:                  {
 156:                      owSbrUpdated = Ia.Ngn.Cl.Model.Data.Huawei.Ims.UpdateOwsbr(impuSipDomain, owsbr, lstSbrResultCode);
 157:                      serviceOwSbrUpdated = Ia.Ngn.Cl.Model.Data.Huawei.Ims.UpdateServiceServiceSuspensionForOwsbr(impuSipDomain, out Ia.Cl.Model.Result result2);
 158:   
 159:                      result += "sbr: " + lstSbrResultCode.ToString() + ", owsbr: " + lstOwSbrResultCode.ToString();
 160:                  }
 161:                  else
 162:                  {
 163:                      result += " error: owsbr: " + lstOwSbrResultCode.ToString();
 164:                  }
 165:              }
 166:              else
 167:              {
 168:                  result += " error: sbr: " + lstSbrResultCode.ToString();
 169:              }
 170:          }
 171:   
 172:          ////////////////////////////////////////////////////////////////////////////
 173:          ////////////////////////////////////////////////////////////////////////////
 174:      }
 175:   
 176:      ////////////////////////////////////////////////////////////////////////////
 177:      ////////////////////////////////////////////////////////////////////////////
 178:  }