[asterisk-commits] oej: branch oej/originate-media-settings r116220 - /team/oej/originate-media-...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed May 14 06:18:57 CDT 2008
Author: oej
Date: Wed May 14 06:18:57 2008
New Revision: 116220
URL: http://svn.digium.com/view/asterisk?view=rev&rev=116220
Log:
Add codecs to manager
Modified:
team/oej/originate-media-settings/main/manager.c
Modified: team/oej/originate-media-settings/main/manager.c
URL: http://svn.digium.com/view/asterisk/team/oej/originate-media-settings/main/manager.c?view=diff&rev=116220&r1=116219&r2=116220
==============================================================================
--- team/oej/originate-media-settings/main/manager.c (original)
+++ team/oej/originate-media-settings/main/manager.c Wed May 14 06:18:57 2008
@@ -2106,11 +2106,12 @@
return 0;
}
-/* helper function for originate */
+/*! \brief helper function for originate */
struct fast_originate_helper {
char tech[AST_MAX_EXTENSION];
char data[AST_MAX_EXTENSION];
int timeout;
+ int format; /*!< Codecs used for a call */
char app[AST_MAX_APP];
char appdata[AST_MAX_EXTENSION];
char cid_name[AST_MAX_EXTENSION];
@@ -2132,12 +2133,12 @@
char requested_channel[AST_CHANNEL_NAME];
if (!ast_strlen_zero(in->app)) {
- res = ast_pbx_outgoing_app(in->tech, AST_FORMAT_SLINEAR, in->data, in->timeout, in->app, in->appdata, &reason, 1,
+ res = ast_pbx_outgoing_app(in->tech, in->format, in->data, in->timeout, in->app, in->appdata, &reason, 1,
S_OR(in->cid_num, NULL),
S_OR(in->cid_name, NULL),
in->vars, in->account, &chan);
} else {
- res = ast_pbx_outgoing_exten(in->tech, AST_FORMAT_SLINEAR, in->data, in->timeout, in->context, in->exten, in->priority, &reason, 1,
+ res = ast_pbx_outgoing_exten(in->tech, in->format, in->data, in->timeout, in->context, in->exten, in->priority, &reason, 1,
S_OR(in->cid_num, NULL),
S_OR(in->cid_name, NULL),
in->vars, in->account, &chan);
@@ -2198,6 +2199,7 @@
const char *appdata = astman_get_header(m, "Data");
const char *async = astman_get_header(m, "Async");
const char *id = astman_get_header(m, "ActionID");
+ const char *codecs = astman_get_header(m, "Codecs");
struct ast_variable *vars = astman_get_variables(m);
char *tech, *data;
char *l = NULL, *n = NULL;
@@ -2207,6 +2209,7 @@
int reason = 0;
char tmp[256];
char tmp2[256];
+ int format = AST_FORMAT_SLINEAR;
pthread_t th;
if (!name) {
@@ -2241,6 +2244,10 @@
ast_shrink_phone_number(l);
if (ast_strlen_zero(l))
l = NULL;
+ }
+ if (!ast_strlen_zero(codecs)) {
+ format = 0;
+ ast_parse_allow_disallow(NULL, &format, codecs, 1);
}
if (ast_true(async)) {
struct fast_originate_helper *fast = ast_calloc(1, sizeof(*fast));
@@ -2261,6 +2268,7 @@
ast_copy_string(fast->context, context, sizeof(fast->context));
ast_copy_string(fast->exten, exten, sizeof(fast->exten));
ast_copy_string(fast->account, account, sizeof(fast->account));
+ fast->format = format;
fast->timeout = to;
fast->priority = pi;
if (ast_pthread_create_detached(&th, NULL, fast_originate, fast)) {
@@ -2285,10 +2293,10 @@
astman_send_error(s, m, "Originate with certain 'Application' arguments requires the additional System privilege, which you do not have.");
return 0;
}
- res = ast_pbx_outgoing_app(tech, AST_FORMAT_SLINEAR, data, to, app, appdata, &reason, 1, l, n, vars, account, NULL);
+ res = ast_pbx_outgoing_app(tech, format, data, to, app, appdata, &reason, 1, l, n, vars, account, NULL);
} else {
if (exten && context && pi)
- res = ast_pbx_outgoing_exten(tech, AST_FORMAT_SLINEAR, data, to, context, exten, pi, &reason, 1, l, n, vars, account, NULL);
+ res = ast_pbx_outgoing_exten(tech, format, data, to, context, exten, pi, &reason, 1, l, n, vars, account, NULL);
else {
astman_send_error(s, m, "Originate with 'Exten' requires 'Context' and 'Priority'");
return 0;
More information about the asterisk-commits
mailing list