本文整理汇总了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;
}
示例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;
}
示例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;
}
}
}
示例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));
}
}
示例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;
}