Ejemplo n.º 1
0
        public void Start()
        {
            if (!_started)
            {
                _localIP = IPAddressHelper.GetLocalIp();
                Gateway gw = InfoService.Instance.CurrentGateway; //当前网关配置。
                _localAOR = $"{gw.SipNumber}@{_localIP}";

                //m_stack = new SIP_Stack();
                //m_stack.Realm = "seecool"; //本地域,当需要验证远程注册用户的时候,发送此域。
                //m_stack.UserAgent = "NetGateway www.seecool.cc";//必须设置。
                //m_stack.Error += M_stack_Error;
                //m_stack.RequestReceived += M_stack_RequestReceived;
                //m_stack.ResponseReceived += M_stack_ResponseReceived;
                //m_stack.Logger.WriteLog += Logger_WriteLog;

                //用户注册授权凭证,向远程服务器注册本机时需要。
                //m_stack.Credentials.Add(new NetworkCredential("admin", "admin", "seecool"));

                //添加本地端口绑定
                IPBindInfo[] bindInfo = new IPBindInfo[] {
                    new IPBindInfo(_localIP, BindInfoProtocol.UDP, IPAddress.Parse(_localIP), gw.Port),
                    new IPBindInfo(_localIP, BindInfoProtocol.TCP, IPAddress.Parse(_localIP), gw.Port)
                };

                Stack.BindInfo = bindInfo;
                Stack.Start();
                addVirtualServer();
                _deviceMgr.Start();
                _started = true;
            }
        }
Ejemplo n.º 2
0
        internal VirtualDevice(CCTVStaticInfo real, Gateway gw, string sipNum, SIP_Registrar _reg)
        {
            _realInfo  = real;
            _sipNum    = sipNum;
            _gateway   = gw;
            _registrar = _reg;
            string localIP = IPAddressHelper.GetLocalIp();

            _localAOR = $"{sipNum}@{localIP}";
        }
Ejemplo n.º 3
0
 public ActionResult SubmitMessageBoardInfo(FormCollection form)
 {
     if (!ModelState.IsValid)
     {
         return(Json(new { Success = true, ErrorMessage = "提交内容有误,留言失败,请稍后重试!" }, JsonRequestBehavior.DenyGet));
     }
     try
     {
         var host           = HttpContext.Request.Url.Host.ToString() ?? string.Empty;
         var requestUrl     = HttpContext.Request.Url.ToString() ?? string.Empty;
         var urlReferrer    = HttpContext.Request.UrlReferrer.ToString();
         var userName       = HttpUtility.UrlDecode(form["nickname"].ToString() ?? string.Empty);
         var phone          = HttpUtility.UrlDecode(form["cellphone"].ToString() ?? string.Empty);
         var sourceurl      = HttpUtility.UrlDecode(form["sourceurl"].ToString() ?? string.Empty);//
         var isVerCode      = HttpUtility.UrlDecode(form["isVerCode"].ToString() ?? string.Empty);
         var messageContent = HttpUtility.UrlDecode(form["messageInfo"].ToString() ?? string.Empty);
         if (isVerCode == "1")
         {
             var verCode       = HttpUtility.UrlDecode(form["vercode"].ToString() ?? string.Empty);
             var IsCheckedPass = null != Session["VerCode"] && Session["VerCode"].ToString() == verCode;
             if (!IsCheckedPass)
             {
                 return(Json(new { Success = false, ErrorMessage = "验证码有误,请重新填写!" }, JsonRequestBehavior.DenyGet));
             }
         }
         if (string.IsNullOrEmpty(userName))
         {
             return(Json(new { Success = false, ErrorMessage = "姓名不能为空!" }, JsonRequestBehavior.DenyGet));
         }
         if (string.IsNullOrEmpty(phone) || !IsCheckPhone(phone))
         {
             return(Json(new { Success = false, ErrorMessage = "手机号码有误,请重新填写!" }, JsonRequestBehavior.DenyGet));
         }
         var entity = new MessageBoard
         {
             UserName       = HttpUtility.UrlDecode(userName.Trim()),
             Phone          = HttpUtility.UrlDecode(phone.Trim()),
             MessageContent = HttpUtility.UrlDecode(messageContent.Trim()),
             ClientIp       = IPAddressHelper.GetClientIp(),
             LocalIp        = IPAddressHelper.GetLocalIp(),
             RequestUrl     = string.IsNullOrEmpty(sourceurl)? requestUrl: sourceurl,
             UrlReferrer    = urlReferrer,
             Host           = host,
             CreateTime     = DateTime.Now
         };
         var messageBoard = new MessageBoardBLL();
         messageBoard.Add(entity);
         return(Json(new { Success = true, }, JsonRequestBehavior.DenyGet));
     }
     catch (Exception ex)
     {
         Log.Error("留言板留言出现未处理异常", ex.ToString());
         return(Json(new { Success = false, ErrorMessage = "留言失败,请稍后重试!" }, JsonRequestBehavior.DenyGet));
     }
 }
Ejemplo n.º 4
0
        internal RTPServer(int localPort, string videoId)
        {
            _rtpHelper     = new RTPPackHelper();
            _hTrigger      = new RTPHeaderTrigger();
            _ups           = new UnpackPS();
            _ups.Unpacked += _ups_Unpacked;

            _localIP   = IPAddressHelper.GetLocalIp();
            _localPort = localPort;
            _videoId   = videoId;
            _targets   = new Dictionary <string, TargetItem>();
        }
Ejemplo n.º 5
0
 public ActionResult AddMessageBoard(FormCollection form)
 {
     if (!ModelState.IsValid)
     {
         return(Json(new { Success = true, ErrorMessage = "留言失败,请稍后重试!" }, JsonRequestBehavior.DenyGet));
     }
     try
     {
         var host           = HttpUtility.UrlDecode(HttpContext.Request.Url.Host.ToString() ?? string.Empty);
         var requestUrl     = HttpUtility.UrlDecode(HttpContext.Request.Url.ToString() ?? string.Empty);
         var urlReferrer    = HttpUtility.UrlDecode(HttpContext.Request.UrlReferrer.ToString());
         var userName       = HttpUtility.UrlDecode(form["UserName"].ToString() ?? string.Empty);
         var phone          = HttpUtility.UrlDecode(form["Phone"].ToString() ?? string.Empty);
         var messageContent = HttpUtility.UrlDecode(form["Comment"].ToString() ?? string.Empty);
         var IsPhone        = System.Text.RegularExpressions.Regex.IsMatch(phone, @"^[1]+\d{10}");
         if (string.IsNullOrEmpty(userName))
         {
             return(Json(new { Success = false, ErrorMessage = "姓名不能为空!" }, JsonRequestBehavior.DenyGet));
         }
         if (string.IsNullOrEmpty(phone) || !IsPhone)
         {
             return(Json(new { Success = false, ErrorMessage = "手机号码有误,请重新填写!" }, JsonRequestBehavior.DenyGet));
         }
         var entity = new MessageBoard
         {
             UserName       = HttpUtility.UrlDecode(userName.Trim()),
             Phone          = HttpUtility.UrlDecode(phone.Trim()),
             MessageContent = HttpUtility.UrlDecode(messageContent.Trim()),
             ClientIp       = IPAddressHelper.GetClientIp(),
             LocalIp        = IPAddressHelper.GetLocalIp(),
             RequestUrl     = requestUrl,
             UrlReferrer    = urlReferrer,
             Host           = host,
             CreateTime     = DateTime.Now
         };
         var messageBoard = new MessageBoardBll();
         messageBoard.Add(entity);
         return(Json(new { Success = true, }, JsonRequestBehavior.DenyGet));
     }
     catch
     {
         return(Json(new { Success = false, ErrorMessage = "留言失败,请稍后重试!" }, JsonRequestBehavior.DenyGet));
     }
 }
Ejemplo n.º 6
0
        public void ResponseToPlatform(Platform plat)
        {
            Gateway   gw      = InfoService.Instance.CurrentGateway;
            string    localIp = IPAddressHelper.GetLocalIp();
            SIP_Stack stack   = SipProxyWrapper.Instance.Stack;

            DeviceCatalogResp resp = createCatalogResp(gw, plat);
            string            body = SerializeHelper.Instance.Serialize(resp);

            SIP_t_NameAddress from = new SIP_t_NameAddress($"sip:{gw.SipNumber}@{localIp}:{gw.Port}");
            SIP_t_NameAddress to   = new SIP_t_NameAddress($"sip:{plat.SipNumber}@{plat.Ip}:{plat.Port}");

            SIP_Request message = stack.CreateRequest(SIP_Methods.MESSAGE, to, from);

            message.ContentType = "Application/MANSCDP+xml";
            message.Data        = MyEncoder.Encoder.GetBytes(body);
            SIP_RequestSender send = stack.CreateRequestSender(message);

            send.Start();
        }
Ejemplo n.º 7
0
        public void NotifyToPlatform(string platId)
        {
            Gateway   gw      = InfoService.Instance.CurrentGateway;
            Platform  pf      = InfoService.Instance.GetPlatform(platId);
            string    localIp = IPAddressHelper.GetLocalIp();
            SIP_Stack stack   = SipProxyWrapper.Instance.Stack;

            DeviceCatalogNotify dcd = createCatalog(gw, pf);
            string body             = SerializeHelper.Instance.Serialize(dcd);

            SIP_t_NameAddress from = new SIP_t_NameAddress($"sip:{gw.SipNumber}@{localIp}:{gw.Port}");
            SIP_t_NameAddress to   = new SIP_t_NameAddress($"sip:{pf.SipNumber}@{pf.Ip}:{pf.Port}");

            SIP_Request message = stack.CreateRequest(SIP_Methods.NOTIFY, to, from);

            message.ContentType = "Application/MANSCDP+xml";
            message.Data        = MyEncoder.Encoder.GetBytes(body);
            SIP_RequestSender send = stack.CreateRequestSender(message);

            send.Start();
        }
Ejemplo n.º 8
0
 private RegisterManager()
 {
     _dictRegister = new Dictionary <string, Register>();
     _localIp      = IPAddressHelper.GetLocalIp();
 }