From e589002ddb488beaa4c6ee83403b028fd01e9bf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Luis=20Mill=C3=A1n?= Date: Mon, 28 Jan 2013 17:31:06 +0100 Subject: [PATCH] Fix. Allow case-insentivity in SIP grammar, when corresponds Make header values, parameter names and parameter values case-insensitive --- src/grammar/dist/grammar.js | 300 +++++++++++++++++----------------- src/grammar/src/grammar.pegjs | 94 +++++------ 2 files changed, 197 insertions(+), 197 deletions(-) diff --git a/src/grammar/dist/grammar.js b/src/grammar/dist/grammar.js index a896d2071..46bcac4d9 100644 --- a/src/grammar/dist/grammar.js +++ b/src/grammar/dist/grammar.js @@ -2972,8 +2972,8 @@ JsSIP.grammar = (function(){ var pos0; pos0 = pos; - if (input.substr(pos, 3) === "sip") { - result0 = "sip"; + if (input.substr(pos, 3).toLowerCase() === "sip") { + result0 = input.substr(pos, 3); pos += 3; } else { result0 = null; @@ -5629,8 +5629,8 @@ JsSIP.grammar = (function(){ pos0 = pos; pos1 = pos; - if (input.substr(pos, 10) === "transport=") { - result0 = "transport="; + if (input.substr(pos, 10).toLowerCase() === "transport=") { + result0 = input.substr(pos, 10); pos += 10; } else { result0 = null; @@ -5639,8 +5639,8 @@ JsSIP.grammar = (function(){ } } if (result0 !== null) { - if (input.substr(pos, 3) === "udp") { - result1 = "udp"; + if (input.substr(pos, 3).toLowerCase() === "udp") { + result1 = input.substr(pos, 3); pos += 3; } else { result1 = null; @@ -5649,8 +5649,8 @@ JsSIP.grammar = (function(){ } } if (result1 === null) { - if (input.substr(pos, 3) === "tcp") { - result1 = "tcp"; + if (input.substr(pos, 3).toLowerCase() === "tcp") { + result1 = input.substr(pos, 3); pos += 3; } else { result1 = null; @@ -5659,8 +5659,8 @@ JsSIP.grammar = (function(){ } } if (result1 === null) { - if (input.substr(pos, 4) === "sctp") { - result1 = "sctp"; + if (input.substr(pos, 4).toLowerCase() === "sctp") { + result1 = input.substr(pos, 4); pos += 4; } else { result1 = null; @@ -5669,8 +5669,8 @@ JsSIP.grammar = (function(){ } } if (result1 === null) { - if (input.substr(pos, 3) === "tls") { - result1 = "tls"; + if (input.substr(pos, 3).toLowerCase() === "tls") { + result1 = input.substr(pos, 3); pos += 3; } else { result1 = null; @@ -5711,8 +5711,8 @@ JsSIP.grammar = (function(){ pos0 = pos; pos1 = pos; - if (input.substr(pos, 5) === "user=") { - result0 = "user="; + if (input.substr(pos, 5).toLowerCase() === "user=") { + result0 = input.substr(pos, 5); pos += 5; } else { result0 = null; @@ -5721,8 +5721,8 @@ JsSIP.grammar = (function(){ } } if (result0 !== null) { - if (input.substr(pos, 5) === "phone") { - result1 = "phone"; + if (input.substr(pos, 5).toLowerCase() === "phone") { + result1 = input.substr(pos, 5); pos += 5; } else { result1 = null; @@ -5731,8 +5731,8 @@ JsSIP.grammar = (function(){ } } if (result1 === null) { - if (input.substr(pos, 2) === "ip") { - result1 = "ip"; + if (input.substr(pos, 2).toLowerCase() === "ip") { + result1 = input.substr(pos, 2); pos += 2; } else { result1 = null; @@ -5771,8 +5771,8 @@ JsSIP.grammar = (function(){ pos0 = pos; pos1 = pos; - if (input.substr(pos, 7) === "method=") { - result0 = "method="; + if (input.substr(pos, 7).toLowerCase() === "method=") { + result0 = input.substr(pos, 7); pos += 7; } else { result0 = null; @@ -5809,8 +5809,8 @@ JsSIP.grammar = (function(){ pos0 = pos; pos1 = pos; - if (input.substr(pos, 4) === "ttl=") { - result0 = "ttl="; + if (input.substr(pos, 4).toLowerCase() === "ttl=") { + result0 = input.substr(pos, 4); pos += 4; } else { result0 = null; @@ -5847,8 +5847,8 @@ JsSIP.grammar = (function(){ pos0 = pos; pos1 = pos; - if (input.substr(pos, 6) === "maddr=") { - result0 = "maddr="; + if (input.substr(pos, 6).toLowerCase() === "maddr=") { + result0 = input.substr(pos, 6); pos += 6; } else { result0 = null; @@ -5884,8 +5884,8 @@ JsSIP.grammar = (function(){ var pos0; pos0 = pos; - if (input.substr(pos, 2) === "lr") { - result0 = "lr"; + if (input.substr(pos, 2).toLowerCase() === "lr") { + result0 = input.substr(pos, 2); pos += 2; } else { result0 = null; @@ -7325,8 +7325,8 @@ JsSIP.grammar = (function(){ pos0 = pos; pos1 = pos; - if (input.substr(pos, 3) === "SIP") { - result0 = "SIP"; + if (input.substr(pos, 3).toLowerCase() === "sip") { + result0 = input.substr(pos, 3); pos += 3; } else { result0 = null; @@ -8056,8 +8056,8 @@ JsSIP.grammar = (function(){ pos0 = pos; pos1 = pos; - if (input.charCodeAt(pos) === 113) { - result0 = "q"; + if (input.substr(pos, 1).toLowerCase() === "q") { + result0 = input.substr(pos, 1); pos++; } else { result0 = null; @@ -8100,8 +8100,8 @@ JsSIP.grammar = (function(){ pos0 = pos; pos1 = pos; - if (input.substr(pos, 7) === "expires") { - result0 = "expires"; + if (input.substr(pos, 7).toLowerCase() === "expires") { + result0 = input.substr(pos, 7); pos += 7; } else { result0 = null; @@ -8374,8 +8374,8 @@ JsSIP.grammar = (function(){ function parse_disp_type() { var result0; - if (input.substr(pos, 6) === "render") { - result0 = "render"; + if (input.substr(pos, 6).toLowerCase() === "render") { + result0 = input.substr(pos, 6); pos += 6; } else { result0 = null; @@ -8384,8 +8384,8 @@ JsSIP.grammar = (function(){ } } if (result0 === null) { - if (input.substr(pos, 7) === "session") { - result0 = "session"; + if (input.substr(pos, 7).toLowerCase() === "session") { + result0 = input.substr(pos, 7); pos += 7; } else { result0 = null; @@ -8394,8 +8394,8 @@ JsSIP.grammar = (function(){ } } if (result0 === null) { - if (input.substr(pos, 4) === "icon") { - result0 = "icon"; + if (input.substr(pos, 4).toLowerCase() === "icon") { + result0 = input.substr(pos, 4); pos += 4; } else { result0 = null; @@ -8404,8 +8404,8 @@ JsSIP.grammar = (function(){ } } if (result0 === null) { - if (input.substr(pos, 5) === "alert") { - result0 = "alert"; + if (input.substr(pos, 5).toLowerCase() === "alert") { + result0 = input.substr(pos, 5); pos += 5; } else { result0 = null; @@ -8437,8 +8437,8 @@ JsSIP.grammar = (function(){ var pos0; pos0 = pos; - if (input.substr(pos, 8) === "handling") { - result0 = "handling"; + if (input.substr(pos, 8).toLowerCase() === "handling") { + result0 = input.substr(pos, 8); pos += 8; } else { result0 = null; @@ -8449,8 +8449,8 @@ JsSIP.grammar = (function(){ if (result0 !== null) { result1 = parse_EQUAL(); if (result1 !== null) { - if (input.substr(pos, 8) === "optional") { - result2 = "optional"; + if (input.substr(pos, 8).toLowerCase() === "optional") { + result2 = input.substr(pos, 8); pos += 8; } else { result2 = null; @@ -8459,8 +8459,8 @@ JsSIP.grammar = (function(){ } } if (result2 === null) { - if (input.substr(pos, 8) === "required") { - result2 = "required"; + if (input.substr(pos, 8).toLowerCase() === "required") { + result2 = input.substr(pos, 8); pos += 8; } else { result2 = null; @@ -8659,8 +8659,8 @@ JsSIP.grammar = (function(){ function parse_discrete_type() { var result0; - if (input.substr(pos, 4) === "text") { - result0 = "text"; + if (input.substr(pos, 4).toLowerCase() === "text") { + result0 = input.substr(pos, 4); pos += 4; } else { result0 = null; @@ -8669,8 +8669,8 @@ JsSIP.grammar = (function(){ } } if (result0 === null) { - if (input.substr(pos, 5) === "image") { - result0 = "image"; + if (input.substr(pos, 5).toLowerCase() === "image") { + result0 = input.substr(pos, 5); pos += 5; } else { result0 = null; @@ -8679,8 +8679,8 @@ JsSIP.grammar = (function(){ } } if (result0 === null) { - if (input.substr(pos, 5) === "audio") { - result0 = "audio"; + if (input.substr(pos, 5).toLowerCase() === "audio") { + result0 = input.substr(pos, 5); pos += 5; } else { result0 = null; @@ -8689,8 +8689,8 @@ JsSIP.grammar = (function(){ } } if (result0 === null) { - if (input.substr(pos, 5) === "video") { - result0 = "video"; + if (input.substr(pos, 5).toLowerCase() === "video") { + result0 = input.substr(pos, 5); pos += 5; } else { result0 = null; @@ -8699,8 +8699,8 @@ JsSIP.grammar = (function(){ } } if (result0 === null) { - if (input.substr(pos, 11) === "application") { - result0 = "application"; + if (input.substr(pos, 11).toLowerCase() === "application") { + result0 = input.substr(pos, 11); pos += 11; } else { result0 = null; @@ -8721,8 +8721,8 @@ JsSIP.grammar = (function(){ function parse_composite_type() { var result0; - if (input.substr(pos, 7) === "message") { - result0 = "message"; + if (input.substr(pos, 7).toLowerCase() === "message") { + result0 = input.substr(pos, 7); pos += 7; } else { result0 = null; @@ -8731,8 +8731,8 @@ JsSIP.grammar = (function(){ } } if (result0 === null) { - if (input.substr(pos, 9) === "multipart") { - result0 = "multipart"; + if (input.substr(pos, 9).toLowerCase() === "multipart") { + result0 = input.substr(pos, 9); pos += 9; } else { result0 = null; @@ -8762,8 +8762,8 @@ JsSIP.grammar = (function(){ var pos0; pos0 = pos; - if (input.substr(pos, 2) === "x-") { - result0 = "x-"; + if (input.substr(pos, 2).toLowerCase() === "x-") { + result0 = input.substr(pos, 2); pos += 2; } else { result0 = null; @@ -9121,8 +9121,8 @@ JsSIP.grammar = (function(){ pos0 = pos; pos1 = pos; - if (input.substr(pos, 3) === "tag") { - result0 = "tag"; + if (input.substr(pos, 3).toLowerCase() === "tag") { + result0 = input.substr(pos, 3); pos += 3; } else { result0 = null; @@ -9209,8 +9209,8 @@ JsSIP.grammar = (function(){ var pos0, pos1; pos0 = pos; - if (input.substr(pos, 6) === "Digest") { - result0 = "Digest"; + if (input.substr(pos, 6).toLowerCase() === "digest") { + result0 = input.substr(pos, 6); pos += 6; } else { result0 = null; @@ -9406,8 +9406,8 @@ JsSIP.grammar = (function(){ var pos0; pos0 = pos; - if (input.substr(pos, 5) === "realm") { - result0 = "realm"; + if (input.substr(pos, 5).toLowerCase() === "realm") { + result0 = input.substr(pos, 5); pos += 5; } else { result0 = null; @@ -9456,8 +9456,8 @@ JsSIP.grammar = (function(){ var pos0, pos1; pos0 = pos; - if (input.substr(pos, 6) === "domain") { - result0 = "domain"; + if (input.substr(pos, 6).toLowerCase() === "domain") { + result0 = input.substr(pos, 6); pos += 6; } else { result0 = null; @@ -9568,8 +9568,8 @@ JsSIP.grammar = (function(){ var pos0; pos0 = pos; - if (input.substr(pos, 5) === "nonce") { - result0 = "nonce"; + if (input.substr(pos, 5).toLowerCase() === "nonce") { + result0 = input.substr(pos, 5); pos += 5; } else { result0 = null; @@ -9619,8 +9619,8 @@ JsSIP.grammar = (function(){ pos0 = pos; pos1 = pos; - if (input.substr(pos, 6) === "opaque") { - result0 = "opaque"; + if (input.substr(pos, 6).toLowerCase() === "opaque") { + result0 = input.substr(pos, 6); pos += 6; } else { result0 = null; @@ -9662,8 +9662,8 @@ JsSIP.grammar = (function(){ pos0 = pos; pos1 = pos; - if (input.substr(pos, 5) === "stale") { - result0 = "stale"; + if (input.substr(pos, 5).toLowerCase() === "stale") { + result0 = input.substr(pos, 5); pos += 5; } else { result0 = null; @@ -9674,8 +9674,8 @@ JsSIP.grammar = (function(){ if (result0 !== null) { result1 = parse_EQUAL(); if (result1 !== null) { - if (input.substr(pos, 4) === "true") { - result2 = "true"; + if (input.substr(pos, 4).toLowerCase() === "true") { + result2 = input.substr(pos, 4); pos += 4; } else { result2 = null; @@ -9684,8 +9684,8 @@ JsSIP.grammar = (function(){ } } if (result2 === null) { - if (input.substr(pos, 5) === "false") { - result2 = "false"; + if (input.substr(pos, 5).toLowerCase() === "false") { + result2 = input.substr(pos, 5); pos += 5; } else { result2 = null; @@ -9724,8 +9724,8 @@ JsSIP.grammar = (function(){ pos0 = pos; pos1 = pos; - if (input.substr(pos, 9) === "algorithm") { - result0 = "algorithm"; + if (input.substr(pos, 9).toLowerCase() === "algorithm") { + result0 = input.substr(pos, 9); pos += 9; } else { result0 = null; @@ -9736,8 +9736,8 @@ JsSIP.grammar = (function(){ if (result0 !== null) { result1 = parse_EQUAL(); if (result1 !== null) { - if (input.substr(pos, 3) === "MD5") { - result2 = "MD5"; + if (input.substr(pos, 3).toLowerCase() === "md5") { + result2 = input.substr(pos, 3); pos += 3; } else { result2 = null; @@ -9746,8 +9746,8 @@ JsSIP.grammar = (function(){ } } if (result2 === null) { - if (input.substr(pos, 8) === "MD5-sess") { - result2 = "MD5-sess"; + if (input.substr(pos, 8).toLowerCase() === "md5-sess") { + result2 = input.substr(pos, 8); pos += 8; } else { result2 = null; @@ -9789,8 +9789,8 @@ JsSIP.grammar = (function(){ pos0 = pos; pos1 = pos; - if (input.substr(pos, 3) === "qop") { - result0 = "qop"; + if (input.substr(pos, 3).toLowerCase() === "qop") { + result0 = input.substr(pos, 3); pos += 3; } else { result0 = null; @@ -9901,8 +9901,8 @@ JsSIP.grammar = (function(){ function parse_qop_value() { var result0; - if (input.substr(pos, 8) === "auth-int") { - result0 = "auth-int"; + if (input.substr(pos, 8).toLowerCase() === "auth-int") { + result0 = input.substr(pos, 8); pos += 8; } else { result0 = null; @@ -9911,8 +9911,8 @@ JsSIP.grammar = (function(){ } } if (result0 === null) { - if (input.substr(pos, 4) === "auth") { - result0 = "auth"; + if (input.substr(pos, 4).toLowerCase() === "auth") { + result0 = input.substr(pos, 4); pos += 4; } else { result0 = null; @@ -10296,8 +10296,8 @@ JsSIP.grammar = (function(){ var pos0; pos0 = pos; - if (input.substr(pos, 6) === "active") { - result0 = "active"; + if (input.substr(pos, 6).toLowerCase() === "active") { + result0 = input.substr(pos, 6); pos += 6; } else { result0 = null; @@ -10306,8 +10306,8 @@ JsSIP.grammar = (function(){ } } if (result0 === null) { - if (input.substr(pos, 7) === "pending") { - result0 = "pending"; + if (input.substr(pos, 7).toLowerCase() === "pending") { + result0 = input.substr(pos, 7); pos += 7; } else { result0 = null; @@ -10316,8 +10316,8 @@ JsSIP.grammar = (function(){ } } if (result0 === null) { - if (input.substr(pos, 10) === "terminated") { - result0 = "terminated"; + if (input.substr(pos, 10).toLowerCase() === "terminated") { + result0 = input.substr(pos, 10); pos += 10; } else { result0 = null; @@ -10346,8 +10346,8 @@ JsSIP.grammar = (function(){ pos0 = pos; pos1 = pos; - if (input.substr(pos, 6) === "reason") { - result0 = "reason"; + if (input.substr(pos, 6).toLowerCase() === "reason") { + result0 = input.substr(pos, 6); pos += 6; } else { result0 = null; @@ -10383,8 +10383,8 @@ JsSIP.grammar = (function(){ if (result0 === null) { pos0 = pos; pos1 = pos; - if (input.substr(pos, 7) === "expires") { - result0 = "expires"; + if (input.substr(pos, 7).toLowerCase() === "expires") { + result0 = input.substr(pos, 7); pos += 7; } else { result0 = null; @@ -10420,8 +10420,8 @@ JsSIP.grammar = (function(){ if (result0 === null) { pos0 = pos; pos1 = pos; - if (input.substr(pos, 11) === "retry_after") { - result0 = "retry_after"; + if (input.substr(pos, 11).toLowerCase() === "retry_after") { + result0 = input.substr(pos, 11); pos += 11; } else { result0 = null; @@ -10477,8 +10477,8 @@ JsSIP.grammar = (function(){ function parse_event_reason_value() { var result0; - if (input.substr(pos, 11) === "deactivated") { - result0 = "deactivated"; + if (input.substr(pos, 11).toLowerCase() === "deactivated") { + result0 = input.substr(pos, 11); pos += 11; } else { result0 = null; @@ -10487,8 +10487,8 @@ JsSIP.grammar = (function(){ } } if (result0 === null) { - if (input.substr(pos, 9) === "probation") { - result0 = "probation"; + if (input.substr(pos, 9).toLowerCase() === "probation") { + result0 = input.substr(pos, 9); pos += 9; } else { result0 = null; @@ -10497,8 +10497,8 @@ JsSIP.grammar = (function(){ } } if (result0 === null) { - if (input.substr(pos, 8) === "rejected") { - result0 = "rejected"; + if (input.substr(pos, 8).toLowerCase() === "rejected") { + result0 = input.substr(pos, 8); pos += 8; } else { result0 = null; @@ -10507,8 +10507,8 @@ JsSIP.grammar = (function(){ } } if (result0 === null) { - if (input.substr(pos, 7) === "timeout") { - result0 = "timeout"; + if (input.substr(pos, 7).toLowerCase() === "timeout") { + result0 = input.substr(pos, 7); pos += 7; } else { result0 = null; @@ -10517,8 +10517,8 @@ JsSIP.grammar = (function(){ } } if (result0 === null) { - if (input.substr(pos, 6) === "giveup") { - result0 = "giveup"; + if (input.substr(pos, 6).toLowerCase() === "giveup") { + result0 = input.substr(pos, 6); pos += 6; } else { result0 = null; @@ -10527,8 +10527,8 @@ JsSIP.grammar = (function(){ } } if (result0 === null) { - if (input.substr(pos, 10) === "noresource") { - result0 = "noresource"; + if (input.substr(pos, 10).toLowerCase() === "noresource") { + result0 = input.substr(pos, 10); pos += 10; } else { result0 = null; @@ -10537,8 +10537,8 @@ JsSIP.grammar = (function(){ } } if (result0 === null) { - if (input.substr(pos, 9) === "invariant") { - result0 = "invariant"; + if (input.substr(pos, 9).toLowerCase() === "invariant") { + result0 = input.substr(pos, 9); pos += 9; } else { result0 = null; @@ -10828,8 +10828,8 @@ JsSIP.grammar = (function(){ pos0 = pos; pos1 = pos; - if (input.substr(pos, 3) === "ttl") { - result0 = "ttl"; + if (input.substr(pos, 3).toLowerCase() === "ttl") { + result0 = input.substr(pos, 3); pos += 3; } else { result0 = null; @@ -10871,8 +10871,8 @@ JsSIP.grammar = (function(){ pos0 = pos; pos1 = pos; - if (input.substr(pos, 5) === "maddr") { - result0 = "maddr"; + if (input.substr(pos, 5).toLowerCase() === "maddr") { + result0 = input.substr(pos, 5); pos += 5; } else { result0 = null; @@ -10914,8 +10914,8 @@ JsSIP.grammar = (function(){ pos0 = pos; pos1 = pos; - if (input.substr(pos, 8) === "received") { - result0 = "received"; + if (input.substr(pos, 8).toLowerCase() === "received") { + result0 = input.substr(pos, 8); pos += 8; } else { result0 = null; @@ -10960,8 +10960,8 @@ JsSIP.grammar = (function(){ pos0 = pos; pos1 = pos; - if (input.substr(pos, 6) === "branch") { - result0 = "branch"; + if (input.substr(pos, 6).toLowerCase() === "branch") { + result0 = input.substr(pos, 6); pos += 6; } else { result0 = null; @@ -11003,8 +11003,8 @@ JsSIP.grammar = (function(){ pos0 = pos; pos1 = pos; - if (input.substr(pos, 5) === "rport") { - result0 = "rport"; + if (input.substr(pos, 5).toLowerCase() === "rport") { + result0 = input.substr(pos, 5); pos += 5; } else { result0 = null; @@ -11098,8 +11098,8 @@ JsSIP.grammar = (function(){ var pos0; pos0 = pos; - if (input.substr(pos, 3) === "SIP") { - result0 = "SIP"; + if (input.substr(pos, 3).toLowerCase() === "sip") { + result0 = input.substr(pos, 3); pos += 3; } else { result0 = null; @@ -11125,8 +11125,8 @@ JsSIP.grammar = (function(){ var pos0; pos0 = pos; - if (input.substr(pos, 3) === "UDP") { - result0 = "UDP"; + if (input.substr(pos, 3).toLowerCase() === "udp") { + result0 = input.substr(pos, 3); pos += 3; } else { result0 = null; @@ -11135,8 +11135,8 @@ JsSIP.grammar = (function(){ } } if (result0 === null) { - if (input.substr(pos, 3) === "TCP") { - result0 = "TCP"; + if (input.substr(pos, 3).toLowerCase() === "tcp") { + result0 = input.substr(pos, 3); pos += 3; } else { result0 = null; @@ -11145,8 +11145,8 @@ JsSIP.grammar = (function(){ } } if (result0 === null) { - if (input.substr(pos, 3) === "TLS") { - result0 = "TLS"; + if (input.substr(pos, 3).toLowerCase() === "tls") { + result0 = input.substr(pos, 3); pos += 3; } else { result0 = null; @@ -11155,8 +11155,8 @@ JsSIP.grammar = (function(){ } } if (result0 === null) { - if (input.substr(pos, 4) === "SCTP") { - result0 = "SCTP"; + if (input.substr(pos, 4).toLowerCase() === "sctp") { + result0 = input.substr(pos, 4); pos += 4; } else { result0 = null; @@ -11436,8 +11436,8 @@ JsSIP.grammar = (function(){ var pos0; pos0 = pos; - if (input.substr(pos, 5) === "stuns") { - result0 = "stuns"; + if (input.substr(pos, 5).toLowerCase() === "stuns") { + result0 = input.substr(pos, 5); pos += 5; } else { result0 = null; @@ -11446,8 +11446,8 @@ JsSIP.grammar = (function(){ } } if (result0 === null) { - if (input.substr(pos, 4) === "stun") { - result0 = "stun"; + if (input.substr(pos, 4).toLowerCase() === "stun") { + result0 = input.substr(pos, 4); pos += 4; } else { result0 = null; @@ -11802,8 +11802,8 @@ JsSIP.grammar = (function(){ var pos0; pos0 = pos; - if (input.substr(pos, 5) === "turns") { - result0 = "turns"; + if (input.substr(pos, 5).toLowerCase() === "turns") { + result0 = input.substr(pos, 5); pos += 5; } else { result0 = null; @@ -11812,8 +11812,8 @@ JsSIP.grammar = (function(){ } } if (result0 === null) { - if (input.substr(pos, 4) === "turn") { - result0 = "turn"; + if (input.substr(pos, 4).toLowerCase() === "turn") { + result0 = input.substr(pos, 4); pos += 4; } else { result0 = null; @@ -11840,8 +11840,8 @@ JsSIP.grammar = (function(){ pos1 = pos; result0 = parse_transport(); if (result0 !== null) { - if (input.substr(pos, 3) === "udp") { - result1 = "udp"; + if (input.substr(pos, 3).toLowerCase() === "udp") { + result1 = input.substr(pos, 3); pos += 3; } else { result1 = null; @@ -11850,8 +11850,8 @@ JsSIP.grammar = (function(){ } } if (result1 === null) { - if (input.substr(pos, 3) === "tcp") { - result1 = "tcp"; + if (input.substr(pos, 3).toLowerCase() === "tcp") { + result1 = input.substr(pos, 3); pos += 3; } else { result1 = null; diff --git a/src/grammar/src/grammar.pegjs b/src/grammar/src/grammar.pegjs index c93e1580b..d330daa62 100644 --- a/src/grammar/src/grammar.pegjs +++ b/src/grammar/src/grammar.pegjs @@ -96,7 +96,7 @@ SIP_URI_simple = uri_scheme ":" userinfo ? hostport { SIP_URI = uri_scheme ":" userinfo ? hostport uri_parameters headers ? { data.uri = input.substring(pos, offset); } -uri_scheme = uri_scheme: "sip" { +uri_scheme = uri_scheme: "sip"i { data.scheme = uri_scheme; } userinfo = user (":" password)? "@" { @@ -174,32 +174,32 @@ uri_parameters = ( ";" uri_parameter)* uri_parameter = transport_param / user_param / method_param / ttl_param / maddr_param / lr_param / other_param -transport_param = "transport=" transport: ( "udp" / "tcp" / "sctp" - / "tls" / other_transport) { +transport_param = "transport="i transport: ( "udp"i / "tcp"i / "sctp"i + / "tls"i / other_transport) { if(!data.params) data.params={}; data.params['transport'] = transport; } other_transport = token -user_param = "user=" user:( "phone" / "ip" / other_user) { +user_param = "user="i user:( "phone"i / "ip"i / other_user) { if(!data.params) data.params={}; data.params['user'] = user; } other_user = token -method_param = "method=" method: Method { +method_param = "method="i method: Method { if(!data.params) data.params={}; data.params['method'] = method; } -ttl_param = "ttl=" ttl: ttl { +ttl_param = "ttl="i ttl: ttl { if(!data.params) data.params={}; data.params['ttl'] = ttl; } -maddr_param = "maddr=" maddr: host { +maddr_param = "maddr="i maddr: host { if(!data.params) data.params={}; data.params['maddr'] = maddr; } -lr_param = lr: "lr" { +lr_param = lr: "lr"i { if(!data.params) data.params={}; data.params['lr'] = true; } @@ -281,7 +281,7 @@ reg_name = ( unreserved / escaped / "$" / "," query = uric * -SIP_Version = "SIP" "/" DIGIT + "." DIGIT + { +SIP_Version = "SIP"i "/" DIGIT + "." DIGIT + { data.sip_version = input.substring(pos, offset); } // SIP METHODS @@ -355,11 +355,11 @@ display_name = display_name: (token ( LWS token )* / quoted_string) { contact_params = c_p_q / c_p_expires / contact_extension -c_p_q = "q" EQUAL q: qvalue { +c_p_q = "q"i EQUAL q: qvalue { if(!data.params) data.params = {}; data.params['q'] = q; } -c_p_expires = "expires" EQUAL expires: delta_seconds { +c_p_expires = "expires"i EQUAL expires: delta_seconds { if(!data.params) data.params = {}; data.params['expires'] = expires; } @@ -392,11 +392,11 @@ gen_value = token / host / quoted_string Content_Disposition = disp_type ( SEMI disp_param )* -disp_type = "render" / "session" / "icon" / "alert" / disp_extension_token +disp_type = "render"i / "session"i / "icon"i / "alert"i / disp_extension_token disp_param = handling_param / generic_param -handling_param = "handling" EQUAL ( "optional" / "required" / other_handling ) +handling_param = "handling"i EQUAL ( "optional"i / "required"i / other_handling ) other_handling = token @@ -424,16 +424,16 @@ media_type = m_type SLASH m_subtype (SEMI m_parameter)* m_type = discrete_type / composite_type -discrete_type = "text" / "image" / "audio" / "video" / "application" +discrete_type = "text"i / "image"i / "audio"i / "video"i / "application"i / extension_token -composite_type = "message" / "multipart" / extension_token +composite_type = "message"i / "multipart"i / extension_token extension_token = ietf_token / x_token ietf_token = token -x_token = "x-" token +x_token = "x-"i token m_subtype = extension_token / iana_token @@ -486,7 +486,7 @@ From = ( addr_spec_simple / name_addr ) ( SEMI from_param )* from_param = tag_param / generic_param -tag_param = "tag" EQUAL tag: token {data.tag = tag; } +tag_param = "tag"i EQUAL tag: token {data.tag = tag; } //MAX-FORWARDS @@ -504,7 +504,7 @@ Min_Expires = min_expires: delta_seconds {data = min_expires; } Proxy_Authenticate = proxy_authenticate: challenge -challenge = ("Digest" LWS digest_cln (COMMA digest_cln)*) +challenge = ("Digest"i LWS digest_cln (COMMA digest_cln)*) / other_challenge other_challenge = auth_scheme LWS auth_param (COMMA auth_param)* @@ -518,33 +518,33 @@ auth_param_name = token digest_cln = realm / domain / nonce / opaque / stale / algorithm / qop_options / auth_param -realm = "realm" EQUAL realm_value +realm = "realm"i EQUAL realm_value realm_value = realm: quoted_string {data.realm = realm; } -domain = "domain" EQUAL LDQUOT URI ( SP+ URI )* RDQUOT +domain = "domain"i EQUAL LDQUOT URI ( SP+ URI )* RDQUOT URI = absoluteURI / abs_path -nonce = "nonce" EQUAL nonce_value +nonce = "nonce"i EQUAL nonce_value nonce_value = nonce: quoted_string {data.nonce=nonce; } -opaque = "opaque" EQUAL opaque: quoted_string { +opaque = "opaque"i EQUAL opaque: quoted_string { data.opaque=opaque; } -stale = "stale" EQUAL stale: ( "true" / "false" ) { +stale = "stale"i EQUAL stale: ( "true"i / "false"i ) { data.stale=stale; } -algorithm = "algorithm" EQUAL algorithm: ( "MD5" / "MD5-sess" +algorithm = "algorithm"i EQUAL algorithm: ( "MD5"i / "MD5-sess"i / token ) { data.algorithm=algorithm; } -qop_options = "qop" EQUAL LDQUOT qop: (qop_value +qop_options = "qop"i EQUAL LDQUOT qop: (qop_value ("," qop_value)*) RDQUOT { data.qop= input.substring(pos-1, offset+5); } -qop_value = "auth-int" / "auth" / token +qop_value = "auth-int"i / "auth"i / token // PROXY-REQUIRE @@ -579,17 +579,17 @@ route_param = name_addr ( SEMI rr_param )* Subscription_State = substate_value ( SEMI subexp_params )* -substate_value = ( "active" / "pending" / "terminated" +substate_value = ( "active"i / "pending"i / "terminated"i / extension_substate ) { data.state = input.substring(pos, offset); } extension_substate = token -subexp_params = ("reason" EQUAL reason: event_reason_value) { +subexp_params = ("reason"i EQUAL reason: event_reason_value) { if (typeof reason !== 'undefined') data.reason = reason; } - / ("expires" EQUAL expires: delta_seconds) { + / ("expires"i EQUAL expires: delta_seconds) { if (typeof expires !== 'undefined') data.expires = expires; } - / ("retry_after" EQUAL retry_after: delta_seconds) { + / ("retry_after"i EQUAL retry_after: delta_seconds) { if (typeof retry_after !== 'undefined') data.retry_after = retry_after; } / g_p: generic_param { if (typeof g_p !== 'undefined') { @@ -598,13 +598,13 @@ subexp_params = ("reason" EQUAL reason: event_reason_value) { else data.params[g_p[0]] = true; }; } -event_reason_value = "deactivated" - / "probation" - / "rejected" - / "timeout" - / "giveup" - / "noresource" - / "invariant" +event_reason_value = "deactivated"i + / "probation"i + / "rejected"i + / "timeout"i + / "giveup"i + / "noresource"i + / "invariant"i / event_reason_extension event_reason_extension = token @@ -635,19 +635,19 @@ via_parm = sent_protocol LWS sent_by ( SEMI via_params )* via_params = via_ttl / via_maddr / via_received / via_branch / response_port / via_extension -via_ttl = "ttl" EQUAL via_ttl_value: ttl { +via_ttl = "ttl"i EQUAL via_ttl_value: ttl { data.ttl = via_ttl_value; } -via_maddr = "maddr" EQUAL via_maddr: host { +via_maddr = "maddr"i EQUAL via_maddr: host { data.maddr = via_maddr; } -via_received = "received" EQUAL via_received: (IPv4address / IPv6address) { +via_received = "received"i EQUAL via_received: (IPv4address / IPv6address) { data.received = via_received; } -via_branch = "branch" EQUAL via_branch: token { +via_branch = "branch"i EQUAL via_branch: token { data.branch = via_branch; } -response_port = "rport" (EQUAL response_port: (DIGIT*) )? { +response_port = "rport"i (EQUAL response_port: (DIGIT*) )? { if(typeof response_port !== 'undefined') data.rport = response_port.join(""); } @@ -655,12 +655,12 @@ via_extension = generic_param sent_protocol = protocol_name SLASH protocol_version SLASH transport -protocol_name = via_protocol: ( "SIP" / token ) { +protocol_name = via_protocol: ( "SIP"i / token ) { data.protocol = via_protocol; } protocol_version = token -transport = via_transport: ("UDP" / "TCP" / "TLS" / "SCTP" / other_transport) { +transport = via_transport: ("UDP"i / "TCP"i / "TLS"i / "SCTP"i / other_transport) { data.transport = via_transport; } sent_by = via_host ( COLON via_port )? @@ -695,7 +695,7 @@ message_body = OCTET* stun_URI = stun_scheme ":" stun_host_port -stun_scheme = scheme: ("stuns" / "stun") { +stun_scheme = scheme: ("stuns"i / "stun"i) { data.scheme = scheme; } stun_host_port = stun_host ( ":" port )? @@ -714,10 +714,10 @@ sub_delims = "!" / "$" / "&" / "'" / "(" / ")" / "*" / "+" / "," / ";" / turn_URI = turn_scheme ":" stun_host_port ( "?transport=" transport )? -turn_scheme = scheme: ("turns" / "turn") { +turn_scheme = scheme: ("turns"i / "turn"i) { data.scheme = scheme; } -turn_transport = transport ("udp" / "tcp" / unreserved*) { +turn_transport = transport ("udp"i / "tcp"i / unreserved*) { data.transport = transport; }