JsSIP
JsSIP copied to clipboard
Circular dependency causes "TypeError: Cannot read property 'STATUS_TERMINATED' of undefined"
Versions: 3.7.0 - 3.7.5 (at least)
The library build has circular dependency: ./UA -> ./RTCSession -> ./Dialog -> ./Dialog/RequestSender -> ../RTCSession
Thus RTCSession is empty object inside Dialog/RequestSender and it doesn't have C (constants) property. And then when 491 status comes RTCSession.C.STATUS_TERMINATED cannot be executed without TypeError.

So i see two ways how to fix it:
- Resolve circular dependency
- Import RTCSession every time before its usage
- Import RTCSession every time before its usage
Dynamic import is anti-pattern and does not work when using ES6 import (we'll migrate to that eventually).
- Resolve circular dependency
Can you contribute with a PR?