--- /dev/null
+Subject: PlaybackFinished has a new error state
+
+The PlaybackFinished event now has a new state "failed"
+that is used when the sound file was not played due to an error.
+Before the state on PlaybackFinished was always "done".
+
+In case of multiple sound files to be played,
+the PlaybackFinished is sent only once in the end of the list,
+even in case of error.
STASIS_PLAYBACK_STATE_CONTINUING,
/*! The media has stopped playing */
STASIS_PLAYBACK_STATE_COMPLETE,
+ /*! The media has stopped because of an error playing the file */
+ STASIS_PLAYBACK_STATE_FAILED,
/*! The playback was canceled. */
STASIS_PLAYBACK_STATE_CANCELED,
/*! The playback was stopped. */
type = "PlaybackContinuing";
} else if (!strcmp(state, "done")) {
type = "PlaybackFinished";
+ } else if (!strcmp(state, "failed")) {
+ type = "PlaybackFinished";
} else {
return NULL;
}
return "paused";
case STASIS_PLAYBACK_STATE_CONTINUING:
return "continuing";
+ case STASIS_PLAYBACK_STATE_FAILED:
+ return "failed";
case STASIS_PLAYBACK_STATE_STOPPED:
case STASIS_PLAYBACK_STATE_COMPLETE:
case STASIS_PLAYBACK_STATE_CANCELED:
} else {
ast_log(LOG_WARNING, "%s: Playback failed for %s\n",
uniqueid, playback->media);
- playback->state = STASIS_PLAYBACK_STATE_STOPPED;
+ if (playback->media_index == AST_VECTOR_SIZE(&playback->medias) - 1) {
+ playback->state = STASIS_PLAYBACK_STATE_FAILED;
+ } else {
+ playback->state = STASIS_PLAYBACK_STATE_CONTINUING;
+ }
}
}
[STASIS_PLAYBACK_STATE_PAUSED][STASIS_PLAYBACK_UNPAUSE] = playback_unpause,
[STASIS_PLAYBACK_STATE_COMPLETE][STASIS_PLAYBACK_STOP] = playback_noop,
+ [STASIS_PLAYBACK_STATE_FAILED][STASIS_PLAYBACK_STOP] = playback_noop,
[STASIS_PLAYBACK_STATE_CANCELED][STASIS_PLAYBACK_STOP] = playback_noop,
[STASIS_PLAYBACK_STATE_STOPPED][STASIS_PLAYBACK_STOP] = playback_noop,
};