* \param mixmonitor The mixmonitor that needs to forward its file to recipients
* \param ext Format of the file that was saved
*/
-static void copy_to_voicemail(struct mixmonitor *mixmonitor, char *ext)
+static void copy_to_voicemail(struct mixmonitor *mixmonitor, char *ext, const char *filename)
{
struct vm_recipient *recipient = NULL;
struct ast_vm_recording_data recording_data;
- char filename[PATH_MAX];
+ char full_filename[PATH_MAX];
if (ast_string_field_init(&recording_data, 512)) {
ast_log(LOG_ERROR, "Failed to string_field_init, skipping copy_to_voicemail\n");
}
/* Delete the source file */
- snprintf(filename, sizeof(filename), "%s.%s", mixmonitor->filename, ext);
- if (remove(filename)) {
- ast_log(LOG_ERROR, "Failed to delete recording source file %s\n", filename);
+ snprintf(full_filename, sizeof(full_filename), "%s.%s", filename, ext);
+ if (remove(full_filename)) {
+ ast_log(LOG_ERROR, "Failed to delete recording source file %s\n", full_filename);
}
/* Free the string fields for recording_data before exiting the function. */
return state;
}
-static int extension_state_cb(const char *context, const char *exten, enum ast_extension_states state, void *data)
+static int extension_state_cb(char *context, char *exten, struct ast_state_cb_info *info, void *data)
{
struct ao2_iterator miter, qiter;
struct member *m;
if ((recording_fs = ast_readfile(recdata->recording_file, recdata->recording_ext, NULL, 0, 0, VOICEMAIL_DIR_MODE))) {
if (!ast_seekstream(recording_fs, 0, SEEK_END)) {
long framelength = ast_tellstream(recording_fs);
- duration = (int) (framelength / ast_format_rate(ast_getformatbyname(recdata->recording_ext)));
+ struct ast_format result;
+ /* XXX This use of ast_getformatbyname seems incorrect here. The file extension does not necessarily correspond
+ * to the name of the format. For instance, if "raw" were passed in, I don't think ast_getformatbyname would
+ * find the slinear format
+ */
+ duration = (int) (framelength / ast_format_rate(ast_getformatbyname(recdata->recording_ext, &result)));
}
}
{
int gotdest = 0;
int res = 0;
- int firststate;
struct sip_peer *authpeer = NULL;
const char *eventheader = sip_get_header(req, "Event"); /* Get Event package name */
int resubscribe = (p->subscribed != NONE) && !req->ignore;
AST_LIST_TRAVERSE(&tmpline->sublines, tmpsubline, list) {
if (!(subline == tmpsubline)) {
if (!strcasecmp(subline->lnname, tmpsubline->lnname)) {
+ struct ast_state_cb_info info = {
+ .exten_state = tmpsubline->extenstate,
+ };
tmpsubline->callid = callnums++;
transmit_callstate(tmpsubline->line->device, tmpsubline->line->instance, tmpsubline->callid, SKINNY_OFFHOOK);
push_callinfo(tmpsubline, sub);
- skinny_extensionstate_cb(NULL, NULL, tmpsubline->extenstate, tmpsubline->container);
+ skinny_extensionstate_cb(NULL, NULL, &info, tmpsubline->container);
}
}
}
orig_chan_name = ast_strdupa(c->name);
if (c->stream && cb) {
- long ms_len = ast_tellstream(c->stream) / (ast_format_rate(c->stream->fmt->format) / 1000);
+ long ms_len = ast_tellstream(c->stream) / (ast_format_rate(&c->stream->fmt->format) / 1000);
cb(c, ms_len, AST_WAITSTREAM_CB_START);
}
return res;
}
if (cb_val && cb) {
- long ms_len = ast_tellstream(c->stream) / (ast_format_rate(c->stream->fmt->format) / 1000);
+ long ms_len = ast_tellstream(c->stream) / (ast_format_rate(&c->stream->fmt->format) / 1000);
cb(c, ms_len, cb_val);
}
}
ast_copy_string(buf, ast_str_buffer(msg->from), len);
} else if (!strcasecmp(data, "body")) {
ast_copy_string(buf, ast_msg_get_body(msg), len);
- } else if (!strcasecmp(data, "custom_data")) {
- int outbound = -1;
- if (!strcasecmp(value, "mark_all_outbound")) {
- outbound = 1;
- } else if (!strcasecmp(value, "clear_all_outbound")) {
- outbound = 0;
- } else {
- ast_log(LOG_WARNING, "'%s' is not a valid value for custom_data\n", value);
- }
-
- if (outbound != -1) {
- struct msg_data *data;
- struct ao2_iterator iter = ao2_iterator_init(msg->vars, 0);
-
- while ((data= ao2_iterator_next(&iter))) {
- data->send = outbound;
- ao2_ref(data, -1);
- }
- ao2_iterator_destroy(&iter);
- }
-
} else {
ast_log(LOG_WARNING, "Invalid argument to MESSAGE(): '%s'\n", data);
}
ast_msg_set_from(msg, "%s", value);
} else if (!strcasecmp(data, "body")) {
ast_msg_set_body(msg, "%s", value);
+ } else if (!strcasecmp(data, "custom_data")) {
+ int outbound = -1;
+ if (!strcasecmp(value, "mark_all_outbound")) {
+ outbound = 1;
+ } else if (!strcasecmp(value, "clear_all_outbound")) {
+ outbound = 0;
+ } else {
+ ast_log(LOG_WARNING, "'%s' is not a valid value for custom_data\n", value);
+ }
+
+ if (outbound != -1) {
+ struct msg_data *data;
+ struct ao2_iterator iter = ao2_iterator_init(msg->vars, 0);
+
+ while ((data= ao2_iterator_next(&iter))) {
+ data->send = outbound;
+ ao2_ref(data, -1);
+ }
+ ao2_iterator_destroy(&iter);
+ }
} else {
ast_log(LOG_WARNING, "'%s' is not a valid write argument.\n", data);
}