M
M
Maxim Chornopolsky2014-10-13 05:29:09
linux
Maxim Chornopolsky, 2014-10-13 05:29:09

How to preserve asterisk -x "core show hints" formatting when saving to file?

Actually, I want to display the status of phone connections to the asterisk through the page. But when echo `asterisk -x "core show hints"` > test.html, all formatting flies, it turns out to be a mess without a single transfer. Asterisk with FreePBX but I did not find such information in FreePBX itself, can you tell me from this side?
Got two creepy monsters

echo "<table border=1>" > /var/www/html/peers.html
asterisk -x "sip show peers" | sed "s/   /  /g" | sed "s/   /  /g" | sed "s/   /  /g" | sed "s/   /  /g" | sed "s/   /  /g" | sed "s/   /  /g" | sed "s/   /  /g" | sed "s/   /  /g" | sed "s/   /  /g" | sed "s/   /  /g" | sed "s/  /\t/g" | sed s/.*/\<tr\>\<td\>'&1'"<\/td><\/tr>"/ | sed "s/\t/<\/td><td>/g" >> /var/www/html/peers.html
echo "</table>" >> /var/www/html/peers.html

asterisk -x "core show hints" | sed "s/   /  /g" | sed "s/   /  /g" | sed "s/   /  /g" | sed "s/   /  /g" | sed "s/   /  /g" | sed "s/   /  /g" | sed "s/   /  /g" | sed "s/   /  /g" | sed "s/   /  /g" | sed "s/   /  /g" | sed "s/  /\t/g" | sed s/.*/\<tr\>\<td\>'&1'"<\/td><\/tr>"/ | sed "s/\t/<\/td><td>/g" >> /var/www/html/hints.html
echo "</table>" >> /var/www/html/hints.html

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
brutal_lobster, 2014-10-13
@Voiddancer

1.Save formatting:
2. For correct display in html - parse the output and insert the necessary tags.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question