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

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

AGCF Gateway Records support class for Nokia's Fixed Telecommunications Network (FTN) business model.

    1: using System;
    2: using System.Collections.Generic;
    3: using System.Linq;
    4:  
    5: namespace Ia.Ftn.Cl.Models.Business.Nokia
    6: {
    7:     ////////////////////////////////////////////////////////////////////////////
    8:  
    9:     /// <summary publish="true">
   10:     /// AGCF Gateway Records support class for Nokia's Fixed Telecommunications Network (FTN) business model.
   11:     /// </summary>
   12:     /// 
   13:     /// <remarks> 
   14:     /// Copyright � 2014-2017 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 AgcfGatewayRecord
   27:     {
   28:         public AgcfGatewayRecord() { }
   29:  
   30:         ////////////////////////////////////////////////////////////////////////////
   31:  
   32:         /// <summary>
   33:         ///
   34:         /// </summary>
   35:         public static void CreateRandomGatewayIdForAccessName(Ia.Ftn.Cl.Models.Client.Nokia.Ims nokiaIms, string accessName, out Ia.Cl.Models.Result result)
   36:         {
   37:             result = new Ia.Cl.Models.Result();
   38:  
   39:             if (!string.IsNullOrEmpty(accessName))
   40:             {
   41:                 //var nddOnt = Ia.Ftn.Cl.Model.Data.NetworkDesignDocument.OntAccessNameToOntDictionary.ContainsKey(accessName) ? Ia.Ftn.Cl.Model.Data.NetworkDesignDocument.OntAccessNameToOntDictionary[accessName] : null;
   42:                 var nddOnt = Ia.Ftn.Cl.Models.Data.NetworkDesignDocument.OntByAccessName(accessName);
   43:  
   44:                 if (nddOnt != null)
   45:                 {
   46:                     var gwId = Ia.Ftn.Cl.Models.Business.Nokia.AgcfGatewayRecord.RandomUnusedGwId();
   47:  
   48:                     Ia.Ftn.Cl.Models.Data.Nokia.Ims.CreateAgcfGatewayRecordForGwId(nokiaIms, gwId, nddOnt, out string createResult);
   49:  
   50:                     Ia.Ftn.Cl.Models.Data.Nokia.Ims.ReadUpdateAgcfGatewayRecordAndAgcfEndpointListAndSubPartyAndSubscriberAndServiceForGwId(nokiaIms, gwId, out string readResult);
   51:  
   52:                     result.AddSuccess("Access name: " + nddOnt.Access.Name + ", gwId: " + gwId + ", createResult: " + createResult + ", readResult: " + readResult);
   53:                 }
   54:                 else
   55:                 {
   56:                     result.AddError("NDD ONT is null, does not exist for access: " + accessName);
   57:                 }
   58:             }
   59:             else
   60:             {
   61:                 result.AddError("AccessName is null or empty");
   62:             }
   63:         }
   64:  
   65:         ////////////////////////////////////////////////////////////////////////////
   66:  
   67:         /// <summary>
   68:         ///
   69:         /// </summary>
   70:         public static void ReadGatewayId(Ia.Ftn.Cl.Models.Client.Nokia.Ims nokiaIms, string gatewayId, out string result)
   71:         {
   72:             int gwId;
   73:  
   74:             if (!string.IsNullOrEmpty(gatewayId))
   75:             {
   76:                 gatewayId = gatewayId.Trim();
   77:  
   78:                 if (int.TryParse(gatewayId, out int i))
   79:                 {
   80:                     gwId = i;
   81:  
   82:                     Ia.Ftn.Cl.Models.Data.Nokia.Ims.ReadUpdateAgcfGatewayRecordAndAgcfEndpointListAndSubPartyAndSubscriberAndServiceForGwId(nokiaIms/*, null*/, gwId, out result);
   83:                 }
   84:                 else
   85:                 {
   86:                     result = "error: input text is not in int format. ";
   87:                 }
   88:             }
   89:             else
   90:             {
   91:                 result = "error: input text is null or empty. ";
   92:             }
   93:         }
   94:  
   95:         ////////////////////////////////////////////////////////////////////////////
   96:  
   97:         /// <summary>
   98:         ///
   99:         /// </summary>
  100:         public static void DeleteGatewayId(Ia.Ftn.Cl.Models.Client.Nokia.Ims nokiaIms, string gatewayId, out string result)
  101:         {
  102:             int gwId;
  103:             Ia.Ftn.Cl.Models.Nokia.AgcfGatewayRecord agcfGatewayRecord;
  104:  
  105:             if (!string.IsNullOrEmpty(gatewayId))
  106:             {
  107:                 gatewayId = gatewayId.Trim();
  108:  
  109:                 if (int.TryParse(gatewayId, out int i))
  110:                 {
  111:                     gwId = i;
  112:  
  113:                     agcfGatewayRecord = Ia.Ftn.Cl.Models.Data.Nokia.AgcfGatewayRecord.ReadByGwId(gwId);
  114:  
  115:                     if (agcfGatewayRecord != null)
  116:                     {
  117:                         Ia.Ftn.Cl.Models.Data.Nokia.Ims.DeleteAgcfGatewayRecordForGwId(nokiaIms, agcfGatewayRecord, out string deleteResult);
  118:  
  119:                         Ia.Ftn.Cl.Models.Data.Nokia.Ims.ReadUpdateAgcfGatewayRecordAndAgcfEndpointListAndSubPartyAndSubscriberAndServiceForGwId(nokiaIms/*, null*/, agcfGatewayRecord.GwId, out string readResult);
  120:  
  121:                         result = "gwId: " + agcfGatewayRecord.GwId + ", deleteResult: " + deleteResult + ", readResult: " + readResult;
  122:                     }
  123:                     else result = "gwId: " + gwId + ", agcfGatewayRecord is null. ";
  124:                 }
  125:                 else result = "error: input text is not in int format. ";
  126:             }
  127:             else result = "error: input text is null or empty. ";
  128:         }
  129:  
  130:         ////////////////////////////////////////////////////////////////////////////
  131:  
  132:         /// <summary>
  133:         ///
  134:         /// </summary>
  135:         public static int RandomUnusedGwId()
  136:         {
  137:             int randomGwId;
  138:             Random r;
  139:             List<int> unusedGwIdList;
  140:  
  141:             r = new Random();
  142:             unusedGwIdList = Ia.Ftn.Cl.Models.Data.Nokia.AgcfGatewayRecord.ReadUnusedGwIdList();
  143:  
  144:             randomGwId = unusedGwIdList[r.Next(unusedGwIdList.Count)];
  145:  
  146:             return randomGwId;
  147:         }
  148:  
  149:         ////////////////////////////////////////////////////////////////////////////
  150:  
  151:         /// <summary>
  152:         ///
  153:         /// </summary>
  154:         public static Ia.Ftn.Cl.Models.Nokia.AgcfGatewayRecord ParseFromDictionary(Dictionary<string, string> parameterDictionary)
  155:         {
  156:             int i, gwId, tableId;
  157:             long l;
  158:             Ia.Ftn.Cl.Models.Nokia.AgcfGatewayRecord agcfGatewayRecord;
  159:  
  160:             agcfGatewayRecord = new Ia.Ftn.Cl.Models.Nokia.AgcfGatewayRecord();
  161:  
  162:             gwId = int.Parse(parameterDictionary["GwId"].ToString());
  163:             tableId = int.Parse(parameterDictionary["TableId"].ToString());
  164:  
  165:             agcfGatewayRecord.Id = Ia.Ftn.Cl.Models.Nokia.AgcfGatewayRecord.AgcfGatewayRecordId(tableId, gwId);
  166:  
  167:             agcfGatewayRecord.NgcfAgcfGatewayRecordAid = parameterDictionary["NgcfAgcfGatewayRecordAid"].ToString();
  168:             agcfGatewayRecord.GwId = gwId;
  169:             agcfGatewayRecord.TableId = tableId;
  170:  
  171:             agcfGatewayRecord.AgcfSipIaPort = parameterDictionary["AgcfSipIaPort"].ToString();
  172:             agcfGatewayRecord.ConnectionType = (parameterDictionary["ConnectionType"].ToString() == "UDP/IP") ? true : false;
  173:             agcfGatewayRecord.ContextAudits = (parameterDictionary["ContextAudits"].ToString() == "None") ? true : false;
  174:             agcfGatewayRecord.GwDigitMapId = int.TryParse(parameterDictionary["GwDigitMapId"].ToString(), out i) ? i : 0;
  175:             agcfGatewayRecord.EnableChannelStatusAudits = Convert.ToBoolean(parameterDictionary["EnableChannelStatusAudits"].ToString());
  176:             agcfGatewayRecord.GwUserId = parameterDictionary["GwUserId"].ToString();
  177:             agcfGatewayRecord.GwDomain = parameterDictionary["GwDomain"].ToString();
  178:             agcfGatewayRecord.GwName = parameterDictionary["GwName"].ToString();
  179:             agcfGatewayRecord.GwPrivId = parameterDictionary["GwPrivId"].ToString();
  180:             agcfGatewayRecord.IP1 = parameterDictionary["IP1"].ToString();
  181:             agcfGatewayRecord.IP2 = parameterDictionary["IP2"].ToString();
  182:             agcfGatewayRecord.LocalTermTypePrefix = parameterDictionary["LocalTermTypePrefix"].ToString();
  183:             agcfGatewayRecord.LocalTermTypeAnalogPrefix = parameterDictionary["LocalTermTypeAnalogPrefix"].ToString();
  184:             agcfGatewayRecord.IsLocalTermTypeTDMAnalog = Convert.ToBoolean(parameterDictionary["IsLocalTermTypeTDMAnalog"].ToString());
  185:             agcfGatewayRecord.NetTermTypePrefix = parameterDictionary["NetTermTypePrefix"].ToString();
  186:             agcfGatewayRecord.IsNetTermTypeRTPUDP = Convert.ToBoolean(parameterDictionary["IsNetTermTypeRTPUDP"].ToString());
  187:             agcfGatewayRecord.PhysicalTermIdScheme = parameterDictionary["PhysicalTermIdScheme"].ToString();
  188:             agcfGatewayRecord.SendCompactMessages = Convert.ToBoolean(parameterDictionary["SendCompactMessages"].ToString());
  189:             agcfGatewayRecord.SendEphemeralPrefix = Convert.ToBoolean(parameterDictionary["SendEphemeralPrefix"].ToString());
  190:             agcfGatewayRecord.UdpPort = int.TryParse(parameterDictionary["UdpPort"].ToString(), out i) ? i : 0;
  191:             agcfGatewayRecord.GwVariantId = int.TryParse(parameterDictionary["GwVariantId"].ToString(), out i) ? i : 0;
  192:             agcfGatewayRecord.AreaId = int.TryParse(parameterDictionary["AreaId"].ToString(), out i) ? i : 0;
  193:             agcfGatewayRecord.ComfortNoise = Convert.ToBoolean(parameterDictionary["ComfortNoise"].ToString());
  194:             agcfGatewayRecord.Dtmf = Convert.ToBoolean(parameterDictionary["Dtmf"].ToString());
  195:             agcfGatewayRecord.FaxEvents = Convert.ToBoolean(parameterDictionary["FaxEvents"].ToString());
  196:             agcfGatewayRecord.ModemEvents = Convert.ToBoolean(parameterDictionary["ModemEvents"].ToString());
  197:             agcfGatewayRecord.TextTelephonyEvents = Convert.ToBoolean(parameterDictionary["TextTelephonyEvents"].ToString());
  198:             agcfGatewayRecord.AllCodecDataStr = parameterDictionary["AllCodecDataStr"].ToString();
  199:             agcfGatewayRecord.AgwIuaIpAddress = parameterDictionary["AgwIuaIpAddress"].ToString();
  200:             agcfGatewayRecord.AgwIuaSctpPort = int.TryParse(parameterDictionary["AgwIuaSctpPort"].ToString(), out i) ? i : 0;
  201:             agcfGatewayRecord.AgcfLocalSctpPort = int.TryParse(parameterDictionary["AgcfLocalSctpPort"].ToString(), out i) ? i : 0;
  202:             agcfGatewayRecord.SctpProfile = int.TryParse(parameterDictionary["SctpProfile"].ToString(), out i) ? i : 0;
  203:             agcfGatewayRecord.IuaIIDMapScheme = parameterDictionary["IuaIIDMapScheme"].ToString();
  204:             agcfGatewayRecord.LocalTermTypeIsdnPrefix = parameterDictionary["LocalTermTypeIsdnPrefix"].ToString();
  205:             agcfGatewayRecord.AuditAllActiveIsdnCalls = Convert.ToBoolean(parameterDictionary["AuditAllActiveIsdnCalls"].ToString());
  206:             agcfGatewayRecord.MateSite = int.TryParse(parameterDictionary["MateSite"].ToString(), out i) ? i : 0;
  207:  
  208:             agcfGatewayRecord.IsPrimary = Convert.ToBoolean(parameterDictionary["IsPrimary"].ToString());
  209:             agcfGatewayRecord.MateExternalIPAddr = parameterDictionary["MateExternalIPAddr"].ToString();
  210:  
  211:             agcfGatewayRecord.MateExternalIPAddr = Ia.Ftn.Cl.Models.Business.Nokia.Ims.AssigneCorrectMateExternalIPAddrForIsPrimary(agcfGatewayRecord.IsPrimary, agcfGatewayRecord.MateExternalIPAddr);
  212:  
  213:  
  214:             agcfGatewayRecord.AddtionalDigitMapList = parameterDictionary["AddtionalDigitMapList"].ToString();
  215:             agcfGatewayRecord.AuthTimer = int.TryParse(parameterDictionary["AuthTimer"].ToString(), out i) ? i : 0;
  216:             agcfGatewayRecord.SharedBasNumber = long.TryParse(parameterDictionary["SharedBasNumber"].ToString(), out l) ? l : 0;
  217:             agcfGatewayRecord.SharedPriNumber = int.TryParse(parameterDictionary["SharedPriNumber"].ToString(), out i) ? i : 0;
  218:             agcfGatewayRecord.MgID = parameterDictionary["MgID"].ToString();
  219:             agcfGatewayRecord.EnnableMD5DigAuteh = Convert.ToBoolean(parameterDictionary["EnnableMD5DigAuteh"].ToString());
  220:             agcfGatewayRecord.ChannelAudits = int.TryParse(parameterDictionary["ChannelAudits"].ToString(), out i) ? i : 0;
  221:             agcfGatewayRecord.GroupId = int.TryParse(parameterDictionary["GroupId"].ToString(), out i) ? i : 0;
  222:             agcfGatewayRecord.AgcfGateWayType = int.TryParse(parameterDictionary["AgcfGateWayType"].ToString(), out i) ? i : 0;
  223:  
  224:             agcfGatewayRecord.Created = DateTime.UtcNow.AddHours(3);
  225:             agcfGatewayRecord.Updated = DateTime.UtcNow.AddHours(3);
  226:  
  227:             return agcfGatewayRecord;
  228:         }
  229:  
  230:         ////////////////////////////////////////////////////////////////////////////
  231:         ////////////////////////////////////////////////////////////////////////////
  232:     }
  233:  
  234:     ////////////////////////////////////////////////////////////////////////////
  235:     ////////////////////////////////////////////////////////////////////////////
  236: }