コード例 #1
0
        protected virtual void OnSipRequest(WebBrowserNavigatingEventArgs e)
        {
            SipRequestArgs srArgs = new SipRequestArgs();
            srArgs.Command = e.Url.Host.ToString();

            string original = e.Url.PathAndQuery.ToString();
            original = original.Replace("&hash;", "#");
            string[] swp = original.Split('?');
            if (swp.Length == 1) {
                //no arguments
                srArgs.Command = original;
            } else {
                srArgs.Command = swp[0];
                foreach (string kvpair in swp[1].Split('&')) {
                    swp = kvpair.Split('=');
                    string key = swp[0].ToLower();
                    string val="";
                    if (swp.Length > 1) {
                        //argument with no value
                        val = Uri.UnescapeDataString(swp[1]);
                    }
                    srArgs.Arguments.Add(key, val);
                }
            }
            MySipRequest(this, srArgs);
            e.Cancel = srArgs.Cancel;
        }
コード例 #2
0
 public void onSipRequest(object sender, SipRequestArgs args)
 {
     object[] funcArgs= new object[]{sender,args};
     this.BeginInvoke(new DMySipRequest(this.PhoBrowSipRequest),funcArgs);
 }
コード例 #3
0
        public int HandleRequest(string requestString)
        {
            //togliere il codice e mettere in onSipRequest
            //qui passare solo la stringa
            SipRequestArgs srArgs = new SipRequestArgs();
            Uri url = new Uri(requestString);
            srArgs.Command = url.Host.ToString();

            string original = url.PathAndQuery.ToString();
            string[] swp = original.Split('?');
            if (swp.Length == 1) {
                //no arguments
                srArgs.Command = original;
            } else {
                srArgs.Command = swp[0];
                foreach (string kvpair in swp[1].Split('&')) {
                    swp = kvpair.Split('=');
                    string key = swp[0].ToLower();
                    string val="";
                    if (swp.Length > 1) {
                        //argument with no value
                        val = Uri.UnescapeDataString(swp[1]);
                    }
                    srArgs.Arguments.Add(key, val);
                }
            }
            MySipRequest(this, srArgs);

            return ResponseCodes.OK;
        }