versatica / JsSIP

JsSIP, the JavaScript SIP library
https://jssip.net
Other
2.41k stars 744 forks source link

488; Not Acceptable Here on PSTN calls #215

Closed Jaykah closed 10 years ago

Jaykah commented 10 years ago

Hello guys,

We are testing JsSIP with DTLS/WSS with Asterisk, and have bumped into a few issues. I To make things easier, I will separate those into different issues.

Issue 1: Calls to cell phones/landlines result in 488; Not Acceptable Here.

The phone rigns, and hangs up when picked up.

Here's the sip debug:

SIP/2.0 100 Trying
Via: SIP/2.0/WSS jsq6egr2o464.invalid;branch=z9hG4bK9988695;received=2.2.2.2
From: <sip:company.device-21@1.1.1.1>;tag=ridigueio6
To: <sip:3475555555@1.1.1.1>
Call-ID: vhmk8u3sh30ioeclrts2
CSeq: 9778 INVITE
Server: Asterisk PBX 11.9.0-rc2
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Contact: <sip:3475555555@1.1.1.1:50600;transport=WS>
Content-Length: 0

 jssip-0.4.0-devel.js:144
Wed Apr 16 2014 00:01:06 GMT-0400 (Eastern Daylight Time) | jssip.transaction.ict | emitting event stateChanged jssip-0.4.0-devel.js:144
Wed Apr 16 2014 00:01:11 GMT-0400 (Eastern Daylight Time) | jssip.transport | received WebSocket text message:

SIP/2.0 183 Session Progress
Via: SIP/2.0/WSS jsq6egr2o464.invalid;branch=z9hG4bK9988695;received=2.2.2.2
From: <sip:company.device-21@1.1.1.1>;tag=ridigueio6
To: <sip:3475555555@1.1.1.1>;tag=as5581bb73
Call-ID: vhmk8u3sh30ioeclrts2
CSeq: 9778 INVITE
Server: Asterisk PBX 11.9.0-rc2
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Contact: <sip:3475555555@1.1.1.1:50600;transport=WS>
Content-Type: application/sdp
Content-Length: 1097

v=0
o=root 583369666 583369666 IN IP4 1.1.1.1
s=Asterisk PBX 11.9.0-rc2
c=IN IP4 1.1.1.1
t=0 0
m=audio 18110 RTP/SAVPF 0 8 126
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:126 telephone-event/8000
a=fmtp:126 0-16
a=silenceSupp:off - - - -
a=ptime:20
a=ice-ufrag:098ae92f5655561e043206442a18d23a
a=ice-pwd:1bf966344153c38359559760007fd0db
a=candidate:Ha2f2d64a 1 UDP 2130706431 1.1.1.1 18110 typ host
a=candidate:Hab084fe 1 UDP 2130706431 10.176.132.254 18110 typ host
a=candidate:Hc0a8a80c 1 UDP 2130706431 192.168.168.12 18110 typ host
a=candidate:Sa2f2d64a 1 UDP 1694498815 1.1.1.1 18110 typ srflx
a=candidate:Ha2f2d64a 2 UDP 2130706430 1.1.1.1 18111 typ host
a=candidate:Hab084fe 2 UDP 2130706430 10.176.132.254 18111 typ host
a=candidate:Hc0a8a80c 2 UDP 2130706430 192.168.168.12 18111 typ host
a=candidate:Sa2f2d64a 2 UDP 1694498814 1.1.1.1 18112 typ srflx
a=connection:new
a=setup:active
a=fingerprint:SHA-256 4B:D0:F1:39:36:B7:B0:91:57:87:9F:1F:6E:CF:C4:37:D2:BB:C7:72:F9:DC:A4:CB:50:64:9E:0D:FF:D0:40:39
a=sendrecv

 jssip-0.4.0-devel.js:144
Wed Apr 16 2014 00:01:11 GMT-0400 (Eastern Daylight Time) | jssip.dialog | new UAC dialog created with status EARLY jssip-0.4.0-devel.js:144
Wed Apr 16 2014 00:01:11 GMT-0400 (Eastern Daylight Time) | jssip.rtcsession.rtcmediahandler | stream added: default jssip-0.4.0-devel.js:144
Wed Apr 16 2014 00:01:11 GMT-0400 (Eastern Daylight Time) | jssip.rtcsession | emitting event progress jssip-0.4.0-devel.js:144
Wed Apr 16 2014 00:01:11 GMT-0400 (Eastern Daylight Time) | jssip.rtcsession.rtcmediahandler | ICE connection state changed to "checking" jssip-0.4.0-devel.js:144
Wed Apr 16 2014 00:01:11 GMT-0400 (Eastern Daylight Time) | jssip.rtcsession.rtcmediahandler | ICE connection state changed to "completed" jssip-0.4.0-devel.js:144
Wed Apr 16 2014 00:01:17 GMT-0400 (Eastern Daylight Time) | jssip.transport | received WebSocket text message:

SIP/2.0 200 OK
Via: SIP/2.0/WSS jsq6egr2o464.invalid;branch=z9hG4bK9988695;received=2.2.2.2
From: <sip:company.device-21@1.1.1.1>;tag=ridigueio6
To: <sip:3475555555@1.1.1.1>;tag=as5581bb73
Call-ID: vhmk8u3sh30ioeclrts2
CSeq: 9778 INVITE
Server: Asterisk PBX 11.9.0-rc2
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Contact: <sip:3475555555@1.1.1.1:50600;transport=WS>
Content-Type: application/sdp
Content-Length: 1102

v=0
o=root 583369666 583369666 IN IP4 1.1.1.1
s=Asterisk PBX 11.9.0-rc2
c=IN IP4 1.1.1.1
t=0 0
m=audio 18110 RTP/SAVPF 0 8 126
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:126 telephone-event/8000
a=fmtp:126 0-16
a=silenceSupp:off - - - -
a=ptime:20
a=ice-ufrag:098ae92f5655561e043206442a18d23a
a=ice-pwd:1bf966344153c38359559760007fd0db
a=candidate:Ha2f2d64a 1 UDP 2130706431 1.1.1.1 18110 typ host
a=candidate:Hab084fe 1 UDP 2130706431 10.176.132.254 18110 typ host
a=candidate:Hc0a8a80c 1 UDP 2130706431 192.168.168.12 18110 typ host
a=candidate:Sa2f2d64a 1 UDP 1694498815 1.1.1.1 18110 typ srflx
a=candidate:Ha2f2d64a 2 UDP 2130706430 1.1.1.1 18111 typ host
a=candidate:Hab084fe 2 UDP 2130706430 10.176.132.254 18111 typ host
a=candidate:Hc0a8a80c 2 UDP 2130706430 192.168.168.12 18111 typ host
a=candidate:Sa2f2d64a 2 UDP 1694498814 1.1.1.1 18112 typ srflx
a=connection:existing
a=setup:active
a=fingerprint:SHA-256 4B:D0:F1:39:36:B7:B0:91:57:87:9F:1F:6E:CF:C4:37:D2:BB:C7:72:F9:DC:A4:CB:50:64:9E:0D:FF:D0:40:39
a=sendrecv

 jssip-0.4.0-devel.js:144
Wed Apr 16 2014 00:01:17 GMT-0400 (Eastern Daylight Time) | jssip.transaction.ict | emitting event stateChanged jssip-0.4.0-devel.js:144
Wed Apr 16 2014 00:01:17 GMT-0400 (Eastern Daylight Time) | jssip.dialog | dialog vhmk8u3sh30ioeclrts2ridigueio6as5581bb73  changed to CONFIRMED state jssip-0.4.0-devel.js:144
Wed Apr 16 2014 00:01:17 GMT-0400 (Eastern Daylight Time) | jssip.rtcsession | Failed to set remote  sdp: Session error code: ERROR_TRANSPORT. Session error description: Couldn't set up DTLS-SRTP on RTP channel.. jssip-0.4.0-devel.js:142
Wed Apr 16 2014 00:01:17 GMT-0400 (Eastern Daylight Time) | jssip.transport | sending WebSocket message:

ACK sip:3475555555@1.1.1.1:50600;transport=ws SIP/2.0
Via: SIP/2.0/WSS jsq6egr2o464.invalid;branch=z9hG4bK1326714
Max-Forwards: 69
To: <sip:3475555555@1.1.1.1>;tag=as5581bb73
From: <sip:company.device-21@1.1.1.1>;tag=ridigueio6
Call-ID: vhmk8u3sh30ioeclrts2
CSeq: 9778 ACK
Allow: ACK,CANCEL,BYE,OPTIONS,INVITE
Supported: outbound
User-Agent: JsSIP 0.4.0-devel
Content-Length: 0

 jssip-0.4.0-devel.js:144
Wed Apr 16 2014 00:01:17 GMT-0400 (Eastern Daylight Time) | jssip.ua | emitting event newTransaction jssip-0.4.0-devel.js:144
Wed Apr 16 2014 00:01:17 GMT-0400 (Eastern Daylight Time) | jssip.transaction.nict | emitting event stateChanged jssip-0.4.0-devel.js:144
Wed Apr 16 2014 00:01:17 GMT-0400 (Eastern Daylight Time) | jssip.transport | sending WebSocket message:

BYE sip:3475555555@1.1.1.1:50600;transport=ws SIP/2.0
Via: SIP/2.0/WSS jsq6egr2o464.invalid;branch=z9hG4bK3730873
Max-Forwards: 69
To: <sip:3475555555@1.1.1.1>;tag=as5581bb73
From: <sip:company.device-21@1.1.1.1>;tag=ridigueio6
Call-ID: vhmk8u3sh30ioeclrts2
CSeq: 9779 BYE
Reason: SIP ;cause=488; text="Not Acceptable Here"
Allow: ACK,CANCEL,BYE,OPTIONS,INVITE
Supported: outbound
User-Agent: JsSIP 0.4.0-devel
Content-Length: 0

 jssip-0.4.0-devel.js:144
Wed Apr 16 2014 00:01:17 GMT-0400 (Eastern Daylight Time) | jssip.rtcsession | closing INVITE session vhmk8u3sh30ioeclrts2ridigueio6 jssip-0.4.0-devel.js:144
Wed Apr 16 2014 00:01:17 GMT-0400 (Eastern Daylight Time) | jssip.rtcsession.rtcmediahandler | closing PeerConnection jssip-0.4.0-devel.js:144
Wed Apr 16 2014 00:01:17 GMT-0400 (Eastern Daylight Time) | jssip.dialog | dialog vhmk8u3sh30ioeclrts2ridigueio6as5581bb73 deleted jssip-0.4.0-devel.js:144
Wed Apr 16 2014 00:01:17 GMT-0400 (Eastern Daylight Time) | jssip.rtcsession | emitting event failed jssip-0.4.0-devel.js:144
Call failed webphone_js_sip.js:680
Wed Apr 16 2014 00:01:17 GMT-0400 (Eastern Daylight Time) | jssip.rtcsession.rtcmediahandler | ICE connection state changed to "closed" jssip-0.4.0-devel.js:144
Wed Apr 16 2014 00:01:17 GMT-0400 (Eastern Daylight Time) | jssip.transport | received WebSocket text message:

SIP/2.0 200 OK
Via: SIP/2.0/WSS jsq6egr2o464.invalid;branch=z9hG4bK3730873;received=2.2.2.2
From: <sip:company.device-21@1.1.1.1>;tag=ridigueio6
To: <sip:3475555555@1.1.1.1>;tag=as5581bb73
Call-ID: vhmk8u3sh30ioeclrts2
CSeq: 9779 BYE
Server: Asterisk PBX 11.9.0-rc2
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Length: 0
jmillan commented 10 years ago

Hi,

This is an error on DTLS handshake as the log states:

sdp: Session error code: ERROR_TRANSPORT. Session error description: Couldn't set up DTLS-SRTP on RTP channel..

The DTLS handshake is not being performed by Asterisk and it should. Please, refer to the Asterisk Mailing list. They will provide you with a closer information.

ibc commented 10 years ago

Please, NO MORE Asterisk logs in this project tracker. Just stop and go to Asterisk-land for questions about Asterisk and WebRTC.

Jaykah commented 10 years ago

Well the reason it's here is because I am sure that this has something to do with JsSIP, not Asterisk. I have tried the same setup with SIPML and it is working just fine.

randriese commented 10 years ago

In addition: using JsSIP 0.3.7 it all seems to work just fine, but when I use the latest version from GIT I have this problem. BTW, i'm not using Asterisk but FreeSwitch & Kamailio

tm1000 commented 10 years ago

Yup same here. Works fine with 0.3.7, but with 0.4.0-devel it doesnt with this error: Failed to set remote sdp: Session error code: ERROR_TRANSPORT. Session error description: Couldn't set up DTLS-SRTP on RTP channel..

tm1000 commented 10 years ago

This is actually a chrome bug:

https://code.google.com/p/webrtc/issues/detail?id=3530

Pretty much confirmed to be a Chrome bug. I went to firefox. Everything works great!

gdaszuta commented 9 years ago

Does anyone found workaround for Chrome? In my project I now use SIPml. JsSIP looks better in every way - it's more flexible, allows for access to custom headers, weights the half of SIPml and has more elegant API. There's no major issues - apart of this small "not working in web browser currently most popular on the market" thing.

jvanvleet commented 9 years ago

I don't have time to troubleshoot your Asterisk/JSSIP interop issues but I also feel the need to say that we have JSSIP working with Asterisk 13 (pjsip), DTLS and Chrome. It is a bugger to sort out and troubleshoot but what can you expect with such a new technology?

Anyhow, I just wanted to say that 1) there is hope and 2) jssip is not broken in Chrome for general dialing.

I will reiterate that there is a risk of incompatibility with every release of Asterisk and every release of JSSIP as things are changing quickly. Not for the faint of heart.

randriese commented 9 years ago

Well, it's not only Asterisk... It's also FreeSwitch...

ibc commented 9 years ago

Sorry, no time to test Asterisk or FreeSwitch. If there are real issues in JsSIP when it comes to interop with them, please report them (more than "it fails and this is my Asterisk log").

If it is a pure WebRTC issue in a browser (SDP syntax or whatever) it should be reported in Chrome por Firefox tracker.

If SIPml5 works with both browsers and Asterisk/FreeSwitch (I mean: without using their Webrtc2sip gateway) then probably SIPml5 mangles the outgoing and received SDPs to satisfy all the parties. If so, report which exact operation it performs on those SDPs and we'll consider whether it is suitable to include it in JsSIP or not. But seriously, we won't check SIPml5 internals. No time for that.

tm1000 commented 9 years ago

"jssip is not broken in Chrome for general dialing" this is an incorrect statement (furthermore what is "general" dialing vs "advanced" or "complex" dialing). The reality is that as far as I can tell there IS an issue, and it only happens when a pranswer is needed (so not always), however JsSIP is doing it correctly where-as chrome is not. Simply follow the provided bug links and read them yourself. Obviously it's not an Asterisk/Freeswitch nor JsSIP issue as is evidenced by @randriese saying he also has the issue in Freeswitch. Seriously this is a moot point I dont think there is anything JsSIP should do unless they want to do some wacky work around. Just wait for the chrome bug to be fixed, if ever.

From a webrtc developer talking about this bug (https://code.google.com/p/webrtc/issues/detail?id=3349#c10):

10 RAndriese

any news on this issue?

Nov 3, 2014 #11 v...@webrtc.org As a workaround, can you either

  • Not use bundle with pranswer, or
  • Start out not using bundle, then do a second offer/answer to turn on bundle?
randriese commented 9 years ago

I found that if i want to do a call which uses a forward registration from our switch to a non secure connection (i.e. another network) I have to disable the whole pre-answer part.

Andrew is right though, it's not a switch nor a JsSIP issue. It's 100% a chrome issue that got noticeable because JsSIP introduced pre-answers.

Verstuurd vanaf mijn iPhone

Op 5 feb. 2015 om 20:30 heeft Andrew Nagy notifications@github.com het volgende geschreven:

"jssip is not broken in Chrome for general dialing" this is an incorrect statement. The reality is that as far as I can tell there IS an issue, however JsSIP is doing it correctly where-as chrome is not. Simply follow the provided bug links and read them yourself. Obviously it's not an Asterisk/Freeswitch nor JsSIP issue as is evidenced by @randriese saying he also has the issue in Freeswitch. Seriously this is a moot point I dont think there is muh JsSIP should do unless they want to do some wacky work around. Just wait for the chrome bug to be fixed, if ever.

— Reply to this email directly or view it on GitHub.

PinkaminaDianePie commented 9 years ago

if library works only in one browser its useless library. i found good fork of jssip - https://github.com/onsip/sip.js maintainers of sip.js fixed chrome-related issues, so their library really cross-browser.

jmillan commented 9 years ago

Hi all,

Avoiding the SDP processing in 18X responses is as simple as removing the SDP from 18X responses.

session.on('progress', function(data){ data.body = null; });

You can do it always, just for Chrome, or filter against your favourite criteria.

jmillan commented 9 years ago

And a brief comment in the doc:

http://jssip.net/documentation/0.6.x/api/session/#event_progress

tm1000 commented 9 years ago

@jmillan thanks!

ibc commented 9 years ago

@PinkaminaDianePie thanks for your stupid and useless comment.

PinkaminaDianePie commented 9 years ago

Its not useless, people can see it and choose good library, instead of crap, working in one browser only ^_^

henryliu1988 commented 8 years ago

Dear,did anyone have a good fixed?

Steinmar commented 6 years ago

@henryliu1988 it looks like everyone didn't

ibc commented 6 years ago

JsSIP already handles early media by avoiding the "preanswer" stuff of WebRTC (which is not correctly implemented in any browser).

Steinmar commented 6 years ago

@ibc so I can't call to PSTN using JsSIP. Am I right?

ibc commented 6 years ago

@Steinmar, you CAN call the PSTN using JsSIP.