openwrt / telephony

The telephony packages feed
105 stars 246 forks source link

asterisk: console logging truncated for lines above 996 characters #737

Closed pprindeville closed 2 years ago

pprindeville commented 2 years ago

Maintainer: @jslachta Environment: x86_64, generic, HEAD

Description:

I'm seeing truncated output when tracing PJSIP such as:

SIP/2.0 200 OK
Call-ID: 41dd13f4-b0c2-4483-adce-4df18231eba0
CSeq: 22390 OPTIONS
From: <sip:syringa2-endpoint@voip.syringanetworks.net>;tag=8caf4647-ecfd-4b10-bf94-9907fd4be383
To: <sip:voip.syringanetworks.net>;tag=sip+1+32a700b1+d16ebf88
Via: SIP/2.0/UDP 45.33.216.244:5060;received=45.33.216.244;rport=5060;branch=z9hG4bKPj6d3f6a7a-1184-4d44-b4f1-00516626b4ad
Content-Length: 0
Supported: resource-priority, siprec, 100rel
Server: DC-SIP/2.0
Organization: Metaswitch Networks
Allow-Events: message-summary, refer, dialog, line-seize, presence, call-info, as-feature-event, calling-name, ua-profile
Allow: INVITE, ACK, CANCEL, BYE, REGISTER, OPTIONS, PRACK, UPDATE, SUBSCRIBE, NOTIFY, REFER, INFO, PUBLISH
Accept-Encoding: identity
Accept: application/sdp, application/simple-message-summary, message/sipfrag, application/isup, application/x-simple-call-service-info, multipart/mixed, application/broadsoft, application

Note the incomplete last line.

pprindeville commented 2 years ago

I asked on #asterisk on libera and I'm told that this issue isn't present on other distros.

pprindeville commented 2 years ago

I uncommented this line:

full => notice,warning,error,debug,verbose,dtmf,fax

in logger.conf and indeed there are truncated lines in full as well.

micmac1 commented 2 years ago

I think it works as designed. main/logger.c uses BUFSIZ from stdio.h. musl defines it as 1024, glibc for instance defines it 8192. If a big enough log entry is provided the truncation would happen with glibc as well. To try it out you could increase BUFSIZ in stdio.h and see if the truncation happens after more chars (or not at all if you increase BUFSIZ enough). I didn't have time for that yet.

pprindeville commented 2 years ago

Submitted upstream fix as https://gerrit.asterisk.org/c/asterisk/+/18069

pprindeville commented 2 years ago

Merged upstream: https://github.com/asterisk/asterisk/commit/2a87303ebd531a1303088548c8951cdcfb5167d7

pprindeville commented 2 years ago

Fixed in 18.12.0 and 19.4.0 upstream, both released today.

micmac1 commented 1 year ago

Your patch was already applied here I reckon.