diff options
author | file <file@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-02-27 20:56:23 +0000 |
---|---|---|
committer | file <file@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-02-27 20:56:23 +0000 |
commit | 2d7d691c95ca5dde1c481ef264f530ef3ebb2283 (patch) | |
tree | c51b61571813150c4acd6f5544ba59253642a8a2 /apps | |
parent | 9c594c145b0956d6702189ff3d1deea16fa6ce39 (diff) |
Don't loop around infinitely trying to spy on our own channel, and don't forget to free/detach the datastore upon hangup of the spy.
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@104787 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps')
-rw-r--r-- | apps/app_chanspy.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/apps/app_chanspy.c b/apps/app_chanspy.c index e25389520..a1e54ca44 100644 --- a/apps/app_chanspy.c +++ b/apps/app_chanspy.c @@ -462,6 +462,10 @@ redo: if (!strncmp(this->name, "Zap/pseudo", 10)) { ast_channel_unlock(this); goto redo; + } else if (this == chan) { + last = this; + ast_channel_unlock(this); + goto redo; } return setup_chanspy_ds(this, chanspy_ds); @@ -544,11 +548,6 @@ static int common_exec(struct ast_channel *chan, const struct ast_flags *flags, break; } - if (peer == chan) { - ast_channel_unlock(peer); - continue; - } - if (ast_test_flag(flags, OPTION_BRIDGED) && !ast_bridged_channel(peer)) { ast_channel_unlock(peer); continue; @@ -612,6 +611,7 @@ static int common_exec(struct ast_channel *chan, const struct ast_flags *flags, num_spyed_upon++; if (res == -1) { + chanspy_ds_free(peer_chanspy_ds); break; } else if (res > 1 && spec) { struct ast_channel *next; |