internal void NotifyServerCallExit(HttpResponse response)
        {
            try {
                if (NotifySink == null)
                {
                    return;
                }

                IntPtr bufferPtr;
                int    bufferSize = 0;
                CallId callId     = new CallId(null, 0, (IntPtr)0, 0, null, null);
                UnsafeNativeMethods.OnSyncCallExit(NotifySink, callId, out bufferPtr, ref bufferSize);
                if (bufferPtr == IntPtr.Zero)
                {
                    return;
                }
                byte[] buffer = null;
                try {
                    buffer = new byte[bufferSize];
                    Marshal.Copy(bufferPtr, buffer, 0, bufferSize);
                }
                finally {
                    Marshal.FreeCoTaskMem(bufferPtr);
                }
                string stringBuffer = Convert.ToBase64String(buffer);
                response.AddHeader(debuggerHeader, stringBuffer);
            }
            catch (Exception) {
            }

            this.Close();
        }
示例#2
0
        private void BindModelData(int recid)
        {
            strRecID = recid.ToString();
            Entities.BlackWhiteList model = BLL.BlackWhiteList.Instance.GetModel(recid);

            edit_txtPhoneNum.Value  = model.PhoneNum;
            edit_txtYouXiaoQi.Value = model.ExpiryDate.ToString("yyyy-MM-dd");
            if (model.CallType == 1)  //呼入
            {
                edit_ckb_calltype_1.Checked = true;
            }
            if (model.CallType == 2)  //呼出
            {
                edit_ckb_calltype_2.Checked = true;
            }
            if (model.CallType == 3)  //呼入和呼出
            {
                edit_ckb_calltype_1.Checked = true;
                edit_ckb_calltype_2.Checked = true;
            }

            strReason = model.Reason;
            cdids     = model.CDIDS;

            txtCallID.Value = string.IsNullOrEmpty(CallId.Trim()) ? (model.CallID.HasValue ? model.CallID.Value.ToString() : "") : CallId.Trim();
            selNoDisturbReason.SelectedIndex = model.CallOutNDType < 0 ? 0 : model.CallOutNDType;
        }
        internal void NotifyServerCallEnter(ServerProtocol protocol, string stringBuffer)
        {
            try {
                if (NotifySink == null)
                {
                    return;
                }
                StringBuilder methodBuilder = new StringBuilder();
                methodBuilder.Append(protocol.Type.FullName);
                methodBuilder.Append('.');
                methodBuilder.Append(protocol.MethodInfo.Name);
                methodBuilder.Append('(');
                ParameterInfo[] parameterInfos = protocol.MethodInfo.Parameters;
                for (int i = 0; i < parameterInfos.Length; ++i)
                {
                    if (i != 0)
                    {
                        methodBuilder.Append(',');
                    }

                    methodBuilder.Append(parameterInfos[i].ParameterType.FullName);
                }
                methodBuilder.Append(')');

                byte[] buffer = Convert.FromBase64String(stringBuffer);
                CallId callId = new CallId(null, 0, (IntPtr)0, 0, methodBuilder.ToString(), null);
                UnsafeNativeMethods.OnSyncCallEnter(NotifySink, callId, buffer, buffer.Length);
            }
            catch (Exception) {
            }
        }
        internal void NotifyClientCallReturn(WebResponse response)
        {
            try {
                if (NotifySink == null)
                {
                    return;
                }

                byte[] buffer = new byte[0];
                if (response != null)
                {
                    string bufferString = response.Headers[debuggerHeader];
                    if (bufferString != null && bufferString.Length != 0)
                    {
                        buffer = Convert.FromBase64String(bufferString);
                    }
                }

                CallId callId = new CallId(null, 0, (IntPtr)0, 0, null, null);
                UnsafeNativeMethods.OnSyncCallReturn(NotifySink, callId, buffer, buffer.Length);
            }
            catch (Exception) {
            }

            this.Close();
        }
        internal void NotifyClientCallOut(WebRequest request)
        {
            try {
                if (NotifySink == null)
                {
                    return;
                }

                IntPtr bufferPtr;
                int    bufferSize = 0;
                CallId callId     = new CallId(null, 0, (IntPtr)0, 0, null, request.RequestUri.Host);

                UnsafeNativeMethods.OnSyncCallOut(NotifySink, callId, out bufferPtr, ref bufferSize);
                if (bufferPtr == IntPtr.Zero)
                {
                    return;
                }
                byte[] buffer = null;
                try {
                    buffer = new byte[bufferSize];
                    Marshal.Copy(bufferPtr, buffer, 0, bufferSize);
                }
                finally {
                    Marshal.FreeCoTaskMem(bufferPtr);
                }
                string bufferString = Convert.ToBase64String(buffer);
                request.Headers.Add(debuggerHeader, bufferString);
            }
            catch (Exception) {
            }
        }
示例#6
0
 public override void ToStream(Stream output)
 {
     output.Write(TLUtils.SignatureToBytes(Signature));
     Flags.ToStream(output);
     CallId.ToStream(output);
     ToStream(output, Reason, Flags, (int)MessageActionPhoneCallFlags.Reason);
     ToStream(output, Duration, Flags, (int)MessageActionPhoneCallFlags.Duration);
 }
示例#7
0
 private void AddNewNodisturbNumber()
 {
     TitleString                 = "新增免打扰";
     strAction                   = "AddNoDisturbData";
     edit_txtPhoneNum.Value      = PhoneNumber;
     txtCallID.Value             = CallId.Trim();
     edit_ckb_calltype_1.Checked = false;
     edit_ckb_calltype_2.Checked = true;
     edit_txtYouXiaoQi.Value     = DateTime.Now.AddMonths(3).ToString("yyyy-MM-dd");
 }
示例#8
0
        internal void NotifyServerCallExit(HttpResponse response)
        {
            try {
                if (NotifySink == null)
                {
                    return;
                }

                IntPtr bufferPtr;
                int    bufferSize = 0;
                CallId callId     = new CallId(null, 0, (IntPtr)0, 0, null, null);

                TraceMethod method = Tracing.On ? new TraceMethod(this, "NotifyServerCallExit") : null;
                if (Tracing.On)
                {
                    Tracing.Enter("RemoteDebugger", method);
                }

                UnsafeNativeMethods.OnSyncCallExit(NotifySink, callId, out bufferPtr, ref bufferSize);

                if (Tracing.On)
                {
                    Tracing.Exit("RemoteDebugger", method);
                }

                if (bufferPtr == IntPtr.Zero)
                {
                    return;
                }
                byte[] buffer = null;
                try {
                    buffer = new byte[bufferSize];
                    Marshal.Copy(bufferPtr, buffer, 0, bufferSize);
                }
                finally {
                    Marshal.FreeCoTaskMem(bufferPtr);
                }
                string stringBuffer = Convert.ToBase64String(buffer);
                response.AddHeader(debuggerHeader, stringBuffer);
            }
            catch (Exception e) {
                if (e is ThreadAbortException || e is StackOverflowException || e is OutOfMemoryException)
                {
                    throw;
                }
                if (Tracing.On)
                {
                    Tracing.ExceptionCatch(TraceEventType.Warning, typeof(RemoteDebugger), "NotifyServerCallExit", e);
                }
            }
            this.Close();
        }
示例#9
0
 internal void NotifyServerCallExit(HttpResponse response)
 {
     try
     {
         IntPtr ptr;
         if (this.NotifySink == null)
         {
             return;
         }
         int         num    = 0;
         CallId      callId = new CallId(null, 0, IntPtr.Zero, 0L, null, null);
         TraceMethod caller = Tracing.On ? new TraceMethod(this, "NotifyServerCallExit", new object[0]) : null;
         if (Tracing.On)
         {
             Tracing.Enter("RemoteDebugger", caller);
         }
         System.Web.Services.UnsafeNativeMethods.OnSyncCallExit(this.NotifySink, callId, out ptr, ref num);
         if (Tracing.On)
         {
             Tracing.Exit("RemoteDebugger", caller);
         }
         if (ptr == IntPtr.Zero)
         {
             return;
         }
         byte[] destination = null;
         try
         {
             destination = new byte[num];
             Marshal.Copy(ptr, destination, 0, num);
         }
         finally
         {
             Marshal.FreeCoTaskMem(ptr);
         }
         string str = Convert.ToBase64String(destination);
         response.AddHeader(debuggerHeader, str);
     }
     catch (Exception exception)
     {
         if (((exception is ThreadAbortException) || (exception is StackOverflowException)) || (exception is OutOfMemoryException))
         {
             throw;
         }
         if (Tracing.On)
         {
             Tracing.ExceptionCatch(TraceEventType.Warning, typeof(RemoteDebugger), "NotifyServerCallExit", exception);
         }
     }
     this.Close();
 }
示例#10
0
        internal void NotifyServerCallEnter(ServerProtocol protocol, string stringBuffer)
        {
            try {
                if (NotifySink == null)
                {
                    return;
                }
                StringBuilder methodBuilder = new StringBuilder();
                methodBuilder.Append(protocol.Type.FullName);
                methodBuilder.Append('.');
                methodBuilder.Append(protocol.MethodInfo.Name);
                methodBuilder.Append('(');
                ParameterInfo[] parameterInfos = protocol.MethodInfo.Parameters;
                for (int i = 0; i < parameterInfos.Length; ++i)
                {
                    if (i != 0)
                    {
                        methodBuilder.Append(',');
                    }

                    methodBuilder.Append(parameterInfos[i].ParameterType.FullName);
                }
                methodBuilder.Append(')');

                byte[] buffer = Convert.FromBase64String(stringBuffer);
                CallId callId = new CallId(null, 0, (IntPtr)0, 0, methodBuilder.ToString(), null);

                TraceMethod method = Tracing.On ? new TraceMethod(this, "NotifyServerCallEnter") : null;
                if (Tracing.On)
                {
                    Tracing.Enter("RemoteDebugger", method);
                }

                UnsafeNativeMethods.OnSyncCallEnter(NotifySink, callId, buffer, buffer.Length);

                if (Tracing.On)
                {
                    Tracing.Exit("RemoteDebugger", method);
                }
            }
            catch (Exception e) {
                if (e is ThreadAbortException || e is StackOverflowException || e is OutOfMemoryException)
                {
                    throw;
                }
                if (Tracing.On)
                {
                    Tracing.ExceptionCatch(TraceEventType.Warning, typeof(RemoteDebugger), "NotifyServerCallEnter", e);
                }
            }
        }
示例#11
0
 internal void NotifyServerCallEnter(ServerProtocol protocol, string stringBuffer)
 {
     try
     {
         if (this.NotifySink != null)
         {
             StringBuilder builder = new StringBuilder();
             builder.Append(protocol.Type.FullName);
             builder.Append('.');
             builder.Append(protocol.MethodInfo.Name);
             builder.Append('(');
             ParameterInfo[] parameters = protocol.MethodInfo.Parameters;
             for (int i = 0; i < parameters.Length; i++)
             {
                 if (i != 0)
                 {
                     builder.Append(',');
                 }
                 builder.Append(parameters[i].ParameterType.FullName);
             }
             builder.Append(')');
             byte[]      buffer = Convert.FromBase64String(stringBuffer);
             CallId      callId = new CallId(null, 0, IntPtr.Zero, 0L, builder.ToString(), null);
             TraceMethod caller = Tracing.On ? new TraceMethod(this, "NotifyServerCallEnter", new object[0]) : null;
             if (Tracing.On)
             {
                 Tracing.Enter("RemoteDebugger", caller);
             }
             System.Web.Services.UnsafeNativeMethods.OnSyncCallEnter(this.NotifySink, callId, buffer, buffer.Length);
             if (Tracing.On)
             {
                 Tracing.Exit("RemoteDebugger", caller);
             }
         }
     }
     catch (Exception exception)
     {
         if (((exception is ThreadAbortException) || (exception is StackOverflowException)) || (exception is OutOfMemoryException))
         {
             throw;
         }
         if (Tracing.On)
         {
             Tracing.ExceptionCatch(TraceEventType.Warning, typeof(RemoteDebugger), "NotifyServerCallEnter", exception);
         }
     }
 }
示例#12
0
        internal void NotifyClientCallReturn(WebResponse response)
        {
            try {
                if (NotifySink == null)
                {
                    return;
                }

                byte[] buffer = new byte[0];
                if (response != null)
                {
                    string bufferString = response.Headers[debuggerHeader];
                    if (bufferString != null && bufferString.Length != 0)
                    {
                        buffer = Convert.FromBase64String(bufferString);
                    }
                }
                CallId callId = new CallId(null, 0, (IntPtr)0, 0, null, null);

                TraceMethod method = Tracing.On ? new TraceMethod(this, "NotifyClientCallReturn") : null;
                if (Tracing.On)
                {
                    Tracing.Enter("RemoteDebugger", method);
                }

                UnsafeNativeMethods.OnSyncCallReturn(NotifySink, callId, buffer, buffer.Length);

                if (Tracing.On)
                {
                    Tracing.Exit("RemoteDebugger", method);
                }
            }
            catch (Exception e) {
                if (e is ThreadAbortException || e is StackOverflowException || e is OutOfMemoryException)
                {
                    throw;
                }
                if (Tracing.On)
                {
                    Tracing.ExceptionCatch(TraceEventType.Warning, typeof(RemoteDebugger), "NotifyClientCallReturn", e);
                }
            }

            this.Close();
        }
示例#13
0
 internal void NotifyClientCallReturn(WebResponse response)
 {
     try
     {
         if (this.NotifySink == null)
         {
             return;
         }
         byte[] buffer = new byte[0];
         if (response != null)
         {
             string s = response.Headers[debuggerHeader];
             if ((s != null) && (s.Length != 0))
             {
                 buffer = Convert.FromBase64String(s);
             }
         }
         CallId      callId = new CallId(null, 0, IntPtr.Zero, 0L, null, null);
         TraceMethod caller = Tracing.On ? new TraceMethod(this, "NotifyClientCallReturn", new object[0]) : null;
         if (Tracing.On)
         {
             Tracing.Enter("RemoteDebugger", caller);
         }
         System.Web.Services.UnsafeNativeMethods.OnSyncCallReturn(this.NotifySink, callId, buffer, buffer.Length);
         if (Tracing.On)
         {
             Tracing.Exit("RemoteDebugger", caller);
         }
     }
     catch (Exception exception)
     {
         if (((exception is ThreadAbortException) || (exception is StackOverflowException)) || (exception is OutOfMemoryException))
         {
             throw;
         }
         if (Tracing.On)
         {
             Tracing.ExceptionCatch(TraceEventType.Warning, typeof(RemoteDebugger), "NotifyClientCallReturn", exception);
         }
     }
     this.Close();
 }
 internal static void OnSyncCallReturn(INotifySink2 sink, CallId callId, byte[] in_pBuffer, int in_BufferSize)
 {
     sink.OnSyncCallReturn(callId, in_pBuffer, in_BufferSize);
 }
示例#15
0
 protected Call(CallId callId, MethodInfo methodRef)
 {
     (CallId, MethodRef) =
         (callId, methodRef);
 }
示例#16
0
        private osip_message_t *ToNative()
        {
            osip_message_t *native;

            NativeMethods.osip_message_init(&native).ThrowOnError();

            native->sip_version = Marshal.StringToHGlobalAnsi(Version);
            native->from        = From != null
                    ? From.ToNative()
                    : osip_from_t.Null;

            native->to = To != null
                    ? To.ToNative()
                    : osip_from_t.Null;

            native->call_id = CallId != null
                    ? CallId.ToNative()
                    : osip_call_id_t.Null;

            native->cseq = CSeq != null
                    ? CSeq.ToNative()
                    : osip_cseq_t.Null;

            native->content_type = ContentType != null
                    ? ContentType.ToNative()
                    : osip_content_type_t.Null;

            native->mime_version = MimeVersion != null
                    ? MimeVersion.ToNative()
                    : osip_content_length_t.Null;

            if (this is SipRequest request)
            {
                native->sip_method = native->sip_method = Marshal.StringToHGlobalAnsi(request.Method);
                native->req_uri    = request.RequestUri != null
                    ? request.RequestUri.ToNative()
                    : osip_uri_t.Null;
            }
            else if (this is SipResponse response)
            {
                native->status_code   = response.StatusCode;
                native->reason_phrase = Marshal.StringToHGlobalAnsi(response.ReasonPhrase);
            }

            for (int i = 0; i < Vias.Count; i++)
            {
                osip_via_t *header = Vias[i].ToNative();
                NativeMethods.osip_list_add(&native->vias, header, i).ThrowOnError();
            }

            for (int i = 0; i < RecordRoutes.Count; i++)
            {
                osip_from_t *header = RecordRoutes[i].ToNative();
                NativeMethods.osip_list_add(&native->record_routes, header, i).ThrowOnError();
            }

            for (int i = 0; i < Routes.Count; i++)
            {
                osip_from_t *header = Routes[i].ToNative();
                NativeMethods.osip_list_add(&native->routes, header, i).ThrowOnError();
            }

            for (int i = 0; i < Contacts.Count; i++)
            {
                osip_from_t *header = Contacts[i].ToNative();
                NativeMethods.osip_list_add(&native->contacts, header, i).ThrowOnError();
            }

            for (int i = 0; i < Authorizations.Count; i++)
            {
                osip_authorization_t *header = Authorizations[i].ToNative();
                NativeMethods.osip_list_add(&native->authorizations, header, i).ThrowOnError();
            }

            for (int i = 0; i < WwwAuthenticates.Count; i++)
            {
                osip_www_authenticate_t *header = WwwAuthenticates[i].ToNative();
                NativeMethods.osip_list_add(&native->www_authenticates, header, i).ThrowOnError();
            }

            for (int i = 0; i < ProxyAuthenticates.Count; i++)
            {
                osip_www_authenticate_t *header = ProxyAuthenticates[i].ToNative();
                NativeMethods.osip_list_add(&native->proxy_authenticates, header, i).ThrowOnError();
            }

            for (int i = 0; i < ProxyAuthorizations.Count; i++)
            {
                osip_authorization_t *header = ProxyAuthorizations[i].ToNative();
                NativeMethods.osip_list_add(&native->proxy_authorizations, header, i).ThrowOnError();
            }

            for (int i = 0; i < CallInfos.Count; i++)
            {
                osip_call_info_t *header = CallInfos[i].ToNative();
                NativeMethods.osip_list_add(&native->call_infos, header, i).ThrowOnError();
            }

            for (int i = 0; i < Allows.Count; i++)
            {
                osip_content_length_t *header = Allows[i].ToNative();
                NativeMethods.osip_list_add(&native->allows, header, i).ThrowOnError();
            }

            for (int i = 0; i < ContentEncodings.Count; i++)
            {
                osip_content_length_t *header = ContentEncodings[i].ToNative();
                NativeMethods.osip_list_add(&native->content_encodings, header, i).ThrowOnError();
            }

            for (int i = 0; i < AlertInfos.Count; i++)
            {
                osip_call_info_t *header = AlertInfos[i].ToNative();
                NativeMethods.osip_list_add(&native->alert_infos, header, i).ThrowOnError();
            }

            for (int i = 0; i < ErrorInfos.Count; i++)
            {
                osip_call_info_t *header = ErrorInfos[i].ToNative();
                NativeMethods.osip_list_add(&native->error_infos, header, i).ThrowOnError();
            }

            for (int i = 0; i < Accepts.Count; i++)
            {
                osip_content_type_t *header = Accepts[i].ToNative();
                NativeMethods.osip_list_add(&native->accepts, header, i).ThrowOnError();
            }

            for (int i = 0; i < AcceptEncodings.Count; i++)
            {
                osip_accept_encoding_t *header = AcceptEncodings[i].ToNative();
                NativeMethods.osip_list_add(&native->accept_encodings, header, i).ThrowOnError();
            }

            for (int i = 0; i < AcceptLanguages.Count; i++)
            {
                osip_accept_encoding_t *header = AcceptLanguages[i].ToNative();
                NativeMethods.osip_list_add(&native->accept_languages, header, i).ThrowOnError();
            }

            for (int i = 0; i < AuthenticationInfos.Count; i++)
            {
                osip_authentication_info_t *header = AuthenticationInfos[i].ToNative();
                NativeMethods.osip_list_add(&native->authentication_infos, header, i).ThrowOnError();
            }

            for (int i = 0; i < ProxyAuthenticationInfos.Count; i++)
            {
                osip_authentication_info_t *header = ProxyAuthenticationInfos[i].ToNative();
                NativeMethods.osip_list_add(&native->proxy_authentication_infos, header, i).ThrowOnError();
            }

            for (int i = 0; i < OtherHeaders.Count; i++)
            {
                osip_header_t *header = OtherHeaders[i].ToNative();
                NativeMethods.osip_list_add(&native->headers, header, i).ThrowOnError();
            }

            for (int i = 0; i < Bodies.Count; i++)
            {
                osip_body_t *header = Bodies[i].ToNative();
                NativeMethods.osip_list_add(&native->bodies, header, i).ThrowOnError();
            }

            return(native);
        }
 internal static void OnSyncCallExit(INotifySink2 sink, CallId callId, out IntPtr out_ppBuffer, ref int inout_pBufferSize)
 {
     sink.OnSyncCallExit(callId, out out_ppBuffer, ref inout_pBufferSize);
 }
示例#18
0
 protected Call(CallId callId, Delegate methodRef)
 {
     (CallId, MethodRef) =
         (callId, methodRef);
 }