drachtio-srf 4.5.30 → 4.5.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/sip-parser/parser.js
CHANGED
|
@@ -224,7 +224,10 @@ function parseUri(s) {
|
|
|
224
224
|
// eslint-disable-next-line max-len
|
|
225
225
|
//const re = /^(sips?):(?:([^\s>:@]+)(?::([^\s@>]+))?@)?([\w\-\.]+)(?::(\d+))?((?:;[^\s=\?>;]+(?:=[^\s?\;]+)?)*)(?:\?(([^\s&=>]+=[^\s&=>]+)(&[^\s&=>]+=[^\s&=>]+)*))?$/;
|
|
226
226
|
// eslint-disable-next-line max-len
|
|
227
|
-
const re = /^(sips?):(?:([^\s>:@]+)(?::([^\s@>]+))?@)?(?:(|(?:\[.*\])|(?:[0-9A-Za-z\-_]+\.)
|
|
227
|
+
const re = /^(sips?):(?:([^\s>:@]+)(?::([^\s@>]+))?@)?(?:(|(?:\[.*\])|(?:[0-9A-Za-z\-_]+\.)*[0-9A-Za-z\-_]+)|(?:\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}))(?::(\d+))?((?:;[^\s=\?>;]+(?:=[^\s?\;]+)?)*)(?:\?(([^\s&=>]+=[^\s&=>]+)(&[^\s&=>]+=[^\s&=>]+)*))?$/;
|
|
228
|
+
// eslint-disable-next-line max-len
|
|
229
|
+
//const re = /^(sips?):(?:([^\s>:@]+)(?::([^\s@>]+))?@)?((?:[0-9A-Za-z\-_]+\.)?[0-9A-Za-z\-_]+|(?:\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})|\[(?:[A-Fa-f0-9:]+)\])(?::(\d+))?((?:;[^\s=\?>;]+(?:=[^\s?\;]+)?)*)(?:\?(([^\s&=>]+=[^\s&=>]+)(&[^\s&=>]+=[^\s&=>]+)*))?$/;
|
|
230
|
+
|
|
228
231
|
|
|
229
232
|
const r = re.exec(s);
|
|
230
233
|
|
package/package.json
CHANGED
|
@@ -127,6 +127,13 @@ describe('Parser', function () {
|
|
|
127
127
|
uri.user.should.eql('116751x0');
|
|
128
128
|
uri.scheme.should.eql('sips');
|
|
129
129
|
});
|
|
130
|
+
it('should parse a sip uri with host part being simple label', function () {
|
|
131
|
+
var uri = parseUri('sip:116751@feature-server');
|
|
132
|
+
uri.family.should.eql('ipv4');
|
|
133
|
+
uri.host.should.eql('feature-server');
|
|
134
|
+
uri.user.should.eql('116751');
|
|
135
|
+
uri.scheme.should.eql('sip');
|
|
136
|
+
});
|
|
130
137
|
it('should parse a multi-part header', function () {
|
|
131
138
|
var msg = new SipMessage(examples('siprec'));
|
|
132
139
|
msg.payload.length.should.eql(2);
|