aboutsummaryrefslogtreecommitdiffstats
path: root/channels
diff options
context:
space:
mode:
authormartinp <martinp@f38db490-d61c-443f-a65b-d21fe96a405b>2003-11-21 18:24:49 +0000
committermartinp <martinp@f38db490-d61c-443f-a65b-d21fe96a405b>2003-11-21 18:24:49 +0000
commite3e27950bbe6fec53c676b8c93ee08da3c8c35f4 (patch)
tree30380880590d917da3a2c48d0520ecdecdaefa3d /channels
parentc06305eed02d64ef6d97703007c002e370e6719d (diff)
Don't crash if ZapHangup, ZapTransfer, ZapDialOffhook are used on the channel that is onhook (idle)
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@1775 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels')
-rwxr-xr-xchannels/chan_zap.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/channels/chan_zap.c b/channels/chan_zap.c
index dc1e8b02d..0f21aacf0 100755
--- a/channels/chan_zap.c
+++ b/channels/chan_zap.c
@@ -3857,6 +3857,8 @@ static struct ast_channel *zt_new(struct zt_pvt *i, int state, int startpbx, int
i->isidlecall = 0;
i->alreadyhungup = 0;
#endif
+ /* clear the fake event in case we posted one before we had ast_chanenl */
+ i->fake_event = 0;
/* Assure there is no confmute on this channel */
zt_confmute(i, 0);
if (startpbx) {
@@ -6814,6 +6816,10 @@ static int action_transfer(struct mansession *s, struct message *m)
return 0;
}
p = find_channel(atoi(channel));
+ if (p->owner && p->owner->_state != AST_STATE_UP) {
+ astman_send_error(s, m, "Channel is on hook");
+ return 0;
+ }
if (!p) {
astman_send_error(s, m, "No such channel");
return 0;
@@ -6832,6 +6838,10 @@ static int action_transferhangup(struct mansession *s, struct message *m)
return 0;
}
p = find_channel(atoi(channel));
+ if (p->owner && p->owner->_state != AST_STATE_UP) {
+ astman_send_error(s, m, "Channel is on hook");
+ return 0;
+ }
if (!p) {
astman_send_error(s, m, "No such channel");
return 0;
@@ -6856,6 +6866,15 @@ static int action_zapdialoffhook(struct mansession *s, struct message *m)
return 0;
}
p = find_channel(atoi(channel));
+ if (p->owner) {
+ if (p->owner->_state != AST_STATE_UP) {
+ astman_send_error(s, m, "Channel is on hook");
+ return 0;
+ }
+ } else {
+ astman_send_error(s, m, "Channel does not have it's owner");
+ return 0;
+ }
if (!p) {
astman_send_error(s, m, "No such channel");
return 0;