当前位置: 首页>>代码示例>>C#>>正文


C# Hashtable.ToString方法代码示例

本文整理汇总了C#中System.Collections.Hashtable.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Hashtable.ToString方法的具体用法?C# Hashtable.ToString怎么用?C# Hashtable.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Collections.Hashtable的用法示例。


在下文中一共展示了Hashtable.ToString方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: HandleDialplanRequest

        public Hashtable HandleDialplanRequest(string Context, string Realm, Hashtable request)
        {
             m_log.DebugFormat("[FreeSwitchVoice] HandleDialplanRequest called with {0}",request.ToString());
             
             Hashtable response = new Hashtable();
             
             foreach (DictionaryEntry item in request)
             {
                m_log.InfoFormat("[FreeSwitchDirectory] requestBody item {0} {1}",item.Key, item.Value);
             }

             string requestcontext = (string) request["Hunt-Context"];
             response["content_type"] = "text/xml";
             response["keepalive"] = false;
            response["int_response_code"] = 200;
            if (Context != String.Empty && Context != requestcontext)
            {
                m_log.Debug("[FreeSwitchDirectory] returning empty as it's for another context");
                response["str_response_string"] = "";
            } else {
                response["str_response_string"] = String.Format(@"<?xml version=""1.0"" encoding=""utf-8""?>
                   <document type=""freeswitch/xml"">
                     <section name=""dialplan"">
                     <context name=""{0}"">" + 
               
/*                           <!-- dial via SIP uri -->
                            <extension name=""sip_uri"">
                                   <condition field=""destination_number"" expression=""^sip:(.*)$"">
                                   <action application=""bridge"" data=""sofia/${use_profile}/$1""/>
                                   <!--<action application=""bridge"" data=""$1""/>-->
                                   </condition>
                           </extension>*/
               
                           @"<extension name=""opensim_conferences"">
                                   <condition field=""destination_number"" expression=""^confctl-(.*)$"">
                                           <action application=""answer""/>
                                           <action application=""conference"" data=""$1-{1}@{0}""/>
                                   </condition>
                           </extension>
                       
                           <extension name=""opensim_conf"">
                                   <condition field=""destination_number"" expression=""^conf-(.*)$"">
                                           <action application=""answer""/>
                                           <action application=""conference"" data=""$1-{1}@{0}""/>
                                   </condition>
                           </extension>
               
                           <extension name=""avatar"">
                                   <condition field=""destination_number"" expression=""^(x.*)$"">
                                           <action application=""bridge"" data=""user/$1""/>
                                   </condition>
                           </extension>
               
                     </context>
                   </section>
                   </document>", Context, Realm);
            }
             
            return response;   
        }    
开发者ID:Ideia-Boa,项目名称:Diva-s-OpenSim-Tests,代码行数:60,代码来源:FreeSwitchDialplan.cs

示例2: HandleDialplanRequest

        public Hashtable HandleDialplanRequest(Hashtable request)
        {
             m_log.DebugFormat("[FreeSwitchVoice] HandleDialplanRequest called with {0}",request.ToString());
             
             Hashtable response = new Hashtable();
             
             foreach (DictionaryEntry item in request)
             {
                m_log.InfoFormat("[FreeSwitchDirectory] requestBody item {0} {1}",item.Key, item.Value);
             }

             response["content_type"] = "text/xml";
             response["keepalive"] = false;
             response["int_response_code"] = 200;
             response["str_response_string"] = @"<?xml version=""1.0"" encoding=""utf-8""?>
                   <document type=""freeswitch/xml"">
                     <section name=""dialplan"">
                  <context name=""default"">
               
                        <!-- dial via SIP uri -->
                            <extension name=""sip_uri"">
                                   <condition field=""destination_number"" expression=""^sip:(.*)$"">
                                   <action application=""bridge"" data=""sofia/${use_profile}/$1""/>
                                   <!--<action application=""bridge"" data=""$1""/>-->
                                   </condition>
                        </extension>
               
                        <extension name=""opensim_conferences"">
                                   <condition field=""destination_number"" expression=""^confctl-(.*)$"">
                                           <action application=""answer""/>
                                        <action application=""conference"" data=""$1-${domain_name}@default""/>
                                   </condition>
                           </extension>
                       
                           <extension name=""opensim_conf"">
                                   <condition field=""destination_number"" expression=""^conf-(.*)$"">
                                           <action application=""answer""/>
                                           <action application=""conference"" data=""$1-${domain_name}@default""/>
                                   </condition>
                           </extension>
               
                           <extension name=""avatar"">
                                   <condition field=""destination_number"" expression=""^(x.*)$"">
                                           <action application=""bridge"" data=""user/$1""/>
                                   </condition>
                           </extension>
               
                     </context>
                   </section>
                </document>";
             
            return response;   
        }    
开发者ID:ChrisD,项目名称:opensim,代码行数:53,代码来源:FreeSwitchDialplan.cs

示例3: HandleDirectoryRequest

        public byte[] HandleDirectoryRequest(Hashtable request, OSHttpRequest httpRequest, OSHttpResponse httpResponse)
        {
            string domain = (string)request["domain"];
            if (domain != m_freeSwitchRealm)
            {
                httpResponse.ContentType = "text/xml";
                httpResponse.StatusCode = 200;
                return MainServer.BadRequest;
            }
            else
            {
                MainConsole.Instance.DebugFormat("[FreeSwitchDirectory] HandleDirectoryRequest called with {0}", request.ToString());

                // information in the request we might be interested in

                // Request 1 sip_auth for users account

                //Event-Calling-Function=sofia_reg_parse_auth
                //Event-Calling-Line-Number=1494
                //action=sip_auth
                //sip_user_agent=Vivox-SDK-2.1.3010.6151-Mac%20(Feb-11-2009/16%3A42%3A41)
                //sip_auth_username=xhZuXKmRpECyr2AARJYyGgg%3D%3D  (==)
                //sip_auth_realm=9.20.151.43
                //sip_contact_user=xhZuXKmRpECyr2AARJYyGgg%3D%3D (==)
                //sip_contact_host=192.168.0.3    // this shouldnt really be a local IP, investigate STUN servers
                //sip_to_user=xhZuXKmRpECyr2AARJYyGgg%3D%3D
                //sip_to_host=9.20.151.43
                //sip_auth_method=REGISTER
                //user=xhZuXKmRpECyr2AARJYyGgg%3D%3D
                //domain=9.20.151.43
                //ip=9.167.220.137    // this is the correct IP rather than sip_contact_host above when through a vpn or NAT setup

                foreach (DictionaryEntry item in request)
                {
                    MainConsole.Instance.InfoFormat("[FreeSwitchDirectory] requestBody item {0} {1}", item.Key, item.Value);
                }

                string eventCallingFunction = (string)request["Event-Calling-Function"];
                if (eventCallingFunction == null)
                {
                    eventCallingFunction = "sofia_reg_parse_auth";
                }

                if (eventCallingFunction.Length == 0)
                {
                    eventCallingFunction = "sofia_reg_parse_auth";
                }

                if (eventCallingFunction == "sofia_reg_parse_auth")
                {
                    string sipAuthMethod = (string)request["sip_auth_method"];

                    if (sipAuthMethod == "REGISTER")
                    {
                        return HandleRegister(m_freeSwitchContext, m_freeSwitchRealm, request, httpRequest, httpResponse);
                    }
                    else if (sipAuthMethod == "INVITE")
                    {
                        return HandleInvite(m_freeSwitchContext, m_freeSwitchRealm, request, httpRequest, httpResponse);
                    }
                    else
                    {
                        MainConsole.Instance.ErrorFormat("[FreeSwitchVoice] HandleDirectoryRequest unknown sip_auth_method {0}", sipAuthMethod);
                        httpResponse.ContentType = "text/xml";
                        httpResponse.StatusCode = 404;
                        return MainServer.BadRequest;
                    }
                }
                else if (eventCallingFunction == "switch_xml_locate_user")
                {
                    return HandleLocateUser(m_freeSwitchRealm, request, httpRequest, httpResponse);
                }
                else if (eventCallingFunction == "user_data_function") // gets called when an avatar to avatar call is made
                {
                    return HandleLocateUser(m_freeSwitchRealm, request, httpRequest, httpResponse);
                }
                else if (eventCallingFunction == "user_outgoing_channel")
                {
                    return HandleRegister(m_freeSwitchContext, m_freeSwitchRealm, request, httpRequest, httpResponse);
                }
                else if (eventCallingFunction == "config_sofia") // happens once on freeswitch startup
                {
                    return HandleConfigSofia(m_freeSwitchContext, m_freeSwitchRealm, request, httpRequest, httpResponse);
                }
                else if (eventCallingFunction == "switch_load_network_lists")
                {
                    //response = HandleLoadNetworkLists(request);
                    httpResponse.ContentType = "text/xml";
                    httpResponse.StatusCode = 404;
                    return MainServer.BadRequest;
                }
                else
                {
                    MainConsole.Instance.ErrorFormat("[FreeSwitchVoice] HandleDirectoryRequest unknown Event-Calling-Function {0}", eventCallingFunction);
                    httpResponse.ContentType = "text/xml";
                    httpResponse.StatusCode = 404;
                    return MainServer.BadRequest;
                }
            }
        }
开发者ID:aurora-sim,项目名称:Aurora-Sim-Optional-Modules,代码行数:100,代码来源:FreeswitchService.cs

示例4: HandleDialplanRequest

        public byte[] HandleDialplanRequest(Hashtable request, OSHttpRequest httpRequest, OSHttpResponse httpResponse)
        {
            MainConsole.Instance.DebugFormat("[FreeSwitchVoice] HandleDialplanRequest called with {0}", request.ToString());

            string requestcontext = (string)request["Hunt-Context"];
            httpResponse.ContentType = "text/xml";
            httpResponse.StatusCode = 200;

            if (m_freeSwitchContext != String.Empty && m_freeSwitchContext != requestcontext)
            {
                MainConsole.Instance.Debug("[FreeSwitchDirectory] returning empty as it's for another context");
                return MainServer.BadRequest;
            }
            else
            {
                return Encoding.UTF8.GetBytes(String.Format(@"<?xml version=""1.0"" encoding=""utf-8""?>
                   <document type=""freeswitch/xml"">
                     <section name=""dialplan"">
                     <context name=""{0}"">" +

            /*                           <!-- dial via SIP uri -->
                            <extension name=""sip_uri"">
                                   <condition field=""destination_number"" expression=""^sip:(.*)$"">
                                   <action application=""bridge"" data=""sofia/${use_profile}/$1""/>
                                   <!--<action application=""bridge"" data=""$1""/>-->
                                   </condition>
                           </extension>*/

                           @"<extension name=""opensim_conferences"">
                                   <condition field=""destination_number"" expression=""^confctl-(.*)$"">
                                           <action application=""answer""/>
                                           <action application=""conference"" data=""$1-{1}@{0}""/>
                                   </condition>
                           </extension>

                           <extension name=""opensim_conf"">
                                   <condition field=""destination_number"" expression=""^conf-(.*)$"">
                                           <action application=""answer""/>
                                           <action application=""conference"" data=""$1-{1}@{0}""/>
                                   </condition>
                           </extension>

                           <extension name=""avatar"">
                                   <condition field=""destination_number"" expression=""^(x.*)$"">
                                           <action application=""bridge"" data=""user/$1""/>
                                   </condition>
                           </extension>

                     </context>
                   </section>
                   </document>", m_freeSwitchContext, m_freeSwitchRealm));
            }
        }
开发者ID:aurora-sim,项目名称:Aurora-Sim-Optional-Modules,代码行数:53,代码来源:FreeswitchService.cs

示例5: GenericXMLRPCRequest

        //
        // Make external XMLRPC request
        //
        private Hashtable GenericXMLRPCRequest(Hashtable ReqParams, string method)
        {
            ArrayList SendParams = new ArrayList();
            SendParams.Add(ReqParams);

            // Send Request
            XmlRpcResponse Resp;
            try
            {
                XmlRpcRequest Req = new XmlRpcRequest(method, SendParams);
                Resp = Req.Send(m_ProfileServer, 30000);
            }

            catch (WebException ex)
            {
                m_log.ErrorFormat("[PROFILE]: Unable to connect to Profile Server {0}.  Exception {1}", m_ProfileServer, ex);
                Hashtable ErrorHash = new Hashtable();
                ErrorHash["success"] = false;
                ErrorHash["errorMessage"] = "WEB Connecton Error.";
                ErrorHash["errorURI"] = "";

                return ErrorHash;
            }

            catch (SocketException ex)
            {
                m_log.ErrorFormat("[PROFILE]: Unable to connect to Profile Server {0}. Method {1}, params {2}. Exception {3}",
                                                            m_ProfileServer, method, ReqParams, ex);
                Hashtable ErrorHash = new Hashtable();
                ErrorHash["success"] = false;
                ErrorHash["errorMessage"] = "Network Socket Error.";
                ErrorHash["errorURI"] = "";

                return ErrorHash;
            }

            catch (XmlException ex)
            {
                m_log.ErrorFormat("[PROFILE]: Unable to connect to Profile Server {0}. Method {1}, params {2}. Exception {3}",
                                                            m_ProfileServer, method, ReqParams.ToString(), ex);
                Hashtable ErrorHash = new Hashtable();
                ErrorHash["success"] = false;
                ErrorHash["errorMessage"] = "XML Parse Error.";
                ErrorHash["errorURI"] = "";

                return ErrorHash;
            }

            if (Resp.IsFault)
            {
                Hashtable ErrorHash = new Hashtable();
                ErrorHash["success"] = false;
                ErrorHash["errorMessage"] = "Response Fault.";
                ErrorHash["errorURI"] = "";
                return ErrorHash;
            }
            Hashtable RespData = (Hashtable)Resp.Value;

            return RespData;
        }
开发者ID:unethika,项目名称:mod_nslmodules,代码行数:63,代码来源:OpenProfile.cs


注:本文中的System.Collections.Hashtable.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。