aboutsummaryrefslogtreecommitdiffstats
path: root/pbx
diff options
context:
space:
mode:
authordvossel <dvossel@f38db490-d61c-443f-a65b-d21fe96a405b>2011-02-03 16:22:10 +0000
committerdvossel <dvossel@f38db490-d61c-443f-a65b-d21fe96a405b>2011-02-03 16:22:10 +0000
commit4aca3187a3db25ff4d2208f116f618b363dec7d5 (patch)
tree00da0caa5a07b7b25729f089dbcafb08129fa9be /pbx
parent8170aae0a0882a93ca1ef80736cb95c2d6126865 (diff)
Asterisk media architecture conversion - no more format bitfields
This patch is the foundation of an entire new way of looking at media in Asterisk. The code present in this patch is everything required to complete phase1 of my Media Architecture proposal. For more information about this project visit the link below. https://wiki.asterisk.org/wiki/display/AST/Media+Architecture+Proposal The primary function of this patch is to convert all the usages of format bitfields in Asterisk to use the new format and format_cap APIs. Functionally no change in behavior should be present in this patch. Thanks to twilson and russell for all the time they spent reviewing these changes. Review: https://reviewboard.asterisk.org/r/1083/ git-svn-id: http://svn.digium.com/svn/asterisk/trunk@306010 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'pbx')
-rw-r--r--pbx/pbx_spool.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/pbx/pbx_spool.c b/pbx/pbx_spool.c
index d285af54b..bc832309b 100644
--- a/pbx/pbx_spool.c
+++ b/pbx/pbx_spool.c
@@ -74,7 +74,7 @@ struct outgoing {
int retrytime; /*!< How long to wait between retries (in seconds) */
int waittime; /*!< How long to wait for an answer */
long callingpid; /*!< PID which is currently calling */
- format_t format; /*!< Formats (codecs) for this call */
+ struct ast_format_cap *capabilities; /*!< Formats (codecs) for this call */
AST_DECLARE_STRING_FIELDS (
AST_STRING_FIELD(fn); /*!< File name of call file */
AST_STRING_FIELD(tech); /*!< Which channel technology to use for outgoing call */
@@ -99,10 +99,16 @@ static void queue_file(const char *filename, time_t when);
static int init_outgoing(struct outgoing *o)
{
+ struct ast_format tmpfmt;
o->priority = 1;
o->retrytime = 300;
o->waittime = 45;
- o->format = AST_FORMAT_SLINEAR;
+
+ if (!(o->capabilities = ast_format_cap_alloc_nolock())) {
+ return -1;
+ }
+ ast_format_cap_add(o->capabilities, ast_format_set(&tmpfmt, AST_FORMAT_SLINEAR, 0));
+
ast_set_flag(&o->options, SPOOL_FLAG_ALWAYS_DELETE);
if (ast_string_field_init(o, 128)) {
return -1;
@@ -116,6 +122,7 @@ static void free_outgoing(struct outgoing *o)
ast_variables_destroy(o->vars);
}
ast_string_field_free_memory(o);
+ o->capabilities = ast_format_cap_destroy(o->capabilities);
ast_free(o);
}
@@ -189,7 +196,7 @@ static int apply_outgoing(struct outgoing *o, const char *fn, FILE *f)
o->maxretries = 0;
}
} else if (!strcasecmp(buf, "codecs")) {
- ast_parse_allow_disallow(NULL, &o->format, c, 1);
+ ast_parse_allow_disallow(NULL, o->capabilities, c, 1);
} else if (!strcasecmp(buf, "context")) {
ast_string_field_set(o, context, c);
} else if (!strcasecmp(buf, "extension")) {
@@ -338,11 +345,11 @@ static void *attempt_thread(void *data)
int res, reason;
if (!ast_strlen_zero(o->app)) {
ast_verb(3, "Attempting call on %s/%s for application %s(%s) (Retry %d)\n", o->tech, o->dest, o->app, o->data, o->retries);
- res = ast_pbx_outgoing_app(o->tech, o->format, (void *) o->dest, o->waittime * 1000, o->app, o->data, &reason, 2 /* wait to finish */, o->cid_num, o->cid_name, o->vars, o->account, NULL);
+ res = ast_pbx_outgoing_app(o->tech, o->capabilities, (void *) o->dest, o->waittime * 1000, o->app, o->data, &reason, 2 /* wait to finish */, o->cid_num, o->cid_name, o->vars, o->account, NULL);
o->vars = NULL;
} else {
ast_verb(3, "Attempting call on %s/%s for %s@%s:%d (Retry %d)\n", o->tech, o->dest, o->exten, o->context,o->priority, o->retries);
- res = ast_pbx_outgoing_exten(o->tech, o->format, (void *) o->dest, o->waittime * 1000, o->context, o->exten, o->priority, &reason, 2 /* wait to finish */, o->cid_num, o->cid_name, o->vars, o->account, NULL);
+ res = ast_pbx_outgoing_exten(o->tech, o->capabilities, (void *) o->dest, o->waittime * 1000, o->context, o->exten, o->priority, &reason, 2 /* wait to finish */, o->cid_num, o->cid_name, o->vars, o->account, NULL);
o->vars = NULL;
}
if (res) {