kurotych / sipcore Goto Github PK
View Code? Open in Web Editor NEWRust framework for creating SIP applications
License: MIT License
Rust framework for creating SIP applications
License: MIT License
vstr field - This is header value from start until parameters or end of value ( not includes parameters )
Spaces at the end of value should be trimmed
https://tools.ietf.org/html/rfc3261#section-7.3.1
The following groups of header field rows are valid and equivalent:
Route: <sip:[email protected]>
Subject: Lunch
Route: <sip:[email protected]>
Route: <sip:[email protected]>
Route: <sip:[email protected]>, <sip:[email protected]>
Route: <sip:[email protected]>
Subject: Lunch
Subject: Lunch
Route: <sip:[email protected]>, <sip:[email protected]>,
<sip:[email protected]>
Implement sipuri.rs module
https://tools.ietf.org/html/rfc3261#section-19.1
https://tools.ietf.org/html/rfc3261#section-25
Example SIP and SIPS URIs ( Unit test stuff )
sip:[email protected]
sip:alice:[email protected];transport=tcp
sips:[email protected]?subject=project%20x&priority=urgent
sip:+1-212-555-1212:[email protected];user=phone
sips:[email protected]
sip:[email protected]
sip:atlanta.com;method=REGISTER?to=alice%40atlanta.com
sip:alice;day=[email protected]
For headers comparing, at least.
When comparing header fields, field names are always case-
insensitive. Unless otherwise stated in the definition of a
particular header field, field values, parameter names, and parameter
values are case-insensitive. Tokens are always case-insensitive.
Unless specified otherwise, values expressed as quoted strings are
case-sensitive. For example,
Contact: <sip:[email protected]>;expires=3600
is equivalent to
CONTACT: <sip:[email protected]>;ExPiReS=3600
and
Content-Disposition: session;handling=optional
is equivalent to
content-disposition: Session;HANDLING=OPTIONAL
The following two header fields are not equivalent:
Warning: 370 devnull "Choose a bigger pipe"
Warning: 370 devnull "CHOOSE A BIGGER PIPE"
Refs:
https://github.com/seanmonstar/unicase/
https://docs.rs/unicase/2.6.0/unicase/
https://tools.ietf.org/html/rfc3261#section-7.3.1
Hi
I'd like to use it on stable. Is it something that can be done?
absoluteURI = scheme ":" ( hier-part / opaque-part )
Also, replace URI in RequestLine according to RFC3261:
pub uri: SipUri<'a>,
to
pub uri: RequestURI <'a>,
Request-URI = SIP-URI / SIPS-URI / absoluteURI
Replace is_digit() functions from bnfcore.rs to nom::character::is_digit;
Make parsing headers according to each definition from https://tools.ietf.org/html/rfc3261#section-25
message-header = (Accept
/ Accept-Encoding
/ Accept-Language
/ Alert-Info
/ Allow
/ Authentication-Info
/ Authorization
/ Call-ID
/ Call-Info
/ Contact
/ Content-Disposition
/ Content-Encoding
/ Content-Language
/ Content-Length
/ Content-Type
/ CSeq
/ Date
/ Error-Info
/ Expires
/ From
/ In-Reply-To
/ Max-Forwards
/ MIME-Version
/ Min-Expires
/ Organization
/ Priority
/ Proxy-Authenticate
/ Proxy-Authorization
/ Proxy-Require
/ Record-Route
/ Reply-To
/ Require
/ Retry-After
/ Route
/ Server
/ Subject
/ Supported
/ Timestamp
/ To
/ Unsupported
/ User-Agent
/ Via
/ Warning
/ WWW-Authenticate
/ extension-header) CRLF
https://doc.rust-lang.org/1.29.1/core/iter/index.html
Start iteration should from top of sip message. The RFC headers first, extensions after
in some possible invalid input this causes panic
thread 'tokio-runtime-worker' panicked at 'called `Result::unwrap()` on an `Err` value: Error(SipParseError { code: 1, message: Some("take_until_nonescaped_quote error!") })'
better propagate like the rest of code in GenericParam
generic-param = token [ EQUAL gen-value ]
In some SIP samples from Wireshark project contained the following UA :
User-Agent: <Motorola VT1000 mac: 000CE5C74EF8 sw:VT20_02.03.00_A ln:0 cfg:1253778536520/1002173358>
This fails because quot cases not handled, maybe :
if tmp_input[0] == b'<' {
let (input, _) = take_sws_token::laquot(tmp_input)?;
let (input, _) = take_until(">")(input)?;
let (input, _) = take_sws_token::raquot(input)?;
tmp_input = input;
continue;
}
Create a markdown table for vtype => vtags (one to many) and post to documentation
Create parameters.rs file for parsing header parameters fields into a container.
For example Via == v
Via = ( "Via" / "v" ) HCOLON via-parm *(COMMA via-parm)
Fill vtype and vtags value during parsing raw data.
Add test cases from https://tools.ietf.org/html/rfc5118
Fix bugs if it'll happen.
See example: https://github.com/armatusmiles/sipcore/blob/master/crates/sipmsg/tests/rfc4475.rs
It seems useless. I don't remember why i did it
use crate::common::errorparse::SipParseError;
pub trait NomParser<'a> {
type ParseResult;
fn parse(input: &'a [u8]) -> nom::IResult<&[u8], Self::ParseResult, SipParseError>;
}
Add support quoted string and host.
Currently, parsing fail with
+sip.instance="<urn:uuid:00000000-0000-1000-8000-000A95A0E128>"
The Code coverage report is broken.
See the travis build
Improve parse
function in parameters.rs
Make strict parsing according sip bnf rule: generic-param = token [ EQUAL gen-value ]
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.