//Make sure we made it out alive
if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_BREAK) {
- switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
- break;
+ goto done;
}
//we only get one digit out of playback, see if thats all we needed and what we got
if (max_digits == 1 && status == SWITCH_STATUS_BREAK) {
//Make sure we made it out alive
if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_BREAK) {
- switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
- break;
+ goto done;
}
}
}
//Make sure we made it out alive
if (status != SWITCH_STATUS_SUCCESS) {
//Bail
- switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
- break;
+ goto done;
}
//see if we got enough
if (min_digits <= strlen(digit_buffer)) {
//Make sure we made it out alive
if (status != SWITCH_STATUS_SUCCESS && status != SWITCH_STATUS_BREAK) {
- switch_channel_hangup(channel, SWITCH_CAUSE_NORMAL_CLEARING);
- break;
+ goto done;
}
}
}
}
}
+ done:
//if we got here, we got no digits or lost the channel
digit_buffer = "\0";
return SWITCH_STATUS_FALSE;