kirm / sip.js

Session Initiation Protocol for node.js
MIT License
427 stars 171 forks source link

Testing with another instance doesn't work #117

Closed eadamsatx closed 7 years ago

eadamsatx commented 7 years ago

Attempting to setup a test instance on another port doesn't work. ie. starting the application under 5080 and subsequently having the test framework call sip.start() as 5040 results in all communications originating from 5040, even those from the application server bound to 5080.

The reason for this is that: 1) All require() statements return the same copy of the library, and 2) The library holds references to instances of configured functions.

I propose an alternative to exports.start (perhaps exports.startMultiInstance) that will handle state per instance. @kirm if you approve of this idea I'll issue a PR when it's ready. Feedback welcome.

kirm commented 7 years ago

You can create another instance by using sip.create.

eadamsatx commented 7 years ago

Cool, thanks for the quick response.