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

Incorrect socket selected in outbound mode #117

Open
jonastelzio opened this issue Oct 20, 2021 · 2 comments
Open

Incorrect socket selected in outbound mode #117

jonastelzio opened this issue Oct 20, 2021 · 2 comments

Comments

@jonastelzio
Copy link
Contributor

When running SRF in outbound connection mode, in functions like 'createB2BUA', the default socket selected is basically 'the first socket' it can find. The code workaround to this is forwarding the _socket parameter like this:

srf.createB2BUA(req, res, destSipUri, {
    headers: forwardHeaders,
    passFailure: false,
    localSdpB: rtpOffer.sdp,
    localSdpA: async (remoteSdp, res) => await this.getSdpAnswer(remoteSdp, res),
    _socket: req.socket  // <- pass on the incoming req.socket here
})

This workaround works, but it's interacting with a _prefixed parameter, and is completely undocumented.
If I don't set the _socket parameter, SRF will automatically just pick the first socket in the sockets collection, which can (and will in most cases), belong to a completely unrelated SRF session.

@davehorton
Copy link
Collaborator

Good point, would you agree that Srf.createB2BUA should set _socket for you? If so I can make that change

@jonastelzio
Copy link
Contributor Author

@davehorton Yeah, I think it would make sense that it picks whatever socket is associated with the passed in Request? I can't really think of a use case for ever having it belong to another connection, at least in outbound mode. In "inbound mode" it could make sense I suppose, maybe?

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

No branches or pull requests

2 participants