//设置站点信息 public static void SetNodeInfo(DB_Talk.Model.m_Box model) { MBoxSDK.ConfigSDK.tagNode node = new MBoxSDK.ConfigSDK().newTagNode(); byte[] byteIP = System.Text.ASCIIEncoding.ASCII.GetBytes(model.vc_IP); //"192.168.1.208"); byteIP.CopyTo(node.trafficInterfaceIp, 0); byte[] byteIPMask = System.Text.ASCIIEncoding.ASCII.GetBytes(model.vc_Mask); //"255.255.255.0"); byteIPMask.CopyTo(node.trafficInterfaceMask, 0); //byte[] byteDspIP = System.Text.ASCIIEncoding.ASCII.GetBytes("10.20.31.171"); //必须和业务口在一个网段,但是不在此处设置 //byteIP.CopyTo(node.dspSrcIP, 0); byte[] netManegeInterfaceIP = System.Text.ASCIIEncoding.ASCII.GetBytes(model.vc_NetIP);// ("11.20.30.1"); //必须和业务口不在一个网段 netManegeInterfaceIP.CopyTo(node.netManegeInterfaceIP, 0); byte[] byteNetIPMask = System.Text.ASCIIEncoding.ASCII.GetBytes("255.255.255.0"); byteNetIPMask.CopyTo(node.netManegeInterfaceMask, 0); MBoxSDK.ConfigSDK.MBOX_SetNodeInfo(Global.Params.BoxHandle, node); }
private bool ModifyDetail(DB_Talk.Model.m_Member model) { if (model.i_Number == null || model.i_Number.Value == 0) return false; bool modify = false; MBoxSDK.ConfigSDK.subscriberServiceDetail subService = new MBoxSDK.ConfigSDK().newSubscriberServiceDetail();//new MBoxSDK.ConfigSDK.subscriberServiceDetail(); bool b = MBoxSDK.ConfigSDK.MBOX_QuerySubscriber(Global.Params.BoxHandle, model.i_Number.Value, ref subService); if (b) { uint PreSupplementSerive = subService.supplementSerive; bool isModify = false; subService.supplementSerive = model.i_supplementSerive.Value; if (PreSupplementSerive != subService.supplementSerive | isModify) //不同才修改 modify = MBoxSDK.ConfigSDK.MBOX_ModifySubscriber(Global.Params.BoxHandle, model.i_Number.Value, ref subService); else modify = true; } return modify; }
public bool AddBase(DB_Talk.Model.m_Member model) { MBoxSDK.ConfigSDK.subscriberServiceBase subscriberBase = new MBoxSDK.ConfigSDK().newSubscriberServiceBase(); //new MBoxSDK.ConfigSDK.subscriberServiceBase(); byte[] bytenumber = System.Text.ASCIIEncoding.ASCII.GetBytes(model.i_Number.ToString()); subscriberBase.subType = model.NumberTypeID.Value; subscriberBase.userPriority = model.i_Authority.Value; bytenumber.CopyTo(subscriberBase.userNumber, 0); bytenumber.CopyTo(subscriberBase.authKey, 0); bytenumber.CopyTo(subscriberBase.sipPassword, 0); //调度员可选的增值服务只有调度业务、话务员代理、自动录音,并且在修改时才可以设置,创建时不可以设置 subscriberBase.supplementSerive = (int)(MBoxSDK.ConfigSDK.SPM_MISS_CALL | MBoxSDK.ConfigSDK.SPM_MISS_CALL_ON_BUSY | MBoxSDK.ConfigSDK.SPM_SMS); bool create = MBoxSDK.ConfigSDK.MBOX_CreateSubscriber(Global.Params.BoxHandle, ref subscriberBase); return create; }
private bool ModifyDetailAssociateNum(long telNumber) { if (telNumber == 0) return false; bool modify = false; MBoxSDK.ConfigSDK.subscriberServiceDetail subService = new MBoxSDK.ConfigSDK().newSubscriberServiceDetail();//new MBoxSDK.ConfigSDK.subscriberServiceDetail(); bool b = MBoxSDK.ConfigSDK.MBOX_QuerySubscriber(Global.Params.BoxHandle, telNumber, ref subService); if (b) { //去关联,只需要去掉增值服务 关联号码会自动消失 subService.supplementSerive &= (uint)(~MBoxSDK.ConfigSDK.SPM_ASSO_NUM); _mModel.i_supplementSerive = subService.supplementSerive; modify = MBoxSDK.ConfigSDK.MBOX_ModifySubscriber(Global.Params.BoxHandle, telNumber, ref subService); } return modify; }
private bool ModifyDetail(long telNumber) { if (telNumber == 0) return false; //新增及修改时时设置权限 if (_mPreModel.i_Authority != _mModel.i_Authority) { if (!MBoxSDK.ConfigSDK.MBOX_SetSubscriberPriority(Global.Params.BoxHandle, telNumber, _mModel.i_Authority.Value)) { CommControl.Tools.WriteLog.AppendErrorLog("修改号码【" + telNumber + "】用户权限失败"); return false; } } //if(groupBoxG.Visible == false) return true; //无需修改 bool modify = false; MBoxSDK.ConfigSDK.subscriberServiceDetail subService = new MBoxSDK.ConfigSDK().newSubscriberServiceDetail();//new MBoxSDK.ConfigSDK.subscriberServiceDetail(); bool b = MBoxSDK.ConfigSDK.MBOX_QuerySubscriber(Global.Params.BoxHandle, telNumber, ref subService); if (b) { uint PreSupplementSerive = subService.supplementSerive; bool isModify = false; #region 修改 if (_operate != 0) //修改 { if (_mModel.i_TellType != PublicEnums.EnumTelType.G3G手机.GetHashCode() && _mModel.i_NuPassword > 0 && System.Text.ASCIIEncoding.ASCII.GetString(subService.sIPSubPassword).Replace("\0", "") != _mModel.i_NuPassword.ToString()) { subService.sIPSubPassword = new byte[MBoxSDK.ConfigSDK.MAX_SIPPWD_LEN + 1]; byte[] bytenumber = System.Text.ASCIIEncoding.ASCII.GetBytes(_mModel.i_Number.ToString()); if (_mModel.i_NuPassword == null) //不设置密码时,默认和号码相同 { bytenumber.CopyTo(subService.sIPSubPassword, 0); } else { byte[] bytepsw = System.Text.ASCIIEncoding.ASCII.GetBytes(_mModel.i_NuPassword.ToString()); bytepsw.CopyTo(subService.sIPSubPassword, 0); } isModify = true; } //if (subService.subType != _mModel.NumberTypeID.Value) //用户类型不能修改 只能删除再增加 //{ // subService.subType = _mModel.NumberTypeID.Value; // isModify = true; //} //if (subService.subPriority != _mModel.i_Authority.Value) //单独接口设置 //{ // subService.subPriority = _mModel.i_Authority.Value; // isModify = true; //} //if (subService. != _mModel.vc_UmtsImsi) //不可以修改 //{ // subService. = _mModel.vc_UmtsImsi; // isModify = true; //} //3G用户标示码 } #endregion if (groupBoxG.Visible == true)// return true; //无需修改 { if (chkUnCForward.Checked && txtUnCForward.Text.Trim() != "") { if (txtUnCForward.Text.Trim() != System.Text.ASCIIEncoding.ASCII.GetString(subService.cfuNumber).Replace("\0", "")) isModify = true; ; byte[] bytenumber = System.Text.ASCIIEncoding.ASCII.GetBytes(txtUnCForward.Text.Trim()); subService.cfuNumber = new byte[MBoxSDK.ConfigSDK.MAX_PHONENUMER_LEN + 1]; bytenumber.CopyTo(subService.cfuNumber, 0); //无条件转接 subService.supplementSerive |= (int)(MBoxSDK.ConfigSDK.SPM_CFW_UNCON); } else subService.supplementSerive &= (uint)(~MBoxSDK.ConfigSDK.SPM_CFW_UNCON); if (chkNoAnswerForward.Checked && txtNoAnswerForward.Text.Trim() != "") { if (txtNoAnswerForward.Text.Trim() != System.Text.ASCIIEncoding.ASCII.GetString(subService.cfnrNumber).Replace("\0", "")) isModify = true; ; byte[] bytenumber = System.Text.ASCIIEncoding.ASCII.GetBytes(txtNoAnswerForward.Text.Trim()); subService.cfnrNumber = new byte[MBoxSDK.ConfigSDK.MAX_PHONENUMER_LEN + 1]; bytenumber.CopyTo(subService.cfnrNumber, 0); //无应答转接 subService.supplementSerive |= (int)(MBoxSDK.ConfigSDK.SPM_CFW_NO_REPLY); } else subService.supplementSerive &= (uint)(~MBoxSDK.ConfigSDK.SPM_CFW_NO_REPLY); if (chkBusyForward.Checked && txtBusyForward.Text.Trim() != "") { if (txtBusyForward.Text.Trim() != System.Text.ASCIIEncoding.ASCII.GetString(subService.cfbNumber).Replace("\0", "")) isModify = true; ; byte[] bytenumber = System.Text.ASCIIEncoding.ASCII.GetBytes(txtBusyForward.Text.Trim()); subService.cfbNumber = new byte[MBoxSDK.ConfigSDK.MAX_PHONENUMER_LEN + 1]; bytenumber.CopyTo(subService.cfbNumber, 0); //遇忙转接 subService.supplementSerive |= (int)(MBoxSDK.ConfigSDK.SPM_CFW_BUSY); } else subService.supplementSerive &= (uint)(~MBoxSDK.ConfigSDK.SPM_CFW_BUSY); if (chkPowerOffForward.Checked && txtPowerOffForward.Text.Trim() != "") { if (txtPowerOffForward.Text.Trim() != System.Text.ASCIIEncoding.ASCII.GetString(subService.subCfpfNumber).Replace("\0", "")) isModify = true; ; byte[] bytenumber = System.Text.ASCIIEncoding.ASCII.GetBytes(txtPowerOffForward.Text.Trim()); subService.subCfpfNumber = new byte[MBoxSDK.ConfigSDK.MAX_PHONENUMER_LEN + 1]; bytenumber.CopyTo(subService.subCfpfNumber, 0); //关机转接 subService.supplementSerive |= (int)(MBoxSDK.ConfigSDK.SPM_CF_POWEROFF); } else subService.supplementSerive &= (uint)(~MBoxSDK.ConfigSDK.SPM_CF_POWEROFF); if (chkDirectNum.Checked && txtDirectNum.Text.Trim() != "") { if (txtDirectNum.Text.Trim() != System.Text.ASCIIEncoding.ASCII.GetString(subService.DIDNumber).Replace("\0", "")) isModify = true; ; byte[] bytenumber = System.Text.ASCIIEncoding.ASCII.GetBytes(txtDirectNum.Text.Trim()); subService.DIDNumber = new byte[MBoxSDK.ConfigSDK.MAX_PHONENUMER_LEN + 1]; bytenumber.CopyTo(subService.DIDNumber, 0); //直通号码 subService.supplementSerive |= (int)(MBoxSDK.ConfigSDK.SPM_DDI); } else subService.supplementSerive &= (uint)(~MBoxSDK.ConfigSDK.SPM_DDI); if (chkAssociateNum1.Checked || chkAssociateNum2.Checked) { subService.supplementSerive |= (int)(MBoxSDK.ConfigSDK.SPM_ASSO_NUM); } else //去关联 { subService.supplementSerive &= (uint)(~MBoxSDK.ConfigSDK.SPM_ASSO_NUM); if (_mPreModel.i_IsAssociateActive == 2) //被动关联 { RemoveAssociateNum(_mModel); } } if (chkAssociateNum1.Checked && txtAssociateNum1.Text.Trim() != "") { if (txtAssociateNum1.Text.Trim() != System.Text.ASCIIEncoding.ASCII.GetString(subService.associationNum1).Replace("\0", "")) isModify = true; byte[] bytenumber = System.Text.ASCIIEncoding.ASCII.GetBytes(txtAssociateNum1.Text.Trim()); subService.associationNum1 = new byte[MBoxSDK.ConfigSDK.MAX_PHONENUMER_LEN + 1]; bytenumber.CopyTo(subService.associationNum1, 0); } if (chkAssociateNum2.Checked && txtAssociateNum2.Text.Trim() != "") { if (txtAssociateNum2.Text.Trim() != System.Text.ASCIIEncoding.ASCII.GetString(subService.associationNum2).Replace("\0", "")) isModify = true; ; byte[] bytenumber = System.Text.ASCIIEncoding.ASCII.GetBytes(txtAssociateNum2.Text.Trim()); subService.associationNum2 = new byte[MBoxSDK.ConfigSDK.MAX_PHONENUMER_LEN + 1]; bytenumber.CopyTo(subService.associationNum2, 0); } if (chkRecord.Checked) { subService.supplementSerive |= (uint)(MBoxSDK.ConfigSDK.SPM_AUTO_RECORDING); } else subService.supplementSerive &= (uint)(~MBoxSDK.ConfigSDK.SPM_AUTO_RECORDING); } _mModel.i_supplementSerive = subService.supplementSerive; //subService.supplementSerive |= (int)(MBoxSDK.ConfigSDK.SPM_CFW_UNCON | // MBoxSDK.ConfigSDK.SPM_CFW_NO_REPLY | // MBoxSDK.ConfigSDK.SPM_CFW_BUSY | // MBoxSDK.ConfigSDK.SPM_CF_POWEROFF | // MBoxSDK.ConfigSDK.SPM_DDI | // MBoxSDK.ConfigSDK.SPM_ASSO_NUM); if (PreSupplementSerive != subService.supplementSerive | isModify) //不同才修改 modify = MBoxSDK.ConfigSDK.MBOX_ModifySubscriber(Global.Params.BoxHandle, telNumber, ref subService); else modify = true; } return modify; }
public bool AddBase(DB_Talk.Model.m_Member model) { MBoxSDK.ConfigSDK.subscriberServiceBase subscriberBase = new MBoxSDK.ConfigSDK().newSubscriberServiceBase(); //new MBoxSDK.ConfigSDK.subscriberServiceBase(); byte[] bytenumber = System.Text.ASCIIEncoding.ASCII.GetBytes(model.i_Number.ToString()); subscriberBase.subType = model.NumberTypeID.Value; if (model.i_Authority != null) { subscriberBase.userPriority = model.i_Authority.Value; } //byte[] bytenumber=BitConverter.GetBytes(_mModel.i_Number.ToString()); bytenumber.CopyTo(subscriberBase.userNumber, 0); bytenumber.CopyTo(subscriberBase.authKey, 0); if (subscriberBase.subType == PublicEnums.EnumNumberType.固话.GetHashCode()) { if (model.i_NuPassword == null) //不设置密码时,默认和号码相同 { bytenumber.CopyTo(subscriberBase.sipPassword, 0); } else { byte[] bytepsw = System.Text.ASCIIEncoding.ASCII.GetBytes(model.i_NuPassword.ToString()); // byte[] bytepsw = System.Text.ASCIIEncoding.ASCII.GetBytes(_mModel.i_NuPassword.ToString()); bytepsw.CopyTo(subscriberBase.sipPassword, 0); } } if (model.NumberTypeID.Value == PublicEnums.EnumNumberType.手机3G.GetHashCode() && model.vc_UmtsImsi!=null && model.vc_UmtsImsi != "") { byte[] byte3G = System.Text.ASCIIEncoding.ASCII.GetBytes(model.vc_UmtsImsi); byte3G.CopyTo(subscriberBase.p3gUmtsImsi, 0); byte[] byteUmtsKi = System.Text.ASCIIEncoding.ASCII.GetBytes("112233445566778899aabbccddeeff00"); byteUmtsKi.CopyTo(subscriberBase.authKey, 0); } //subscriberBase.supplementSerive=0; //丢话服务,遇忙通知,短消息服务,三方通话,呼叫等待,呼叫转移,呼叫代答 //subscriberBase.supplementSerive = (int)(MBoxSDK.ConfigSDK.SPM_MISS_CALL | MBoxSDK.ConfigSDK.SPM_MISS_CALL_ON_BUSY | MBoxSDK.ConfigSDK.SPM_SMS); //2013-10-18确定取消默认的呼叫代答功能,因为与关联号码冲突 //2014-2-18确定取消默认的呼叫等待功能 subscriberBase.supplementSerive = (int)(MBoxSDK.ConfigSDK.SPM_MISS_CALL | MBoxSDK.ConfigSDK.SPM_MISS_CALL_ON_BUSY | MBoxSDK.ConfigSDK.SPM_SMS | MBoxSDK.ConfigSDK.SPM_THREE_PARTY | //MBoxSDK.ConfigSDK.SPM_CALL_WAITING | MBoxSDK.ConfigSDK.SPM_CALL_TRANSFER); // MBoxSDK.ConfigSDK.SPM_CALL_PICKUP); bool create = MBoxSDK.ConfigSDK.MBOX_CreateSubscriber(Global.Params.BoxHandle, ref subscriberBase); return create; }