diff --git a/TropoCSharp/TropoJSON.cs b/TropoCSharp/TropoJSON.cs index 0ff384d..ff721a8 100644 --- a/TropoCSharp/TropoJSON.cs +++ b/TropoCSharp/TropoJSON.cs @@ -15,7 +15,9 @@ public static void RenderJSON(this Tropo tropo, HttpResponse response) tropo.Voice = null; JsonSerializerSettings settings = new JsonSerializerSettings { DefaultValueHandling = DefaultValueHandling.Ignore }; response.AddHeader("WebAPI-Lang-Ver", "CSharp V15.9.0 SNAPSHOT"); - response.Write(JsonConvert.SerializeObject(tropo, Formatting.None, settings).Replace("\\", "").Replace("\"{", "{").Replace("}\"", "}")); + string sorig = JsonConvert.SerializeObject(tropo, Formatting.None, settings); + string s = sorig.Replace("\\\"", "\"").Replace("\\\\", "\\").Replace("\"{", "{").Replace("}\"", "}"); + response.Write(s); } } diff --git a/TropoClassesTests/TropoClassesTests.cs b/TropoClassesTests/TropoClassesTests.cs index 75d069b..a252d2e 100644 --- a/TropoClassesTests/TropoClassesTests.cs +++ b/TropoClassesTests/TropoClassesTests.cs @@ -516,7 +516,7 @@ private string renderJSONToText(Tropo tropo) tropo.Language = null; tropo.Voice = null; JsonSerializerSettings settings = new JsonSerializerSettings { DefaultValueHandling = DefaultValueHandling.Ignore }; - return JsonConvert.SerializeObject(tropo, Formatting.None, settings).Replace("\\", "").Replace("\"{", "{").Replace("}\"", "}"); + return JsonConvert.SerializeObject(tropo, Formatting.None, settings).Replace("\\\"", "\"").Replace("\\\\", "\\").Replace("\"{", "{").Replace("}\"", "}"); } } diff --git a/TropoSample/TROPO12171.aspx b/TropoSample/TROPO12171.aspx new file mode 100644 index 0000000..6741517 --- /dev/null +++ b/TropoSample/TROPO12171.aspx @@ -0,0 +1,2 @@ +<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="TROPO12171.aspx.cs" Inherits="TropoSample.TROPO12171" %> + diff --git a/TropoSample/TROPO12171.aspx.cs b/TropoSample/TROPO12171.aspx.cs new file mode 100644 index 0000000..78ec9a1 --- /dev/null +++ b/TropoSample/TROPO12171.aspx.cs @@ -0,0 +1,34 @@ +using System; +using System.Collections.Generic; +using System.Web.UI; +using TropoCSharp.Structs; +using TropoCSharp.Tropo; + +namespace TropoSample +{ + /// + /// A simple example demonstrating how to use the Ask method. + /// + public partial class TROPO12171 : Page + { + public void Page_Load(object sender, EventArgs args) + { + // Create a new instance of the Tropo object. + Tropo tropo = new Tropo(); + + Say say1 = new Say("test remote party id 3"); + + IDictionary headers = new Dictionary(); + //headers.Add("P-Header", "TROPO12171value goes here"); + headers.Add("Remote-Party-ID", "\"John Doe\"TROPO12171ab;party=calling;id-type=subscriber;privacy=full;screen=yes"); + //headers.Add("Remote-Party-ID", "\\yigegang3"); + + //Answer answer = new Answer(); + //answer.Headers = headers; + + tropo.Answer(headers); + tropo.Say(say1); + tropo.RenderJSON(Response); + } + } +}