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

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

Huawei's EMS VOIP PSTN User support class of Fixed Telecommunications Network (FTN) business model.

    1: using System;
    2:  
    3: namespace Ia.Ftn.Cl.Models.Business.Huawei
    4: {
    5:     ////////////////////////////////////////////////////////////////////////////
    6:  
    7:     /// <summary publish="true">
    8:     /// Huawei's EMS VOIP PSTN User support class of Fixed Telecommunications Network (FTN) business model.
    9:     /// </summary>
   10:     /// 
   11:     /// <remarks> 
   12:     /// Copyright © 2017-2022 Jasem Y. Al-Shamlan (info@ia.com.kw), Integrated Applications - Kuwait. All Rights Reserved.
   13:     /// </remarks> 
   14:     public class VoipPstnUser
   15:     {
   16:         private static int fixedLengthOfVoipPstnUserNddOntId = Ia.Ftn.Cl.Models.Business.Default.FixedLengthOfOntId + 3 + 3;
   17:         private static int fixedLengthOfVoipPstnUserMsanDevId = Ia.Ftn.Cl.Models.Business.Huawei.Dev.MsanDev.FixedLengthOfMsanDevId + 3 + 3;
   18:  
   19:         /// <summary/>
   20:         public static int FixedLengthOfVoipPstnUserNddOntId { get { return fixedLengthOfVoipPstnUserNddOntId; } }
   21:  
   22:         /// <summary/>
   23:         public static int FixedLengthOfVoipPstnUserMsanDevId { get { return fixedLengthOfVoipPstnUserMsanDevId; } }
   24:  
   25:         ////////////////////////////////////////////////////////////////////////////
   26:  
   27:         /// <summary>
   28:         ///
   29:         /// </summary>
   30:         public class DidFnSnPnDn
   31:         {
   32:             /// <summary/>
   33:             public int Did { get; set; }
   34:  
   35:             /// <summary/>
   36:             public int Fn { get; set; }
   37:  
   38:             /// <summary/>
   39:             public int Sn { get; set; }
   40:  
   41:             /// <summary/>
   42:             public int Pn { get; set; }
   43:  
   44:             /// <summary/>
   45:             public string Dn { get; set; }
   46:  
   47:             ////////////////////////////////////////////////////////////////////////////
   48:  
   49:             /// <summary>
   50:             ///
   51:             /// </summary>
   52:             public DidFnSnPnDn()
   53:             {
   54:                 this.Did = 0;
   55:                 this.Fn = 0;
   56:                 this.Sn = 0;
   57:                 this.Pn = 0;
   58:                 this.Dn = string.Empty;
   59:             }
   60:  
   61:             ////////////////////////////////////////////////////////////////////////////
   62:  
   63:             /// <summary>
   64:             ///
   65:             /// </summary>
   66:             public DidFnSnPnDn(int did, int fn, int sn, int pn, string dn)
   67:             {
   68:                 this.Did = did;
   69:                 this.Fn = fn;
   70:                 this.Sn = sn;
   71:                 this.Pn = pn;
   72:                 this.Dn = dn;
   73:             }
   74:  
   75:             ////////////////////////////////////////////////////////////////////////////
   76:  
   77:             /// <summary>
   78:             ///
   79:             /// </summary>
   80:             public string ToSimpleDidFnSnPnDnTextString()
   81:             {
   82:                 var s = "DID: " + this.Did + ", FN: " + this.Fn + ", SN: " + this.Sn + ", PN: " + this.Pn + ", DN: " + this.Dn;
   83:  
   84:                 return s;
   85:             }
   86:  
   87:             ////////////////////////////////////////////////////////////////////////////
   88:         }
   89:  
   90:         ////////////////////////////////////////////////////////////////////////////
   91:         ////////////////////////////////////////////////////////////////////////////
   92:  
   93:         /// <summary>
   94:         ///
   95:         /// </summary>
   96:         public VoipPstnUser() { }
   97:  
   98:         ////////////////////////////////////////////////////////////////////////////
   99:  
  100:         /// <summary>
  101:         ///
  102:         /// </summary>
  103:         public static string VoipPstnUserId(string ontId, int sn, int pn)
  104:         {
  105:             var id = ontId + sn.ToString().PadLeft(3, '0') + pn.ToString().PadLeft(3, '0'); // 3 because an MDU might have more than 100 numbers
  106:  
  107:             // fix code to include all MSAN DEV devs then use the code below (e.g. check the msanDev NOC_??_??...)
  108:             /*
  109:             if (id.Length != fixedLengthOfVoipPstnUserNddOntId && id.Length != fixedLengthOfVoipPstnUserMsanDevId)
  110:             {
  111:                 throw new ArgumentOutOfRangeException(@"VoipPstnUserId(): Id length is neither " + fixedLengthOfVoipPstnUserNddOntId + " nor " + fixedLengthOfVoipPstnUserMsanDevId);
  112:             }
  113:             */
  114:  
  115:             return id;
  116:         }
  117:  
  118:         ////////////////////////////////////////////////////////////////////////////
  119:  
  120:         /// <summary>
  121:         ///
  122:         /// </summary>
  123:         public static int SpecialIntegerParameterHandling(string parameterName, string parameterValue)
  124:         {
  125:             int i;
  126:  
  127:             if (parameterName == "TID")
  128:             {
  129:                 /// TID INTEGER 0-9999 Indicates the terminal ID
  130:  
  131:                 parameterValue = parameterValue.Replace("--", "-1");
  132:             }
  133:             else if (parameterName == "PITime")
  134:             {
  135:                 /// PITime INTEGER 0-20 Indicates the duration of waiting to collect digits. Unit: 10 ms. The MA5600T, MA5603T, MA5606T, MA5620E, MA5620G, MA5610, and MA5616 do not support this parameter. 
  136:  
  137:                 parameterValue = parameterValue.Replace("--", "-1");
  138:             }
  139:             else
  140:             {
  141:  
  142:             }
  143:  
  144:             i = int.Parse(parameterValue);
  145:  
  146:             return i;
  147:         }
  148:  
  149:         ////////////////////////////////////////////////////////////////////////////
  150:  
  151:         /// <summary>
  152:         ///
  153:         /// </summary>
  154:         public static Ia.Ftn.Cl.Models.Business.Huawei.Dev.Type DevTypeFromDn(string dn)
  155:         {
  156:             Ia.Ftn.Cl.Models.Business.Huawei.Dev.Type emsDevType;
  157:  
  158:             // this is inaccurate because sometimes staff will assign impuAid numbers to MDUs. 
  159:             if (Ia.Ftn.Cl.Models.Business.NumberFormatConverter.IsMatchToServiceWithCountryCode(dn)) emsDevType = Ia.Ftn.Cl.Models.Business.Huawei.Dev.Type.Mdu;
  160:             else if (Ia.Ftn.Cl.Models.Business.NumberFormatConverter.IsMatchToImpuAid(dn)) emsDevType = Ia.Ftn.Cl.Models.Business.Huawei.Dev.Type.Msan;
  161:             else emsDevType = Ia.Ftn.Cl.Models.Business.Huawei.Dev.Type.Unknown;
  162:  
  163:             return emsDevType;
  164:         }
  165:  
  166:         ////////////////////////////////////////////////////////////////////////////
  167:         ////////////////////////////////////////////////////////////////////////////
  168:     }
  169:  
  170:     ////////////////////////////////////////////////////////////////////////////
  171:     ////////////////////////////////////////////////////////////////////////////
  172: }