diff --git a/src/Bandwidth.Standard.Test/Unit/Model/Bxml/TestRefer.cs b/src/Bandwidth.Standard.Test/Unit/Model/Bxml/TestRefer.cs new file mode 100644 index 0000000..63ea63d --- /dev/null +++ b/src/Bandwidth.Standard.Test/Unit/Model/Bxml/TestRefer.cs @@ -0,0 +1,31 @@ +using System; +using System.IO; +using System.Xml.Serialization; +using Bandwidth.Standard.Model.Bxml; +using Bandwidth.Standard.Model.Bxml.Verbs; +using Xunit; + +namespace Bandwidth.Standard.Test.Unit.Model.Bxml +{ + public class TestRefer + { + [Fact] + public void ReferTest() + { + var expected = " sip:alice@atlanta.example.com "; + + var sipUri = new SipUri { Uri = "sip:alice@atlanta.example.com" }; + + var refer = new Refer + { + SipUri = sipUri, + ReferCompleteUrl = "https://example.com/handleRefer", + ReferCompleteMethod = "POST", + Tag = "refer-tag" + }; + + var actual = new Response(refer).ToBXML(); + Assert.Equal(expected, actual.Replace("\n", "").Replace("\r", "")); + } + } +} diff --git a/src/Bandwidth.Standard/Model/Bxml/Verbs/Refer.cs b/src/Bandwidth.Standard/Model/Bxml/Verbs/Refer.cs new file mode 100644 index 0000000..f7c9912 --- /dev/null +++ b/src/Bandwidth.Standard/Model/Bxml/Verbs/Refer.cs @@ -0,0 +1,47 @@ +using Bandwidth.Standard.Model.Bxml; +using System; +using System.Collections.Generic; +using System.Xml.Serialization; + +namespace Bandwidth.Standard.Model.Bxml.Verbs +{ + /// + /// The Refer verb is used to hand off a call to a SIP endpoint. + /// + /// + public class Refer : IVerb + { + + /// + /// Initializes a new instance of the Refer class with defaults. + /// + public Refer() + { + ReferCompleteMethod = "POST"; + } + + /// + /// URL to receive the refer complete callback. + /// + [XmlAttribute("referCompleteUrl")] + public string ReferCompleteUrl { get; set; } + + /// + /// HTTP method to send the refer complete callback. GET or POST. Default value is POST. + /// + [XmlAttribute("referCompleteMethod")] + public string ReferCompleteMethod { get; set; } + + /// + /// Optional custom string to include in callbacks. + /// + [XmlAttribute("tag")] + public string Tag { get; set; } + + /// + /// A SIP URI specifying the refer destination + /// + [XmlElement("SipUri")] + public SipUri SipUri { get; set; } + } +} diff --git a/src/Bandwidth.Standard/Model/Bxml/Verbs/SipUri.cs b/src/Bandwidth.Standard/Model/Bxml/Verbs/SipUri.cs index 9a2d198..f57e48d 100644 --- a/src/Bandwidth.Standard/Model/Bxml/Verbs/SipUri.cs +++ b/src/Bandwidth.Standard/Model/Bxml/Verbs/SipUri.cs @@ -4,8 +4,7 @@ namespace Bandwidth.Standard.Model.Bxml.Verbs { /// - /// BXML tag to represent a SIP URI for the transfer verb. - /// + /// BXML tag to represent a SIP URI for the transfer or refer verb. /// public class SipUri : IVerb { @@ -16,7 +15,7 @@ public class SipUri : IVerb public string Uri { get; set; } /// - /// (optional) The value of the User-To-User header to send within the initial INVITE. + /// (optional, transfer only) The value of the User-To-User header to send within the initial INVITE. /// [XmlAttribute("uui")] public string Uui { get; set; }