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

index 8a17c2fb188ed4ffc91613edb31c066658644358..42a39b5dc2906ca7b29b1b8e941430dce9e28330 100644 (file)
@@ -438,7 +438,8 @@ mod tests {
                            MESSAGE\r\nDate:Sat, 13 Nov 2010 23:29:00 \
                            GMT\r\nError-Info:<sip:not-in-service-recording@atlanta.\
                            com>\r\nExpires:30\r\nFrom:sip:+12125551212@server.phone2net.com;\
-                           tag=887s\r\nVia: localhost\r\n\r\n")
+                           tag=887s\r\nIn-Reply-To:70710@saturn.bell-tel.com,17320@saturn.\
+                           bell-tel.com\r\nVia: localhost\r\n\r\n")
         });
 
         let finished = request.and_then(|(socket, _request)| {
index 7216409eeb3a7f30859c45d33c392e52e17e6eab..dec4600142c9ffe2798f5acfd0820d972f1b0e14 100644 (file)
@@ -748,13 +748,15 @@ named!(authorization_header<Credentials>, preceded!(
        tag!(b"Authorization:"),
        credentials));
 
+named!(call_id<CallId>, tuple!(
+       word,
+       opt!(preceded!(
+               tag!(b"@"),
+               word))));
+
 named!(call_id_header<CallId>, preceded!(
        alt!(tag!(b"Call-ID:") | tag!(b"i")),
-       tuple!(
-               word,
-               opt!(preceded!(
-                       tag!(b"@"),
-                       word)))));
+       call_id));
 
 named!(purpose<Purpose>, alt!(
        tag!(b"icon") => { |_| Purpose::Icon } |
@@ -952,6 +954,12 @@ named!(from_header<From>, preceded!(
                        tag!(b";"),
                        from_param)))));
 
+named!(in_reply_to_header<Vec<CallId>>, preceded!(
+       tag!(b"In-Reply-To:"),
+       separated_nonempty_list!(
+               tag!(","),
+               call_id)));
+
 named!(pub header<Header>, alt!(
 // RFC 3261 Headers
        accept_header => { |a| Header::Accept(a) } |
@@ -973,5 +981,6 @@ named!(pub header<Header>, alt!(
        date_header => { |d| Header::Date(d) } |
        error_info_header => { |e| Header::ErrorInfo(e) } |
        expires_header => { |e| Header::Expires(e) } |
-       from_header => { |f| Header::From(f) }
+       from_header => { |f| Header::From(f) } |
+       in_reply_to_header => { |i| Header::InReplyTo(i) }
 ));
index 1afad387b2a416609e3d7e7d81fc0ed3aa61c27b..b076daa7aed681a8c1ff00a5225d96501b1dd1d2 100644 (file)
@@ -363,6 +363,7 @@ pub enum Header {
     ErrorInfo(Vec<ErrorUri>),
     Expires(u32),
     From(From),
+    InReplyTo(Vec<CallId>),
     To(Uri),
     Extension { name: String, value: String },
 }