[Asterisk-code-review] followme: delete the right recorded name file (asterisk[11])

Anonymous Coward asteriskteam at digium.com
Fri May 13 05:19:02 CDT 2016


Anonymous Coward #1000019 has submitted this change and it was merged.

Change subject: followme: delete the right recorded name file
......................................................................


followme: delete the right recorded name file

FollowMe with the option a records the name of the caller and plays it
to the callee. However it has failed to clean up that recorded file
as it tried to delete the file name without the '.sln' extension.

ASTERISK-26008 #close

Change-Id: I79d7b1be7d5cde57bf076d9389e2a8a4422776ec
Signed-off-by: Tzafrir Cohen <tzafrir.cohen at xorcom.com>
---
M apps/app_followme.c
1 file changed, 15 insertions(+), 2 deletions(-)

Approvals:
  Mark Michelson: Looks good to me, but someone else must approve
  Anonymous Coward #1000019: Verified
  Joshua Colp: Looks good to me, approved



diff --git a/apps/app_followme.c b/apps/app_followme.c
index 9f39c32..dfb0f0e 100644
--- a/apps/app_followme.c
+++ b/apps/app_followme.c
@@ -58,6 +58,8 @@
 #include "asterisk/dsp.h"
 #include "asterisk/app.h"
 
+#define REC_FORMAT "sln"
+
 /*** DOCUMENTATION
 	<application name="FollowMe" language="en_US">
 		<synopsis>
@@ -1419,7 +1421,7 @@
 
 			snprintf(targs->namerecloc, sizeof(targs->namerecloc), "%s/followme.%s",
 				ast_config_AST_SPOOL_DIR, ast_channel_uniqueid(chan));
-			if (ast_play_and_record(chan, "vm-rec-name", targs->namerecloc, 5, "sln", &duration,
+			if (ast_play_and_record(chan, "vm-rec-name", targs->namerecloc, 5, REC_FORMAT, &duration,
 				NULL, ast_dsp_get_threshold_from_settings(THRESHOLD_SILENCE), 0, NULL) < 0) {
 				goto outrun;
 			}
@@ -1521,7 +1523,18 @@
 		ast_free(nm);
 	}
 	if (!ast_strlen_zero(targs->namerecloc)) {
-		unlink(targs->namerecloc);
+		int ret;
+		char fn[PATH_MAX];
+
+		snprintf(fn, sizeof(fn), "%s.%s", targs->namerecloc,
+			     REC_FORMAT);
+		ret = unlink(fn);
+		if (ret != 0) {
+			ast_log(LOG_NOTICE, "Failed to delete recorded name file %s: %d (%s)\n",
+					fn, errno, strerror(errno));
+		} else {
+			ast_debug(2, "deleted recorded prompt %s.\n", fn);
+		}
 	}
 	ast_free((char *) targs->predial_callee);
 	ast_party_connected_line_free(&targs->connected_in);

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I79d7b1be7d5cde57bf076d9389e2a8a4422776ec
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 11
Gerrit-Owner: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Mark Michelson <mmichelson at digium.com>



More information about the asterisk-code-review mailing list