drachtio / drachtio-server

A SIP call processing server that can be controlled via nodejs applications
https://drachtio.org
MIT License
247 stars 93 forks source link

Use correct size for wire protocol message #372

Closed sip2thefuture closed 1 month ago

sip2thefuture commented 2 months ago

Basically, utf8_strlen is only useful if you want to display the character, but has no meaning when trying to access the data.

davehorton commented 2 months ago

I'd be interested to add a test case, what sort of data being sent would illustrate the problem? I currently have test cases for utf8 encoded things like emojis and those do work.

sip2thefuture commented 2 months ago

I don't have test data right now, they might work, but utf8_strlen is not the correct way to count the byteSize (you do the same on the wire-protocol side).

https://github.com/drachtio/drachtio-srf/blob/main/lib/wire-protocol.js#L271

std::size is the equivalent of what you did there, not utf8_streln.

sip2thefuture commented 2 months ago

Leave it another bit as it needs to be in pair with drachtio-srf changes

davehorton commented 1 month ago

@sip2thefuture I've pushed the changes to drachtio-srf in version 0.5.0 of same, could you update the package.json in the test folder to refer to same?

sip2thefuture commented 1 month ago

@davehorton done!

davehorton commented 1 month ago

my bad @sip2thefuture, actually the version needed is 5.0.0. Could you push that one last change?

sip2thefuture commented 1 month ago

Should be fine now

davehorton commented 1 month ago

I'm releasing this in drachtio-server 0.9.0 and it should be partnered with drachtio-srf 5.0.0 or higher. Thanks for the help!