test/test_sip_parser.rb in oversip-1.1.0.beta5 vs test/test_sip_parser.rb in oversip-1.1.0

- old
+ new

@@ -37,21 +37,28 @@ def test_parse_sip_invite parser, msg = parse <<-END INVITE sip:sips%3Auser%40example.com@example.NET.;transport=tcp;FOO=baz?Subject=lalala SIP/2.0\r via: SIP/2.0/UDP host5.example.net;branch=z9hG4bKkdjuw ; Rport\r +v: SIP/2.0/TCP 1.2.3.4;branch=z9hG4bKkdjuw\r To: <tel:+(34)-94-499-44-22;lalala=lololo>\r from: <sips:I%20have%20spaces@[2001:123:Ab:0:0::123]:9999> ;\r tag=938\r Route: <sip:qweqwe/.+asdasd@1.2.3.4:7777;LR;ob>,\r "Server Ñ€áéíóú" <SIP:[01::000:A0f]:6666;lr>\r Max-Forwards: 87\r _i: esc01.239409asdfakjkn23onasd0-3234\r CSeq: 234234 INVITE\r C: application/sdp\r +Require: AAA, Bbb\r +Require: ccc\r +Proxy-Require: AAA, Bbb\r +Proxy-Require: ccc\r +Supported: AAA, Bbb\r +k: ccc\r Contact:\r - <sip:cal%6Cer@host5.example.net;%6C%72;n%61me=v%61lue%25%34%31>\r + <sip:cal%6Cer@host5.example.net;%6C%72;n%61me=v%61lue%25%34%31;ob>;p1=foo;P2=BAR;+sip-instance=qweqwe;reg-id=1\r Content-Length: 150\r \r v=0\r o=mhandley 29739 7272939 IN IP4 192.0.2.1\r s=-\r @@ -68,17 +75,18 @@ assert_true msg.initial? assert_false parser.duplicated_core_header? assert_equal parser.missing_core_header?, "Call-ID" - assert_equal msg.num_vias, 1 + assert_equal msg.num_vias, 2 assert_equal msg.via_sent_by_host, "host5.example.net" assert_nil msg.via_sent_by_port assert_nil msg.via_received assert_true msg.via_rport? assert_equal msg.via_core_value, "SIP/2.0/UDP host5.example.net" assert_nil msg.via_params + assert_equal ["SIP/2.0/UDP host5.example.net;branch=z9hG4bKkdjuw ; Rport", "SIP/2.0/TCP 1.2.3.4;branch=z9hG4bKkdjuw"], msg.hdr_via assert_equal msg.cseq, 234234 assert_equal msg.max_forwards, 87 assert_equal msg.content_length, 150 assert_equal msg.body.bytesize, 150 @@ -112,11 +120,14 @@ assert_equal :sip, msg.contact.scheme assert_equal "caller", msg.contact.user assert_equal "host5.example.net", msg.contact.host assert_equal :domain, msg.contact.host_type assert_nil msg.contact.port - assert_equal({"%6c%72" => nil, "n%61me" => "v%61lue%25%34%31"}, msg.contact.params) + assert_true msg.contact.ob_param? + assert_equal({"%6c%72" => nil, "n%61me" => "v%61lue%25%34%31", "ob" => nil}, msg.contact.params) + assert_equal ";p1=foo;P2=BAR;+sip-instance=qweqwe;reg-id=1", msg.contact_params + assert_true msg.contact_reg_id? assert_equal 2, msg.routes.size assert_nil msg.routes.first.display_name assert_equal :sip, msg.routes.first.scheme @@ -132,8 +143,12 @@ assert_nil msg.routes[1].user assert OverSIP::Utils.compare_ips("[1::a0f]", msg.routes[1].host) assert_equal :ipv6_reference, msg.routes[1].host_type assert_equal 6666, msg.routes[1].port assert_true msg.routes[1].lr_param? + + assert_equal ["aaa", "bbb", "ccc"], msg.require + assert_equal ["aaa", "bbb", "ccc"], msg.proxy_require + assert_equal ["aaa", "bbb", "ccc"], msg.supported end end