[asterisk-app-dev] AMI and updateconfig

Matthijs ter Woord matthijsterwoord at gmail.com
Wed Aug 6 01:12:37 CDT 2014


Hi,

I'm using the AMI to change configuration using the updateconfig command,
for example:
action: updateconfig
reload: yes
srcfilename: test.conf
dstfilename: test.conf
Action-000000: update
Cat-000000: general
Var-000000: maxsecs
Value-000000: 500

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".

I did some reading of the Asterisk source code, and it seems to me there's
a bug (or flawed design?) regarding UpdateConfig.

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.
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?

With regards,
Matthijs ter Woord
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-app-dev/attachments/20140806/b150b6e2/attachment.html>


More information about the asterisk-app-dev mailing list