Max message size over TLS

AA
Andrés Alonso
Fri, Mar 22, 2024 12:29 PM

Hello,

I'm trying to send a rather large JWT token as a custom header in the
REGISTER message. I'm using TLS transport.

I know the max length for UDP is 1300 bytes, and that PJSIP supposedly
switches to TCP when the message length is over that threshold. But what
about TLS?

After transport is connected I'm still getting this error:

...Failed to send Request msg REGISTER/cseq=52341 (tdta0x1058206a8)!
err=171023 (Message too long (PJSIP_EMSGTOOLONG))

Any feedback would be appreciated. Thank you.
Regards,,

Andrés

Hello, I'm trying to send a rather large JWT token as a custom header in the REGISTER message. I'm using TLS transport. I know the max length for UDP is 1300 bytes, and that PJSIP supposedly switches to TCP when the message length is over that threshold. But what about TLS? After transport is connected I'm still getting this error: *...Failed to send Request msg REGISTER/cseq=52341 (tdta0x1058206a8)! err=171023 (Message too long (PJSIP_EMSGTOOLONG))* Any feedback would be appreciated. Thank you. Regards,, Andrés --
JC
Joshua C. Colp
Fri, Mar 22, 2024 12:40 PM

On Fri, Mar 22, 2024 at 9:30 AM Andrés Alonso via pjsip <
pjsip@lists.pjsip.org> wrote:

Hello,

I'm trying to send a rather large JWT token as a custom header in the
REGISTER message. I'm using TLS transport.

I know the max length for UDP is 1300 bytes, and that PJSIP supposedly
switches to TCP when the message length is over that threshold. But what
about TLS?

After transport is connected I'm still getting this error:

...Failed to send Request msg REGISTER/cseq=52341 (tdta0x1058206a8)!
err=171023 (Message too long (PJSIP_EMSGTOOLONG))

Any feedback would be appreciated. Thank you.

PJSIP has a fixed maximum packet size. It is configurable in the
config_site.h using the PJSIP_MAX_PKT_LEN define[1]. We set it to 65535
with no issues[2]. Do note after changing the value it does require a full
rebuild, or else you'll encounter weird crashes.

[1]
https://github.com/pjsip/pjproject/blob/master/pjlib/include/pj/config_site_sample.h#L175
[2]
https://github.com/asterisk/asterisk/blob/master/third-party/pjproject/patches/config_site.h#L68

--
Joshua C. Colp
Director of Engineering | Asterisk Project Lead
Sangoma Technologies
Check us out at www.sangoma.com and www.asterisk.org

On Fri, Mar 22, 2024 at 9:30 AM Andrés Alonso via pjsip < pjsip@lists.pjsip.org> wrote: > Hello, > > I'm trying to send a rather large JWT token as a custom header in the > REGISTER message. I'm using TLS transport. > > I know the max length for UDP is 1300 bytes, and that PJSIP supposedly > switches to TCP when the message length is over that threshold. But what > about TLS? > > After transport is connected I'm still getting this error: > > *...Failed to send Request msg REGISTER/cseq=52341 (tdta0x1058206a8)! > err=171023 (Message too long (PJSIP_EMSGTOOLONG))* > > Any feedback would be appreciated. Thank you. > PJSIP has a fixed maximum packet size. It is configurable in the config_site.h using the PJSIP_MAX_PKT_LEN define[1]. We set it to 65535 with no issues[2]. Do note after changing the value it does require a full rebuild, or else you'll encounter weird crashes. [1] https://github.com/pjsip/pjproject/blob/master/pjlib/include/pj/config_site_sample.h#L175 [2] https://github.com/asterisk/asterisk/blob/master/third-party/pjproject/patches/config_site.h#L68 -- Joshua C. Colp Director of Engineering | Asterisk Project Lead Sangoma Technologies Check us out at www.sangoma.com and www.asterisk.org
AA
Andrés Alonso
Fri, Mar 22, 2024 1:36 PM

That worked well after recompiling. Thanks Joshua.
Still wondering why the automatic transport switch doesn't seem to work
with TLS.

On Fri, Mar 22, 2024 at 1:40 PM Joshua C. Colp jcolp@digium.com wrote:

On Fri, Mar 22, 2024 at 9:30 AM Andrés Alonso via pjsip <
pjsip@lists.pjsip.org> wrote:

Hello,

I'm trying to send a rather large JWT token as a custom header in the
REGISTER message. I'm using TLS transport.

I know the max length for UDP is 1300 bytes, and that PJSIP supposedly
switches to TCP when the message length is over that threshold. But what
about TLS?

After transport is connected I'm still getting this error:

...Failed to send Request msg REGISTER/cseq=52341 (tdta0x1058206a8)!
err=171023 (Message too long (PJSIP_EMSGTOOLONG))

Any feedback would be appreciated. Thank you.

PJSIP has a fixed maximum packet size. It is configurable in the
config_site.h using the PJSIP_MAX_PKT_LEN define[1]. We set it to 65535
with no issues[2]. Do note after changing the value it does require a full
rebuild, or else you'll encounter weird crashes.

[1]
https://github.com/pjsip/pjproject/blob/master/pjlib/include/pj/config_site_sample.h#L175
[2]
https://github.com/asterisk/asterisk/blob/master/third-party/pjproject/patches/config_site.h#L68

--
Joshua C. Colp
Director of Engineering | Asterisk Project Lead
Sangoma Technologies
Check us out at www.sangoma.com and www.asterisk.org

That worked well after recompiling. Thanks Joshua. Still wondering why the automatic transport switch doesn't seem to work with TLS. On Fri, Mar 22, 2024 at 1:40 PM Joshua C. Colp <jcolp@digium.com> wrote: > On Fri, Mar 22, 2024 at 9:30 AM Andrés Alonso via pjsip < > pjsip@lists.pjsip.org> wrote: > >> Hello, >> >> I'm trying to send a rather large JWT token as a custom header in the >> REGISTER message. I'm using TLS transport. >> >> I know the max length for UDP is 1300 bytes, and that PJSIP supposedly >> switches to TCP when the message length is over that threshold. But what >> about TLS? >> >> After transport is connected I'm still getting this error: >> >> *...Failed to send Request msg REGISTER/cseq=52341 (tdta0x1058206a8)! >> err=171023 (Message too long (PJSIP_EMSGTOOLONG))* >> >> Any feedback would be appreciated. Thank you. >> > > PJSIP has a fixed maximum packet size. It is configurable in the > config_site.h using the PJSIP_MAX_PKT_LEN define[1]. We set it to 65535 > with no issues[2]. Do note after changing the value it does require a full > rebuild, or else you'll encounter weird crashes. > > [1] > https://github.com/pjsip/pjproject/blob/master/pjlib/include/pj/config_site_sample.h#L175 > [2] > https://github.com/asterisk/asterisk/blob/master/third-party/pjproject/patches/config_site.h#L68 > > -- > Joshua C. Colp > Director of Engineering | Asterisk Project Lead > Sangoma Technologies > Check us out at www.sangoma.com and www.asterisk.org >