<div dir="ltr"><div><div>Hi,<br><br>I'm using the AMI to change configuration using the updateconfig command, for example:<br>action: updateconfig<br>reload: yes<br>srcfilename: test.conf<br>dstfilename: test.conf<br>Action-000000: update<br>
Cat-000000: general<br>Var-000000: maxsecs<br>Value-000000: 500<br><br></div>Now the problem is, whenever I execute the above action, asterisk includes an extra \n in the file. So changing the same value 10 times gives 10 bytes of "garbage".<br>
<br>I did some reading of the Asterisk source code, and it seems to me there's a bug (or flawed design?) regarding UpdateConfig.<br>
<br>In utils/astman.c, function input_check, get_input is used to read
lines from the session. Each line is added to m.headers, but this
includes the end-line (\r\n) characters.<br>After receiving a complete
message, process_message is called, which in the end calls
main/manager.c function handle_updates for actually performing the
config update. In there, ast_variable_update is called to update the
value of the variable with the exact header value, which includes \r\n.
When looking on disk, the empty rows are \n characters. How to work
solve this issue, or work around it?<br><br></div>With regards,<br>Matthijs ter Woord<br><br></div>