[Asterisk-code-review] app playback: Suppress warnings on playback if channel hung up (asterisk[master])

Joshua Colp asteriskteam at digium.com
Thu May 21 05:14:33 CDT 2015


Joshua Colp has submitted this change and it was merged.

Change subject: app_playback: Suppress warnings on playback if channel hung up
......................................................................


app_playback: Suppress warnings on playback if channel hung up

If a channel hangs up while an audio file is playing, there's
no need to clutter up the logs with a warning so suppress it
if ast_check_hangup returns true.

Also, change warning to debug/2 in file.c if writing a frame
fails.  Same reasoning.

Change-Id: I2e66191af3c5b6e951c98e8f1c3fe3cf2cf7ed89
Reported-by: George Joseph <george.joseph at fairview5.com>
Tested-by: George Joseph <george.joseph at fairview5.com>
---
M apps/app_playback.c
M main/file.c
2 files changed, 5 insertions(+), 3 deletions(-)

Approvals:
  Matt Jordan: Looks good to me, but someone else must approve
  Joshua Colp: Looks good to me, approved; Verified



diff --git a/apps/app_playback.c b/apps/app_playback.c
index feb7b63..2875ec2 100644
--- a/apps/app_playback.c
+++ b/apps/app_playback.c
@@ -490,7 +490,9 @@
 				ast_stopstream(chan);
 			}
 			if (res) {
-				ast_log(LOG_WARNING, "Playback failed on %s for %s\n", ast_channel_name(chan), (char *)data);
+				if (!ast_check_hangup(chan)) {
+					ast_log(LOG_WARNING, "Playback failed on %s for %s\n", ast_channel_name(chan), (char *)data);
+				}
 				res = 0;
 				mres = 1;
 			}
diff --git a/main/file.c b/main/file.c
index acd2cc6..bfad6e0 100644
--- a/main/file.c
+++ b/main/file.c
@@ -897,7 +897,7 @@
 
 		if (!fr /* stream complete */ || ast_write(s->owner, fr) /* error writing */) {
 			if (fr) {
-				ast_log(LOG_WARNING, "Failed to write frame\n");
+				ast_debug(2, "Failed to write frame\n");
 				ast_frfree(fr);
 			}
 			goto return_failure;
@@ -954,7 +954,7 @@
 
 		if (!fr /* stream complete */ || ast_write(s->owner, fr) /* error writing */) {
 			if (fr) {
-				ast_log(LOG_WARNING, "Failed to write frame\n");
+				ast_debug(2, "Failed to write frame\n");
 				ast_frfree(fr);
 			}
 			ast_channel_vstreamid_set(s->owner, -1);

-- 
To view, visit https://gerrit.asterisk.org/501
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I2e66191af3c5b6e951c98e8f1c3fe3cf2cf7ed89
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: George Joseph <george.joseph at fairview5.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Matt Jordan <mjordan at digium.com>



More information about the asterisk-code-review mailing list