Git Product home page Git Product logo

Comments (18)

jmillan avatar jmillan commented on September 27, 2024

You are right, but the case is that there can be many head field rows with the same name in a comma-separated value form.

http://tools.ietf.org/html/rfc3261#section-7.3.1

Regards.

from jssip.

jmillan avatar jmillan commented on September 27, 2024

I mean, each header must have a single URI, otherwise the parser will fail, but there can be many header fields in a comma-separated form. Yes?

from jssip.

ibc avatar ibc commented on September 27, 2024

@iwanbk In the Contact of an INVITE or a 200 to an INVITE it's true that there MUST be just one single SIP or SIPS URI, but that is not true in a REGISTER request/response or in a 3XX response (redirection).

from jssip.

iwanbk avatar iwanbk commented on September 27, 2024

Hmm..
So, it maybe become a bug report.

I got contact header like this when registering.

Contact: <sip:[email protected];transport=ws>;expires=580;received="sip:36.72.73.223:22667;transport=WS";+sip.instance="<urn:uuid:b5f2a3fb-3874-4f84-ae4a-98a87f156707>";reg-id=1, <sip:[email protected];transport=ws>;expires=600;received="sip:36.72.73.223:22668;transport=WS";+sip.instance="<urn:uuid:37d17414-d63d-4489-89f7-cebe4bf1920a>";reg-id=1

And add console.log in line 106 and 108 of Parser.js

console.log("length="+length);
        for(idx=0; idx < length; idx++) {
          console.log("idx="+idx+". contact header="+header[idx]);

Then, i got this message in JS console.

length=4
idx=0. contact header=<sip:[email protected];transport=ws>;expires=580;received="sip:36.72.73.223:22667;transport=WS";+sip.instance="<urn:uuid:b5f2a3fb-3874-4f84-ae4a-98a87f156707>";reg-id=1
idx=1. contact header=
idx=2. contact header= <sip:[email protected];transport=ws>;expires=600;received="sip:36.72.73.223:22668;transport=WS";+sip.instance="<urn:uuid:37d17414-d63d-4489-89f7-cebe4bf1920a>";reg-id=1
JsSIP | MESSAGE | Not so many "Contact" headers present 

It happened when i registering same user from different computer. Maybe it is not the right thing to do. But the parser shouldn't failed in this case.
Sorry, can't give a patch.

from jssip.

jmillan avatar jmillan commented on September 27, 2024

@iwanbk The previous header split regexp returns an array with some blank values.

Did you realize that nothing is done for such empty values?

for(idx=0; idx < length; idx++) {
  // @iwanbk log here
  if (header[idx].length > 0) {
    message.addHeader('contact', header[idx]);
    parsed = message.parseHeader('contact', idx);
    if (parsed === undefined) {
      break;
    }
  }
}
break;

from jssip.

ibc avatar ibc commented on September 27, 2024

The question here is, what would return those cases?:

  • getHeader("contact", 0)
  • getHeader("contact", 1)
  • getHeader("contact", 2)

from jssip.

iwanbk avatar iwanbk commented on September 27, 2024

@jmillan
Yes, but then the registration failed.
Sorry, for not providing complete log

JsSIP | MESSAGE | Not so many "Contact" headers present
JsSIP | TRANSACTION | Timer F expired z9hG4bK9005848
JsSIP | EVENT EMITTER | Emitting event: registrationFailed

from jssip.

jmillan avatar jmillan commented on September 27, 2024

Please, provide a complete log

from jssip.

jmillan avatar jmillan commented on September 27, 2024

Not needed, Ok

Got it. The index is not net being saved right. There' s the bug.

I let this open for resolution. Thanx @iwanbk

from jssip.

jmillan avatar jmillan commented on September 27, 2024

@iwanbk , it is solved in 351ca06

Thank you for reporting.

from jssip.

dpocock avatar dpocock commented on September 27, 2024

I'm seeing problems with multiple Contact headers in a reply from a REGISTER - maybe related to this bug

I'm using tryit.jssip.net

If I register as a user that is not already registered, everything is fine.

If I try to register as a user that has multiple registrations, JsSIP doesn't parse the reply from the proxy.

from jssip.

ibc avatar ibc commented on September 27, 2024

Could you provide more detailed info and hopefully a real example? This bug was fixed 4 months ago and we have not seen it again.

from jssip.

saghul avatar saghul commented on September 27, 2024

hi @dpocock I just tried by using a single account from two tabs in Chrome and got no apparent errors. Do you see any specific error in the console?

from jssip.

saghul avatar saghul commented on September 27, 2024

Seems to be related to the use of the sips scheme:

var uri = JsSIP.NameAddrHeader.parse("\"daniel1\"<sips:[email protected];transport=wss;rtcweb-breaker=no>;expires=132;language=\"en,fr\";click2call=no;+g.oma.sip-im;+audio");
undefined
uri
undefined
var uri = JsSIP.NameAddrHeader.parse("\"daniel1\"<sip:[email protected];transport=wss;rtcweb-breaker=no>;expires=132;language=\"en,fr\";click2call=no;+g.oma.sip-im;+audio");
undefined
uri
NameAddrHeader {uri: URI, parameters: Object, setParam: function, getParam: function, hasParam: function…}

from jssip.

jmillan avatar jmillan commented on September 27, 2024

Hi,

Yes, it is related to the sips scheme. JsSIP does only handle sip scheme.

var myNameAddress = JsSIP.NameAddrHeader.parse("\"daniel1\"<sip:[email protected];transport=wss;rtcweb-breaker=no>;expires=132;language=\"en,fr\";click2call=no;+g.oma.sip-im;+audio");
undefined
myNameAddress -> 
NameAddrHeader {uri: URI, parameters: Object, setParam: function, getParam: function, hasParam: function…}

from jssip.

dpocock avatar dpocock commented on September 27, 2024

The draft doesn't say a lot about sips, although it does appear to be valid in certain situations:

http://tools.ietf.org/html/draft-ietf-sipcore-sip-websocket-08#section-5.3
http://tools.ietf.org/html/draft-ietf-sipcore-sip-websocket-08#section-9.2

I've been doing all my testing with wss:// recently and all my other SIP UAs (e.g. Lumicall) use TLS by default too. I realise that sips URIs have their own issues, of course. In this case, this is just the default behavior of SIPml5 when registering against a wss:// server.

Do you think sips: is valid in the contact header?

from jssip.

ibc avatar ibc commented on September 27, 2024

SIPS usage is a pain due. It's much better and easier just to use SIP scheme everywhere and use a secure WSS connection. There is NO need at all to use SIPS if the transport is secure, NOT AT ALL.

Anyhow, JsSIP should allow SIPS scheme in URIs. I will open an issue for this.

from jssip.

ibc avatar ibc commented on September 27, 2024

This issue will be adressed in #78.

from jssip.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.