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

OPTIONS request that causes a problem #122

Open
davehorton opened this issue Dec 2, 2021 · 4 comments
Open

OPTIONS request that causes a problem #122

davehorton opened this issue Dec 2, 2021 · 4 comments
Assignees

Comments

@davehorton
Copy link
Collaborator

2021-12-02 05:43:41.097690 recv 379 bytes from udp/[192.241.212.6]:56500 at 05:43:41.097591:
OPTIONS sip:[email protected] SIP/2.0^M
Via: SIP/2.0/UDP 192.241.212.6:56500;branch=nGTWdf.1124599842;rport;alias^M
From: sip:[email protected]:56500;tag=71186921^M
To: sip:[email protected]^M
Call-ID: [email protected]^M
CSeq: 1 OPTIONS^M
Contact: sip:[email protected]:56500^M
Content-Length: 0^M
Max-Forwards: 20^M
User-Agent: wFkdhplQ^M
Accept: text/plain^M

results in

Error: failed to parse sip message
    at new SipMessage (/home/admin/apps/sbc-options-handler/node_modules/drachtio-sip/lib/message.js:13:25)
    at DrachtioAgent._onMsg (/home/admin/apps/sbc-options-handler/node_modules/drachtio-srf/lib/drachtio-agent.js:555:20)
    at WireProtocol.emit (events.js:375:28)
    at WireProtocol.emit (domain.js:470:12)
    at WireProtocol.processMessageBuffer (/home/admin/apps/sbc-options-handler/node_modules/drachtio-srf/lib/wire-protocol.js:270:12)
    at WireProtocol._onData (/home/admin/apps/sbc-options-handler/node_modules/drachtio-srf/lib/wire-protocol.js:304:14)
    at Socket.emit (events.js:375:28)
    at Socket.emit (domain.js:470:12)
    at addChunk (internal/streams/readable.js:290:12)
    at readableAddChunk (internal/streams/readable.js:261:11) unable to parse incoming message: OPTIONS sip:[email protected] SIP/2.0^M
Via: SIP/2.0/UDP 192.241.212.6:56500;branch=nGTWdf.1124599842;rport=56500;alias^M
From: sip:[email protected]:56500;tag=71186921^M
To: sip:[email protected]^M
Call-ID: [email protected]^M
CSeq: 1 OPTIONS^M
Contact: sip:[email protected]:56500^M
Content-Length: 0^M
Max-Forwards: 20^M
User-Agent: wFkdhplQ^M
Accept: text/plain^M
@xquanluu
Copy link
Collaborator

Hi @davehorton I have tried to reproduce this issue in the testsuite but I cannot reproduce it.

scripts/uas.js:

handleOptions() {
this.srf.options((req, res) => {
res.send(200, {});
})
}

test/uas.js:

.then(() => {
uas = new Uas();
return uas.handleOptions();
})
.then((uas) => {
return sippUac('uac-options.xml');
})
.then(() => {
uas.disconnect();
return t.pass('Srf#createUAS returns a promise');
})

Result:

----------------------------------------------- 2023-01-16 01:30:13.358759
UDP message sent (369 bytes):

OPTIONS sip:[email protected]:5060 SIP/2.0
Via: SIP/2.0/UDP 172.29.0.2:5060;branch=nGTWdf.1124599842;rport;alias
From: sip:[email protected]:5060;tag=1SIPpTag001
To: sip:[email protected]:5060
Call-ID: [email protected]
CSeq: 1 OPTIONS
Contact: sip:[email protected]:5060
Content-Length: 0
Max-Forwards: 20
User-Agent: wFkdhplQ
Accept: text/plain

----------------------------------------------- 2023-01-16 01:30:13.389610
UDP message received [266] bytes :

SIP/2.0 200 OK
Via: SIP/2.0/UDP 172.29.0.2:5060;branch=nGTWdf.1124599842;rport=5060;alias
From: sip:[email protected]:5060;tag=1SIPpTag001
To: sip:[email protected]:5060;tag=SFBXDtSBZvNHg
Call-ID: [email protected]
CSeq: 1 OPTIONS
Content-Length: 0

@byoungdale
Copy link

I think I have the fix here: drachtio/drachtio-sip#14.

When I added the OPTIONS message above, it failed because of the extra carriage return on the end. I explained in the pull request.

@davehorton
Copy link
Collaborator Author

I think that functionality (in drachtio-sip) has been subsumed into this project directly, so could you make the fix here?

@byoungdale
Copy link

Got it fixed here. Didn't realize the report was from 2021.

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

3 participants