Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Peer connection left open when invite canceled #536

Closed
seth-outreach opened this issue Mar 20, 2018 · 1 comment
Closed

Peer connection left open when invite canceled #536

seth-outreach opened this issue Mar 20, 2018 · 1 comment
Labels

Comments

@seth-outreach
Copy link

Calling terminate() on a session immediately after an invite has begun will leave you in a state where the session description handler still has an open peer connection. If you're running in chrome, you can see a visible artifact of this: the "red dot" indicating mic access will still be up on the tab after termination.

Sample trace:

sip.invitecontext.sessionDescriptionHandler | initPeerConnection
sip.invitecontext.sessionDescriptionHandler | New peer connection created 
sip.invitecontext.sessionDescriptionHandler | acquiring local media
sip.invitecontext.sessionDescriptionHandler | acquired local media streams
sip.invitecontext.sessionDescriptionHandler | RTCIceGatheringState changed: gathering
sip.invitecontext.sessionDescriptionHandler | ICE candidate received: candidate:374261915 1 udp 2122260223 192.168.13.1 53697 typ host generation 0 ufrag qWW2 network-id 3 network-cost 50
sip.invitecontext.sessionDescriptionHandler | ICE candidate received: candidate:3256280924 1 udp 2122194687 10.40.9.41 62363 typ host generation 0 ufrag qWW2 network-id 2
sip.invitecontext.sessionDescriptionHandler | ICE candidate received: candidate:1746874327 1 udp 2122129151 10.40.9.43 60961 typ host generation 0 ufrag qWW2 network-id 1 network-cost 10
sip.invitecontext.sessionDescriptionHandler | ICE candidate received: candidate:557277616 1 udp 1685987071 74.85.92.138 62363 typ srflx raddr 10.40.9.41 rport 62363 generation 0 ufrag qWW2 network-id 2
sip.invitecontext.sessionDescriptionHandler | ICE candidate received: candidate:2336139579 1 udp 1685921535 74.85.92.138 60961 typ srflx raddr 10.40.9.43 rport 60961 generation 0 ufrag qWW2 network-id 1 network-cost 10
sip.invitecontext.sessionDescriptionHandler | ICE candidate received: candidate:1489843307 1 tcp 1518280447 192.168.13.1 9 typ host tcptype active generation 0 ufrag qWW2 network-id 3 network-cost 50
sip.invitecontext.sessionDescriptionHandler | ICE candidate received: candidate:2358582188 1 tcp 1518214911 10.40.9.41 9 typ host tcptype active generation 0 ufrag qWW2 network-id 2
sip.invitecontext.sessionDescriptionHandler | ICE candidate received: candidate:647811879 1 tcp 1518149375 10.40.9.43 9 typ host tcptype active generation 0 ufrag qWW2 network-id 1 network-cost 10
sip.inviteclientcontext | canceling RTCSession
sip.invitecontext.sessionDescriptionHandler | RTCIceChecking Timeout Triggered after 5000 milliseconds
sip.invitecontext.sessionDescriptionHandler | RTCIceGatheringState changed: complete
@james-criscuolo
Copy link
Collaborator

Hi @seth-outreach,
This looks legitimate, we'll look to get it fixed for the next release. In the meantime, you can lower your icecheckingtimeout, which seems to avoid this problem (as long as that fires or is unnecessary before terminating).

Thanks,
James

seanplwong added a commit to m800-limited/SIP.js that referenced this issue Aug 23, 2018
* add support for RTCDTMFSender

* add tests for RTCDTMFSender

* integrate egreen comments 2/7/18

* minor changes to sdh.sendDtmf logic and clean up formatting
minor changes to sendDtmf documentation text

* move sdh.sendDtmf log message

* forgotten formatting change in sdh.sendDtmf

* Prefer ontrack over onaddstream, remove onremovestream

Until now, we used *both* the spec-compliant ontrack and the deprecated
onaddstream APIs to detect track/stream addition. This resulted in a
warning even on spec-compliant browsers which implement ontrack.

We now detect support for ontrack and only use onaddstream as a fallback,
and emit a more explicit warning message, formatted like the two other
warnings about deprecated WebRTC APIs.

We also remove the deprecated onremovestream which did nothing except
print a logging message.

* Bug fixes with receiveRequest in reinvite cases

* Copy the SessionDescriptionInit to a new object that is mutable to pass to modifiers

* Refer notifies may have an id parameter in the event header

* Replace call to logger.info() with logger.log()

* Replace most references to RFC 2833 with either 'RTP' or 'RFC 4733'

A few issues, primarily with terminology:

* "In-band" means that the DTMF tones are mixed with the audio stream
  and audible to the receiver, which is not the case with either the
  SIP INFO or RFC 4733 methods.
* RFC 2833 is obsoleted by RFC 4733 and the latter is specifically
  referenced in RFC 7874
* (Very minor) DTMF is an initialism and, as such, should be
  capitalized.

* Replace JSLint reference with ESLint

* Emit the SessionDescriptionHandler-created event from the session

* Always reset ICE state when calling getDescription

* Block to ensure that ws is instantiated

* Fix some typos preventing an error route from processing correctly

* Add SessionDescriptionHandlerObserver

* fix WebRTC.Simple tests with non-Safari browsers

We replicate the Safari detection in the spec file in order to avoid
failing for Chrome and Firefox.

* Emit "terminated" on renegotiation error

Previously SIP.js would send a BYE but the client code would never be
notified of that, so the UI would basically not be able to recover.

* Close the Session Description Handler when a Session is cancelled
Fixes onsip#536

* Add Session Description Handler Observer

* Always call toString on dtmf values passed in by user

* Version 0.10.0

* Add P-Asserted-Identity header support

RFC 3325 indicates:
Typically, a user agent renders the value of a P-Asserted-Identity
header field that it receives to its user.  It may consider the identity
provided by a Trust Domain to be privileged, or intrinsically more
trustworthy than the From header field of a request.  However, any
specific behavior is specific to implementations or services.

The header has been added so that UA's can use it instead of the
remoteIdentity if this behavior is required.

* SIP PUBLISH support added (RFC3903)

* SIP PUBLISH (RFC3903) - refactored, added unit tests

* update testing dependencies:

- jasmine-core replaced by jasmine, as its a peerDependency of karma-jasmine-html-reporter (2.8.0 -> 3.1.0)
  The latest jasmine had random ordering of tests enabled by default, but it seems a certain portion of our
  tests were not prepared for this. Random ordering is now off until that is investigated and fixed, either
  in the tests or source itself
- karma (1.7.1 -> 2.0.2)
- karma-webpack (2.0.6 -> 3.0.0)
- karma-jasmine-html-reporter (0.2.2 -> 1.1.0)

* restore jasmine-core for travis only

* remove node 4 as minimum and replace with node 6, as node 4 is now EoL

* Utils: Replace custom MD5 implementation with crypto-js/md5

Fixes onsip#556

* update webpack to 4.8.3; webpack now runs twice, one for each mode

* onRequestTimeout onTransportError handlers added; fixed typo in afile name

* PublishContext extends ClientContext now; unit tests updated

* change prototypes defined in Session.js to use property descriptor notation

* change prototype defined in RegisterContext.js to use property descriptor notation

* Move ws transport out of UA and into its own layer
Create generic transport layer as a base for all transport

* collapse WebRTC folder into more generically named Web folder

* update dependencies
- add 'jasmine-core'
- remove 'ws'

* version bump to 0.11.0

* Modifiers: Remove incorrect port number manipulation.

From RFC 4566:

    m=<media> <port> <proto> <fmt> ...

The 2nd field is a port number, not the number of codecs, so
subtracting 1 is an error.

* Modifiers: Add function to strip arbitrary RTP payloads

Introduce `Modifiers.stripRtpPayload()` to allow stripping of arbitrary
RTP payloads. Updated existing modifiers to delegate to this new
function.

Usage:

  [
    Modifiers.stripRtpPayload('G722'),
    Modifiers.stripRtpPayload('telephone-event'),
    Modifiers.stripTcpCandidates
  ]

Fixes onsip#537

* Modifiers: Add test for new RTP payload stripping

* update webpack config to include globalobject: 'this'

* add andrew127 to THANKS.md

* clean up messaging event language to be more specific/consistent

* remove some unused vars

* fix reconnect leaving servers in bad state

* add deprecation warning for Transport.waitForConnected: use afterConnected instead

* minor fix to transport.resetServerErrorStatus

* SessionDescriptionHandler
 - Better speparation of responsibilities between Factory and Handler
 - Remove disable renegotiation flag. Firefox now works as expected
 - Move SessionDescriptionHandlerObserver into web folder

* Session Description Handler template constructor does not have any defined arguments

* Transport: fix loosing context for reconnect timer function

* Update License to be Github-friendly

* Add issue templates

* Pass options to refer. Fixes onsip#569

* Remove streams before adding new on reinvite; fix constraints override in setDescription()

* fix transportConstructor post-validation configuration log

* remove some leftover commented code in transactions.js

* remove unneeded jasmine-core dep

* refactor transaction send calls to new promise form

* add listener cleanup to session close

* update Transport interface to be more explicit regarding promises

* refactor the way loadconfig is called in Web/Transport

* refactor reconnection logic for clarity

* fix transport websocket listeners to remove correctly

* Refactor Transport disconnectPromise to defer resolution to onClose
Update Transport connectPromise defer to be cleaner and more consistent

* Add missing Max-Forwards header to CANCEL

* switch unminified build from 'development' mode to 'none' mode to match previous unminified builds

* Refactor SDH to work with FF61 undocumented change by adding local streams to PC before calling setRemoteDescription

https://bugzilla.mozilla.org/show_bug.cgi?id=1472321

* version 0.11.1

* SDH - Fix missing reference to this

* Web/SDH - Move getDescription event out of acquire function

* Web/SDH - Make acquiring media during set description configurable via alwaysAcquireMediaFirst boolean

* Make the major logic of invite happen async so that there is time to set up event handlers

* Add traceSip option back into Simple

* Make Simple always acquire media first if used in FF

* Version 0.11.2

* Install jasmine-core from package.json, not just travis

If we list jasmine-core (which we need to run tests) in devDependencies
there is no need for a travis-specific hook. This also ensures we don't
have a version mismatch when we decide to upgrade jasmine.

Also on trusty, the default gcc version is already 4.8 so save time by
not downloading additional packages via apt.

* Update webpack-cli to 3.x

Installing an old version of webpack-cli drags in babel-preset-es2015,
which gives us a warning. I was initially confused by the warning as
SIP.js itself has migrated to babel-preset-env.

* Use Chrome headless to run unit tests

PhantomJS has been discontinued, relying on it to run our unit tests
is problematic going forward.

For travis, the 'sudo' flag is needed to avoid a Chrome sandbox issue:
travis-ci/travis-ci#8836

* SDH - fix the description emitted with getDescription

* SDH - Remove deprecated RTCSessionDescription constructor

* SDH - Fix typo

* change main in package.json to use unminified dist file:

- this appears to be best practices and leads to less compatibility issues with modern workflows (typically minify in their own way)

* keepAliveDebounce timeout now properly resets itself

* fix transportConstructor configuration check

* Version 0.11.3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants