Support Reply-To header
authorRichard Whitehouse <github@richardwhiuk.com>
Sun, 29 Oct 2017 20:56:58 +0000 (20:56 +0000)
committerRichard Whitehouse <github@richardwhiuk.com>
Sun, 29 Oct 2017 20:56:58 +0000 (20:56 +0000)
src/codec.rs
src/lib.rs
src/parser.rs
src/types.rs

index c28439bea83c4313d91be518a64a6602ac40d283..f6c4ab942e4071aba28b951451e925789f73cf7e 100644 (file)
@@ -443,7 +443,7 @@ mod tests {
                            30\r\nOrganization:Foobar\r\nPriority:normal\r\nProxy-Authenticate:\
                            Digest realm=\"atlanta.com\"\r\nProxy-Authorization:Digest \
                            username=\"Bob\"\r\nProxy-Require:foo\r\nRecord-Route:<sip:server10.\
-                           biloxi.com;lr>\r\nVia: localhost\r\n\r\n")
+                           biloxi.com;lr>\r\nReply-To:<sip:bob@biloxi.com>\r\nVia: localhost\r\n\r\n")
         });
 
         let finished = request.and_then(|(socket, _request)| {
index 974d78e7e8f69fc345d55ad828791f6703652141..5418383308dbd931dcc1869206a18631bda9993f 100644 (file)
@@ -1,3 +1,5 @@
+#![recursion_limit="128"]
+
 extern crate futures;
 extern crate tokio_core;
 extern crate tokio_io;
index 45dc9efb40c3b5136a3c317dd4df927504f3ba3f..f36c8cc85924d88ab6d73eb647c653d642a2f6ff 100644 (file)
@@ -17,7 +17,7 @@ use types::{PathSegment, HostPort, Host, Hostname, UriParameter, UriHeader, UriH
             Credentials, CallId, Purpose, InfoParam, Info, NameAddr, ContactParam, Target,
             Contact, DispositionType, Handling, DispositionParam, ContentCoding, Day, Month, Date,
             Time, DateTime, ErrorUri, FromParam, From, Priority, Domain, DigestChallenge,
-            Challenge, OptionTag, Route};
+            Challenge, OptionTag, Route, ReplyTo};
 
 fn is_mark(c: u8) -> bool {
     c == b'-' || c == b'_' || c == b'.' || c == b'!' || c == b'~' || c == b'*' || c == b'\'' ||
@@ -1055,6 +1055,18 @@ named!(record_route_header<Vec<Route>>, preceded!(
                tag!(b","),
                route)));
 
+named!(reply_to<ReplyTo>, pair!(
+       target,
+       many0!(preceded!(
+               tag!(b";"),
+               generic_param))));
+
+named!(reply_to_header<Vec<ReplyTo>>, preceded!(
+       tag!(b"Reply-To:"),
+       separated_nonempty_list!(
+               tag!(b","),
+               reply_to)));
+
 named!(pub header<Header>, alt!(
 // RFC 3261 Headers
        accept_header => { |a| Header::Accept(a) } |
@@ -1086,5 +1098,6 @@ named!(pub header<Header>, alt!(
        proxy_authenticate_header => { |p| Header::ProxyAuthenticate(p) } |
        proxy_authorization_header => { |p| Header::ProxyAuthorization(p) } |
        proxy_require_header => { |p| Header::ProxyRequire(p) } |
-       record_route_header => { |r| Header::RecordRoute(r) }
+       record_route_header => { |r| Header::RecordRoute(r) } |
+       reply_to_header => { |r| Header::ReplyTo(r) }
 ));
index 2b4a2a17922aabde671a475ad50f8840b8e7ca8a..f2c3eb92b9c8a8d2479fec114d74335d05e159ec 100644 (file)
@@ -377,6 +377,8 @@ pub type OptionTag = Vec<u8>;
 
 pub type Route = (NameAddr, Vec<GenericParam>);
 
+pub type ReplyTo = (Target, Vec<GenericParam>);
+
 #[derive(Debug)]
 pub enum Header {
     Accept(Vec<AcceptRange>),
@@ -409,6 +411,7 @@ pub enum Header {
     ProxyAuthorization(Credentials),
     ProxyRequire(Vec<OptionTag>),
     RecordRoute(Vec<Route>),
+    ReplyTo(Vec<ReplyTo>),
     To(Uri),
     Extension { name: String, value: String },
 }