Only allow voicemail if substate is OFFHOOK or no channel active (UNSET).

(closes issue #17901)
Reported by: salecha


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@318019 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Damien Wedhorn 2011-05-06 23:07:55 +00:00
parent a9beb8323e
commit 8c0b1115cd

View file

@ -1185,6 +1185,7 @@ static int gendigittimeout = 8000;
/* How long to wait for an extra digit, if there is an ambiguous match */ /* How long to wait for an extra digit, if there is an ambiguous match */
static int matchdigittimeout = 3000; static int matchdigittimeout = 3000;
#define SUBSTATE_UNSET 0
#define SUBSTATE_OFFHOOK 1 #define SUBSTATE_OFFHOOK 1
#define SUBSTATE_ONHOOK 2 #define SUBSTATE_ONHOOK 2
#define SUBSTATE_RINGOUT 3 #define SUBSTATE_RINGOUT 3
@ -4706,6 +4707,8 @@ static void setsubstate_offhook(struct skinny_subchannel *sub)
transmit_start_tone(d, SKINNY_DIALTONE, l->instance, sub->callid); transmit_start_tone(d, SKINNY_DIALTONE, l->instance, sub->callid);
transmit_selectsoftkeys(d, l->instance, sub->callid, KEYDEF_OFFHOOK); transmit_selectsoftkeys(d, l->instance, sub->callid, KEYDEF_OFFHOOK);
sub->substate = SUBSTATE_OFFHOOK;
/* start the switch thread */ /* start the switch thread */
if (ast_pthread_create(&t, NULL, skinny_ss, sub->owner)) { if (ast_pthread_create(&t, NULL, skinny_ss, sub->owner)) {
ast_log(LOG_WARNING, "Unable to create switch thread: %s\n", strerror(errno)); ast_log(LOG_WARNING, "Unable to create switch thread: %s\n", strerror(errno));
@ -5181,23 +5184,26 @@ static int handle_stimulus_message(struct skinny_req *req, struct skinnysession
/* XXX determine the best way to pull off a conference. Meetme? */ /* XXX determine the best way to pull off a conference. Meetme? */
break; break;
case STIMULUS_VOICEMAIL: case STIMULUS_VOICEMAIL:
if (skinnydebug) if (skinnydebug) {
ast_verb(1, "Received Stimulus: Voicemail(%d/%d)\n", instance, callreference); ast_verb(1, "Received Stimulus: Voicemail(%d/%d)\n", instance, callreference);
}
if (!sub || !sub->owner) { if (!sub || !sub->owner) {
c = skinny_new(l, AST_STATE_DOWN, NULL, SKINNY_OUTGOING); c = skinny_new(l, AST_STATE_DOWN, NULL, SKINNY_OUTGOING);
} else { } else {
c = sub->owner; c = sub->owner;
} }
if (!c) { if (!c) {
ast_log(LOG_WARNING, "Unable to create channel for %s@%s\n", l->name, d->name); ast_log(LOG_WARNING, "Unable to create channel for %s@%s\n", l->name, d->name);
} else { break;
}
sub = c->tech_pvt; sub = c->tech_pvt;
if (sub->substate == SUBSTATE_UNSET || sub->substate == SUBSTATE_OFFHOOK){
l = sub->line; l = sub->line;
l->activesub = sub; l->activesub = sub;
setsubstate_dialing(sub,l->vmexten); setsubstate_dialing(sub,l->vmexten);
} }
break; break;
case STIMULUS_CALLPARK: case STIMULUS_CALLPARK: