aboutsummaryrefslogtreecommitdiffstats
path: root/apps/app_intercom.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/app_intercom.c')
-rwxr-xr-xapps/app_intercom.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/apps/app_intercom.c b/apps/app_intercom.c
index 996576b88..e18950be1 100755
--- a/apps/app_intercom.c
+++ b/apps/app_intercom.c
@@ -157,6 +157,7 @@ static int intercom_exec(struct ast_channel *chan, void *data)
res = ast_set_read_format(chan, AST_FORMAT_SLINEAR);
if (res < 0) {
ast_log(LOG_WARNING, "Unable to set format to signed linear on channel %s\n", chan->name);
+ LOCAL_USER_REMOVE(u);
return -1;
}
/* Read packets from the channel */
@@ -184,9 +185,12 @@ static int intercom_exec(struct ast_channel *chan, void *data)
res = -1;
}
}
- LOCAL_USER_REMOVE(u);
+
if (!res)
ast_set_read_format(chan, oreadformat);
+
+ LOCAL_USER_REMOVE(u);
+
return res;
}