<p>George Joseph has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/8547">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">app_voicemail: Fix json blob errors<br><br>When app_voicemail calls ast_test_suite_notify with the results of<br>a user keypress, it formats the keypress as '%c'. If the user hung up<br>or some other error occurrs, the result of the keypress is a non<br>printable character. This ultimately causes json_vpack_ex to think<br>it's being passed a non utf-8 string and return an error.<br><br>* Keypress results passed to ast_test_suite_notify are now checked with<br> isprint() and a '?' is substituted if the check fails.<br><br>Change-Id: I78ee188916bbac840f3d03f40201b692347ea865<br>---<br>M apps/app_voicemail.c<br>1 file changed, 24 insertions(+), 12 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/47/8547/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/apps/app_voicemail.c b/apps/app_voicemail.c<br>index cab78a6..df1d1ec 100644<br>--- a/apps/app_voicemail.c<br>+++ b/apps/app_voicemail.c<br>@@ -7835,7 +7835,8 @@<br> ast_test_suite_event_notify("USERPRESS", "Message: User pressed %c\r\nDTMF: %c", '#', '#');<br> return '#';<br> }<br>- ast_test_suite_event_notify("USERPRESS", "Message: User pressed %c\r\nDTMF: %c", res, res);<br>+ ast_test_suite_event_notify("USERPRESS", "Message: User pressed %c\r\nDTMF: %c",<br>+ isprint(res) ? res : '?', isprint(res) ? res : '?');<br> return res;<br> }<br> <br>@@ -7998,7 +7999,8 @@<br> if (retries > 3) {<br> cmd = '*'; /* Let's cancel this beast */<br> }<br>- ast_test_suite_event_notify("USERPRESS", "Message: User pressed %c\r\nDTMF: %c", cmd, cmd);<br>+ ast_test_suite_event_notify("USERPRESS", "Message: User pressed %c\r\nDTMF: %c",<br>+ isprint(cmd) ? cmd : '?', isprint(cmd) ? cmd : '?');<br> }<br> }<br> <br>@@ -8226,7 +8228,8 @@<br> cmd = 't';<br> done = 1;<br> }<br>- ast_test_suite_event_notify("USERPRESS", "Message: User pressed %c\r\nDTMF: %c", cmd, cmd);<br>+ ast_test_suite_event_notify("USERPRESS", "Message: User pressed %c\r\nDTMF: %c",<br>+ isprint(cmd) ? cmd : '?', isprint(cmd) ? cmd : '?');<br> }<br> }<br> if (cmd < 0 || cmd == 't')<br>@@ -8891,7 +8894,8 @@<br> ast_log(AST_LOG_WARNING, "Playback of message %s failed\n", vms->fn);<br> res = 0;<br> }<br>- ast_test_suite_event_notify("USERPRESS", "Message: User pressed %c\r\nDTMF: %c", res, res);<br>+ ast_test_suite_event_notify("USERPRESS", "Message: User pressed %c\r\nDTMF: %c",<br>+ isprint(res) ? res : '?', isprint(res) ? res : '?');<br> }<br> DISPOSE(vms->curdir, vms->curmsg);<br> return res;<br>@@ -10746,7 +10750,8 @@<br> if (retries > 3) {<br> cmd = 't';<br> }<br>- ast_test_suite_event_notify("USERPRESS", "Message: User pressed %c\r\nDTMF: %c", cmd, cmd);<br>+ ast_test_suite_event_notify("USERPRESS", "Message: User pressed %c\r\nDTMF: %c",<br>+ isprint(cmd) ? cmd : '?', isprint(cmd) ? cmd : '?');<br> }<br> }<br> if (cmd == 't')<br>@@ -10826,7 +10831,8 @@<br> if (retries > 3) {<br> cmd = 't';<br> }<br>- ast_test_suite_event_notify("USERPRESS", "Message: User pressed %c\r\nDTMF: %c", cmd, cmd);<br>+ ast_test_suite_event_notify("USERPRESS", "Message: User pressed %c\r\nDTMF: %c",<br>+ isprint(cmd) ? cmd : '?', isprint(cmd) ? cmd : '?');<br> }<br> }<br> DISPOSE(prefile, -1);<br>@@ -11648,7 +11654,8 @@<br> } else {<br> cmd = vm_intro(chan, vmu, &vms);<br> }<br>- ast_test_suite_event_notify("USERPRESS", "Message: User pressed %c\r\nDTMF: %c", cmd, cmd);<br>+ ast_test_suite_event_notify("USERPRESS", "Message: User pressed %c\r\nDTMF: %c",<br>+ isprint(cmd) ? cmd : '?', isprint(cmd) ? cmd : '?');<br> <br> vms.repeats = 0;<br> vms.starting = 1;<br>@@ -11668,7 +11675,8 @@<br> adsi_folders(chan, 0, "Change to folder...");<br> <br> cmd = get_folder2(chan, "vm-changeto", 0);<br>- ast_test_suite_event_notify("USERPRESS", "Message: User pressed %c\r\nDTMF: %c", cmd, cmd);<br>+ ast_test_suite_event_notify("USERPRESS", "Message: User pressed %c\r\nDTMF: %c",<br>+ isprint(cmd) ? cmd : '?', isprint(cmd) ? cmd : '?');<br> if (cmd == '#') {<br> cmd = 0;<br> } else if (cmd > 0) {<br>@@ -11800,7 +11808,8 @@<br> if (vms.repeats > 3) {<br> cmd = 't';<br> }<br>- ast_test_suite_event_notify("USERPRESS", "Message: User pressed %c\r\nDTMF: %c", cmd, cmd);<br>+ ast_test_suite_event_notify("USERPRESS", "Message: User pressed %c\r\nDTMF: %c",<br>+ isprint(cmd) ? cmd : '?', isprint(cmd) ? cmd : '?');<br> }<br> }<br> if (cmd == 't') {<br>@@ -11978,7 +11987,8 @@<br> if (useadsi)<br> adsi_folders(chan, 1, "Save to folder...");<br> cmd = get_folder2(chan, "vm-savefolder", 1);<br>- ast_test_suite_event_notify("USERPRESS", "Message: User pressed %c\r\nDTMF: %c", cmd, cmd);<br>+ ast_test_suite_event_notify("USERPRESS", "Message: User pressed %c\r\nDTMF: %c",<br>+ isprint(cmd) ? cmd : '?', isprint(cmd) ? cmd : '?');<br> box = 0; /* Shut up compiler */<br> if (cmd == '#') {<br> cmd = 0;<br>@@ -15066,7 +15076,8 @@<br> else<br> cmd = 't';<br> }<br>- ast_test_suite_event_notify("USERPRESS", "Message: User pressed %c\r\nDTMF: %c", cmd, cmd);<br>+ ast_test_suite_event_notify("USERPRESS", "Message: User pressed %c\r\nDTMF: %c",<br>+ isprint(cmd) ? cmd : '?', isprint(cmd) ? cmd : '?');<br> }<br> if (retries >= 3) {<br> return 0;<br>@@ -15231,7 +15242,8 @@<br> res = 't';<br> }<br> }<br>- ast_test_suite_event_notify("USERPRESS", "Message: User pressed %c\r\nDTMF: %c", res, res);<br>+ ast_test_suite_event_notify("USERPRESS", "Message: User pressed %c\r\nDTMF: %c",<br>+ isprint(res) ? res : '?', isprint(res) ? res : '?');<br> break;<br> <br> }<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/8547">change 8547</a>. To unsubscribe, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/8547"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 15 </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I78ee188916bbac840f3d03f40201b692347ea865 </div>
<div style="display:none"> Gerrit-Change-Number: 8547 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: George Joseph <gjoseph@digium.com> </div>