[asterisk-commits] branch 1.2 - r7274 in /branches/1.2:
apps/app_page.c pbx.c
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Thu Dec 1 18:51:16 CST 2005
Author: kpfleming
Date: Thu Dec 1 18:51:15 2005
New Revision: 7274
URL: http://svn.digium.com/view/asterisk?rev=7274&view=rev
Log:
inherit channel variables into channels created by Page() application (issue #5888)
Modified:
branches/1.2/apps/app_page.c
branches/1.2/pbx.c
Modified: branches/1.2/apps/app_page.c
URL: http://svn.digium.com/view/asterisk/branches/1.2/apps/app_page.c?rev=7274&r1=7273&r2=7274&view=diff
==============================================================================
--- branches/1.2/apps/app_page.c (original)
+++ branches/1.2/apps/app_page.c Thu Dec 1 18:51:15 2005
@@ -40,6 +40,7 @@
#include "asterisk/module.h"
#include "asterisk/file.h"
#include "asterisk/app.h"
+#include "asterisk/chanvars.h"
static const char *tdesc = "Page Multiple Phones";
@@ -77,13 +78,14 @@
char tech[64];
char resource[256];
char meetmeopts[64];
+ struct ast_variable *variables;
};
static void *page_thread(void *data)
{
struct calloutdata *cd = data;
ast_pbx_outgoing_app(cd->tech, AST_FORMAT_SLINEAR, cd->resource, 30000,
- "MeetMe", cd->meetmeopts, NULL, 0, cd->cidnum, cd->cidname, NULL, NULL);
+ "MeetMe", cd->meetmeopts, NULL, 0, cd->cidnum, cd->cidname, cd->variables, NULL);
free(cd);
return NULL;
}
@@ -91,6 +93,9 @@
static void launch_page(struct ast_channel *chan, const char *meetmeopts, const char *tech, const char *resource)
{
struct calloutdata *cd;
+ const char *varname;
+ struct ast_variable *lastvar = NULL;
+ struct ast_var_t *varptr;
pthread_t t;
pthread_attr_t attr;
cd = malloc(sizeof(struct calloutdata));
@@ -101,6 +106,29 @@
ast_copy_string(cd->tech, tech, sizeof(cd->tech));
ast_copy_string(cd->resource, resource, sizeof(cd->resource));
ast_copy_string(cd->meetmeopts, meetmeopts, sizeof(cd->meetmeopts));
+
+ AST_LIST_TRAVERSE(&chan->varshead, varptr, entries) {
+ if (!(varname = ast_var_full_name(varptr)))
+ continue;
+ if (varname[0] == '_') {
+ struct ast_variable *newvar = NULL;
+
+ if (varname[1] == '_') {
+ newvar = ast_variable_new(varname, ast_var_value(varptr));
+ } else {
+ newvar = ast_variable_new(&varname[1], ast_var_value(varptr));
+ }
+
+ if (newvar) {
+ if (lastvar)
+ lastvar->next = newvar;
+ else
+ cd->variables = newvar;
+ lastvar = newvar;
+ }
+ }
+ }
+
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
if (ast_pthread_create(&t, &attr, page_thread, cd)) {
Modified: branches/1.2/pbx.c
URL: http://svn.digium.com/view/asterisk/branches/1.2/pbx.c?rev=7274&r1=7273&r2=7274&view=diff
==============================================================================
--- branches/1.2/pbx.c (original)
+++ branches/1.2/pbx.c Thu Dec 1 18:51:15 2005
@@ -5217,7 +5217,7 @@
goto outgoing_app_cleanup;
}
memset(as, 0, sizeof(struct async_stat));
- chan = ast_request_and_dial(type, format, data, timeout, reason, cid_num, cid_name);
+ chan = __ast_request_and_dial(type, format, data, timeout, reason, cid_num, cid_name, &oh);
if (!chan) {
free(as);
res = -1;
More information about the asterisk-commits
mailing list