From: Richard Whitehouse Date: Sun, 29 Oct 2017 18:31:56 +0000 (+0000) Subject: Support In-Reply-To header X-Git-Url: https://git.richardwhiuk.com/?a=commitdiff_plain;h=86205550fd052afae9bb3c9373c781cfcfe4a247;p=rust-sip.git Support In-Reply-To header --- diff --git a/src/codec.rs b/src/codec.rs index 8a17c2f..42a39b5 100644 --- a/src/codec.rs +++ b/src/codec.rs @@ -438,7 +438,8 @@ mod tests { MESSAGE\r\nDate:Sat, 13 Nov 2010 23:29:00 \ GMT\r\nError-Info:\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)| { diff --git a/src/parser.rs b/src/parser.rs index 7216409..dec4600 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -748,13 +748,15 @@ named!(authorization_header, preceded!( tag!(b"Authorization:"), credentials)); +named!(call_id, tuple!( + word, + opt!(preceded!( + tag!(b"@"), + word)))); + named!(call_id_header, preceded!( alt!(tag!(b"Call-ID:") | tag!(b"i")), - tuple!( - word, - opt!(preceded!( - tag!(b"@"), - word))))); + call_id)); named!(purpose, alt!( tag!(b"icon") => { |_| Purpose::Icon } | @@ -952,6 +954,12 @@ named!(from_header, preceded!( tag!(b";"), from_param))))); +named!(in_reply_to_header>, preceded!( + tag!(b"In-Reply-To:"), + separated_nonempty_list!( + tag!(","), + call_id))); + named!(pub header
, alt!( // RFC 3261 Headers accept_header => { |a| Header::Accept(a) } | @@ -973,5 +981,6 @@ named!(pub 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) } )); diff --git a/src/types.rs b/src/types.rs index 1afad38..b076daa 100644 --- a/src/types.rs +++ b/src/types.rs @@ -363,6 +363,7 @@ pub enum Header { ErrorInfo(Vec), Expires(u32), From(From), + InReplyTo(Vec), To(Uri), Extension { name: String, value: String }, }