[asterisk-commits] branch oej/metermaids r9746 - in
/team/oej/metermaids: ./ apps/ channels/ inc...
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Mon Feb 13 02:57:34 MST 2006
Author: oej
Date: Mon Feb 13 03:57:22 2006
New Revision: 9746
URL: http://svn.digium.com/view/asterisk?rev=9746&view=rev
Log:
Update to trunk...
Modified:
team/oej/metermaids/ (props changed)
team/oej/metermaids/apps/app_page.c
team/oej/metermaids/apps/app_voicemail.c
team/oej/metermaids/cdr.c
team/oej/metermaids/channel.c
team/oej/metermaids/channels/chan_iax2.c
team/oej/metermaids/channels/chan_mgcp.c
team/oej/metermaids/channels/chan_sip.c
team/oej/metermaids/devicestate.c
team/oej/metermaids/dnsmgr.c
team/oej/metermaids/include/asterisk/channel.h
team/oej/metermaids/include/asterisk/manager.h
team/oej/metermaids/include/asterisk/pbx.h
team/oej/metermaids/manager.c
team/oej/metermaids/pbx.c
team/oej/metermaids/pbx/pbx_dundi.c
team/oej/metermaids/pbx/pbx_spool.c
Propchange: team/oej/metermaids/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Mon Feb 13 03:57:22 2006
@@ -1,1 +1,1 @@
-/branches/1.2:1-7496,7498-9280
+/branches/1.2:1-7496,7498-9744
Modified: team/oej/metermaids/apps/app_page.c
URL: http://svn.digium.com/view/asterisk/team/oej/metermaids/apps/app_page.c?rev=9746&r1=9745&r2=9746&view=diff
==============================================================================
--- team/oej/metermaids/apps/app_page.c (original)
+++ team/oej/metermaids/apps/app_page.c Mon Feb 13 03:57:22 2006
@@ -87,7 +87,7 @@
{
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, cd->variables, NULL);
+ "MeetMe", cd->meetmeopts, NULL, 0, cd->cidnum, cd->cidname, cd->variables, NULL, NULL);
free(cd);
return NULL;
}
Modified: team/oej/metermaids/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/oej/metermaids/apps/app_voicemail.c?rev=9746&r1=9745&r2=9746&view=diff
==============================================================================
--- team/oej/metermaids/apps/app_voicemail.c (original)
+++ team/oej/metermaids/apps/app_voicemail.c Mon Feb 13 03:57:22 2006
@@ -1,7 +1,7 @@
/*
* Asterisk -- An open source telephony toolkit.
*
- * Copyright (C) 1999 - 2005, Digium, Inc.
+ * Copyright (C) 1999 - 2006, Digium, Inc.
*
* Mark Spencer <markster at digium.com>
*
@@ -72,6 +72,11 @@
#include "asterisk/localtime.h"
#include "asterisk/cli.h"
#include "asterisk/utils.h"
+#include "asterisk/stringfields.h"
+#ifdef WITH_SMDI
+#include "asterisk/smdi.h"
+#define SMDI_MWI_WAIT_TIMEOUT 1000 /* 1 second */
+#endif
#ifdef USE_ODBC_STORAGE
#include "asterisk/res_odbc.h"
#endif
@@ -392,7 +397,9 @@
static char serveremail[80];
static char mailcmd[160]; /* Configurable mail cmd */
static char externnotify[160];
-
+#ifdef WITH_SMDI
+static struct ast_smdi_interface *smdi_iface = NULL;
+#endif
static char vmfmts[80];
static int vmminmessage;
static int vmmaxmessage;
@@ -780,13 +787,13 @@
return snprintf(dest, len, "%s/msg%04d", dir, num);
}
-/** basically mkdir -p $dest/$context/$ext/$mailbox
- * @dest String. base directory.
- * @context String. Ignored if is null or empty string.
- * @ext String. Ignored if is null or empty string.
- * @mailbox String. Ignored if is null or empty string.
- * @returns 0 on failure, 1 on success.
- * */
+/*! \brief basically mkdir -p $dest/$context/$ext/$mailbox
+ * \param dest String. base directory.
+ * \param context String. Ignored if is null or empty string.
+ * \param ext String. Ignored if is null or empty string.
+ * \param mailbox String. Ignored if is null or empty string.
+ * \return 0 on failure, 1 on success.
+ */
static int create_dirpath(char *dest, int len, char *context, char *ext, char *mailbox)
{
mode_t mode = VOICEMAIL_DIR_MODE;
@@ -2317,13 +2324,37 @@
char arguments[255];
char ext_context[256] = "";
int newvoicemails = 0, oldvoicemails = 0;
+#ifdef WITH_SMDI
+ struct ast_smdi_mwi_message *mwi_msg;
+#endif
if (!ast_strlen_zero(context))
snprintf(ext_context, sizeof(ext_context), "%s@%s", extension, context);
else
ast_copy_string(ext_context, extension, sizeof(ext_context));
+#ifdef WITH_SMDI
+ if (!strcasecmp(externnotify, "smdi")) {
+ if (ast_app_has_voicemail(ext_context, NULL))
+ ast_smdi_mwi_set(smdi_iface, extension);
+ else
+ ast_smdi_mwi_unset(smdi_iface, extension);
+
+ if ((mwi_msg = ast_smdi_mwi_message_wait(smdi_iface, SMDI_MWI_WAIT_TIMEOUT))) {
+ ast_log(LOG_ERROR, "Error executing SMDI MWI change for %s on %s\n", extension, smdi_iface->name);
+ if (!strncmp(mwi_msg->cause, "INV", 3))
+ ast_log(LOG_ERROR, "Invalid MWI extension: %s\n", mwi_msg->fwd_st);
+ else if (!strncmp(mwi_msg->cause, "BLK", 3))
+ ast_log(LOG_WARNING, "MWI light was already on or off for %s\n", mwi_msg->fwd_st);
+ ast_log(LOG_WARNING, "The switch reported '%s'\n", mwi_msg->cause);
+ ASTOBJ_UNREF(mwi_msg, ast_smdi_mwi_message_destroy);
+ } else {
+ ast_log(LOG_DEBUG, "Successfully executed SMDI MWI change for %s on %s\n", extension, smdi_iface->name);
+ }
+ } else if (!ast_strlen_zero(externnotify)) {
+#else
if (!ast_strlen_zero(externnotify)) {
+#endif
if (messagecount(ext_context, &newvoicemails, &oldvoicemails)) {
ast_log(LOG_ERROR, "Problem in calculating number of voicemail messages available for extension %s\n", extension);
} else {
@@ -2655,7 +2686,7 @@
}
-static int say_and_wait(struct ast_channel *chan, int num, char *language)
+static int say_and_wait(struct ast_channel *chan, int num, const char *language)
{
int d;
d = ast_say_number(chan, num, AST_DIGIT_ANY, language, (char *) NULL);
@@ -3284,8 +3315,7 @@
snprintf(ext_context, sizeof(ext_context), "%s@%s", vmu->mailbox, vmu->context);
/* Attach only the first format */
- fmt = ast_strdupa(fmt);
- if (fmt) {
+ if ((fmt = ast_strdupa(fmt))) {
stringp = fmt;
strsep(&stringp, "|");
@@ -3304,8 +3334,6 @@
myserveremail = vmu->serveremail;
sendpage(myserveremail, vmu->pager, msgnum, vmu->context, vmu->mailbox, cidnum, cidname, duration, vmu, category);
}
- } else {
- ast_log(LOG_ERROR, "Out of memory\n");
}
if (ast_test_flag(vmu, VM_DELETE)) {
@@ -5057,9 +5085,7 @@
AST_APP_ARG(argv1);
);
- parse = ast_strdupa(data);
- if (!parse) {
- ast_log(LOG_ERROR, "Out of memory!\n");
+ if (!(parse = ast_strdupa(data))) {
LOCAL_USER_REMOVE(u);
return -1;
}
@@ -5155,7 +5181,7 @@
/* Set language from config to override channel language */
if (!ast_strlen_zero(vmu->language))
- ast_copy_string(chan->language, vmu->language, sizeof(chan->language));
+ ast_string_field_set(chan, language, vmu->language);
create_dirpath(vms.curdir, sizeof(vms.curdir), vmu->context, vms.username, "");
/* Retrieve old and new message counts */
res = open_mailbox(&vms, vmu, 1);
@@ -5647,9 +5673,7 @@
LOCAL_USER_ADD(u);
- box = ast_strdupa(data);
- if (!box) {
- ast_log(LOG_ERROR, "Out of memory\n");
+ if (!(box = ast_strdupa(data))) {
LOCAL_USER_REMOVE(u);
return -1;
}
@@ -5689,11 +5713,8 @@
LOCAL_USER_ADD(u);
if (s) {
- s = ast_strdupa(s);
- if (!s) {
- ast_log(LOG_ERROR, "Out of memory\n");
+ if (!(s = ast_strdupa(s)))
return -1;
- }
user = strsep(&s, "|");
options = strsep(&s, "|");
if (user) {
@@ -5803,7 +5824,7 @@
return RESULT_SUCCESS;
}
-static char *complete_show_voicemail_users(char *line, char *word, int pos, int state)
+static char *complete_show_voicemail_users(const char *line, const char *word, int pos, int state)
{
int which = 0;
int wordlen;
@@ -5851,6 +5872,9 @@
char *cat;
struct ast_variable *var;
char *notifystr = NULL;
+#ifdef WITH_SMDI
+ char *smdistr = NULL;
+#endif
char *astattach;
char *astsearch;
char *astsaycid;
@@ -5960,6 +5984,24 @@
if ((notifystr = ast_variable_retrieve(cfg, "general", "externnotify"))) {
ast_copy_string(externnotify, notifystr, sizeof(externnotify));
ast_log(LOG_DEBUG, "found externnotify: %s\n", externnotify);
+#ifdef WITH_SMDI
+ if (!strcasecmp(externnotify, "smdi")) {
+ ast_log(LOG_DEBUG, "Using SMDI for external voicemail notification\n");
+ if ((smdistr = ast_variable_retrieve(cfg, "general", "smdiport"))) {
+ smdi_iface = ast_smdi_interface_find(smdistr);
+ } else {
+ ast_log(LOG_DEBUG, "No SMDI interface set, trying default (/dev/ttyS0)\n");
+ smdi_iface = ast_smdi_interface_find("/dev/ttyS0");
+ }
+
+ if (!smdi_iface) {
+ ast_log(LOG_ERROR, "No valid SMDI interface specfied, disabling external voicemail notification\n");
+ externnotify[0] = '\0';
+ } else {
+ ast_log(LOG_DEBUG, "Using SMDI port %s\n", smdi_iface->name);
+ }
+ }
+#endif
} else {
externnotify[0] = '\0';
}
@@ -6139,8 +6181,7 @@
struct vm_zone *z;
if ((z = ast_malloc(sizeof(*z)))) {
char *msg_format, *timezone;
- msg_format = ast_strdupa(var->value);
- if (msg_format != NULL) {
+ if ((msg_format = ast_strdupa(var->value))) {
timezone = strsep(&msg_format, "|");
if (msg_format) {
ast_copy_string(z->name, var->name, sizeof(z->name));
@@ -6159,7 +6200,6 @@
free(z);
}
} else {
- ast_log(LOG_WARNING, "Out of memory while reading voicemail config\n");
free(z);
return -1;
}
Modified: team/oej/metermaids/cdr.c
URL: http://svn.digium.com/view/asterisk/team/oej/metermaids/cdr.c?rev=9746&r1=9745&r2=9746&view=diff
==============================================================================
--- team/oej/metermaids/cdr.c (original)
+++ team/oej/metermaids/cdr.c Mon Feb 13 03:57:22 2006
@@ -1,7 +1,7 @@
/*
* Asterisk -- An open source telephony toolkit.
*
- * Copyright (C) 1999 - 2005, Digium, Inc.
+ * Copyright (C) 1999 - 2006, Digium, Inc.
*
* Mark Spencer <markster at digium.com>
*
@@ -1119,7 +1119,6 @@
int was_enabled;
int was_batchmode;
int res=0;
- pthread_attr_t attr;
ast_mutex_lock(&cdr_batch_lock);
@@ -1180,9 +1179,7 @@
if it does not exist */
if (enabled && batchmode && (!was_enabled || !was_batchmode) && (cdr_thread == AST_PTHREADT_NULL)) {
ast_cond_init(&cdr_pending_cond, NULL);
- pthread_attr_init(&attr);
- pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
- if (ast_pthread_create(&cdr_thread, &attr, do_cdr, NULL) < 0) {
+ if (ast_pthread_create(&cdr_thread, NULL, do_cdr, NULL) < 0) {
ast_log(LOG_ERROR, "Unable to start CDR thread.\n");
ast_sched_del(sched, cdr_sched);
} else {
Modified: team/oej/metermaids/channel.c
URL: http://svn.digium.com/view/asterisk/team/oej/metermaids/channel.c?rev=9746&r1=9745&r2=9746&view=diff
==============================================================================
--- team/oej/metermaids/channel.c (original)
+++ team/oej/metermaids/channel.c Mon Feb 13 03:57:22 2006
@@ -2376,6 +2376,8 @@
ast_set_callerid(chan, oh->cid_num, oh->cid_name, oh->cid_num);
if (oh->parent_channel)
ast_channel_inherit_variables(oh->parent_channel, chan);
+ if (oh->account)
+ ast_cdr_setaccount(chan, oh->account);
}
ast_set_callerid(chan, cid_num, cid_name, cid_num);
Modified: team/oej/metermaids/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/oej/metermaids/channels/chan_iax2.c?rev=9746&r1=9745&r2=9746&view=diff
==============================================================================
--- team/oej/metermaids/channels/chan_iax2.c (original)
+++ team/oej/metermaids/channels/chan_iax2.c Mon Feb 13 03:57:22 2006
@@ -9508,6 +9508,7 @@
ast_channel_unregister(&iax2_tech);
delete_users();
iax_provision_unload();
+ sched_context_destroy(sched);
return 0;
}
Modified: team/oej/metermaids/channels/chan_mgcp.c
URL: http://svn.digium.com/view/asterisk/team/oej/metermaids/channels/chan_mgcp.c?rev=9746&r1=9745&r2=9746&view=diff
==============================================================================
--- team/oej/metermaids/channels/chan_mgcp.c (original)
+++ team/oej/metermaids/channels/chan_mgcp.c Mon Feb 13 03:57:22 2006
@@ -1,7 +1,7 @@
/*
* Asterisk -- An open source telephony toolkit.
*
- * Copyright (C) 1999 - 2005, Digium, Inc.
+ * Copyright (C) 1999 - 2006, Digium, Inc.
*
* Mark Spencer <markster at digium.com>
*
@@ -3469,10 +3469,6 @@
static int restart_monitor(void)
{
- pthread_attr_t attr;
- pthread_attr_init(&attr);
- pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
-
/* If we're supposed to be stopped -- stay stopped */
if (monitor_thread == AST_PTHREADT_STOP)
return 0;
@@ -3490,7 +3486,7 @@
pthread_kill(monitor_thread, SIGURG);
} else {
/* Start a new monitor */
- if (ast_pthread_create(&monitor_thread, &attr, do_monitor, NULL) < 0) {
+ if (ast_pthread_create(&monitor_thread, NULL, do_monitor, NULL) < 0) {
ast_mutex_unlock(&monlock);
ast_log(LOG_ERROR, "Unable to start monitor thread.\n");
return -1;
@@ -4392,6 +4388,7 @@
ast_cli_unregister(&cli_debug);
ast_cli_unregister(&cli_no_debug);
ast_cli_unregister(&cli_mgcp_reload);
+ sched_context_destroy(sched);
return 0;
}
Modified: team/oej/metermaids/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/oej/metermaids/channels/chan_sip.c?rev=9746&r1=9745&r2=9746&view=diff
==============================================================================
--- team/oej/metermaids/channels/chan_sip.c (original)
+++ team/oej/metermaids/channels/chan_sip.c Mon Feb 13 03:57:22 2006
@@ -11421,7 +11421,6 @@
/*! \brief restart_monitor: Start the channel monitor thread ---*/
static int restart_monitor(void)
{
- pthread_attr_t attr;
/* If we're supposed to be stopped -- stay stopped */
if (monitor_thread == AST_PTHREADT_STOP)
return 0;
@@ -11438,10 +11437,8 @@
/* Wake up the thread */
pthread_kill(monitor_thread, SIGURG);
} else {
- pthread_attr_init(&attr);
- pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
/* Start a new monitor */
- if (ast_pthread_create(&monitor_thread, &attr, do_monitor, NULL) < 0) {
+ if (ast_pthread_create(&monitor_thread, NULL, do_monitor, NULL) < 0) {
ast_mutex_unlock(&monlock);
ast_log(LOG_ERROR, "Unable to start monitor thread.\n");
return -1;
@@ -13319,6 +13316,7 @@
clear_realm_authentication(authl);
clear_sip_domains();
close(sipsock);
+ sched_context_destroy(sched);
return 0;
}
Modified: team/oej/metermaids/devicestate.c
URL: http://svn.digium.com/view/asterisk/team/oej/metermaids/devicestate.c?rev=9746&r1=9745&r2=9746&view=diff
==============================================================================
--- team/oej/metermaids/devicestate.c (original)
+++ team/oej/metermaids/devicestate.c Mon Feb 13 03:57:22 2006
@@ -1,7 +1,7 @@
/*
* Asterisk -- An open source telephony toolkit.
*
- * Copyright (C) 1999 - 2005, Digium, Inc.
+ * Copyright (C) 1999 - 2006, Digium, Inc.
*
* Mark Spencer <markster at digium.com>
*
@@ -272,12 +272,8 @@
/*--- ast_device_state_engine_init: Initialize the device state engine in separate thread */
int ast_device_state_engine_init(void)
{
- pthread_attr_t attr;
-
ast_cond_init(&change_pending, NULL);
- pthread_attr_init(&attr);
- pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
- if (ast_pthread_create(&change_thread, &attr, do_devstate_changes, NULL) < 0) {
+ if (ast_pthread_create(&change_thread, NULL, do_devstate_changes, NULL) < 0) {
ast_log(LOG_ERROR, "Unable to start device state change thread.\n");
return -1;
}
Modified: team/oej/metermaids/dnsmgr.c
URL: http://svn.digium.com/view/asterisk/team/oej/metermaids/dnsmgr.c?rev=9746&r1=9745&r2=9746&view=diff
==============================================================================
--- team/oej/metermaids/dnsmgr.c (original)
+++ team/oej/metermaids/dnsmgr.c Mon Feb 13 03:57:22 2006
@@ -1,7 +1,7 @@
/*
* Asterisk -- An open source telephony toolkit.
*
- * Copyright (C) 2005, Kevin P. Fleming
+ * Copyright (C) 2005-2006, Kevin P. Fleming
*
* Kevin P. Fleming <kpfleming at digium.com>
*
@@ -343,9 +343,7 @@
/* if this reload enabled the manager, create the background thread
if it does not exist */
if (enabled && !was_enabled && (refresh_thread == AST_PTHREADT_NULL)) {
- pthread_attr_init(&attr);
- pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
- if (ast_pthread_create(&refresh_thread, &attr, do_refresh, NULL) < 0) {
+ if (ast_pthread_create(&refresh_thread, NULL, do_refresh, NULL) < 0) {
ast_log(LOG_ERROR, "Unable to start refresh thread.\n");
}
else {
Modified: team/oej/metermaids/include/asterisk/channel.h
URL: http://svn.digium.com/view/asterisk/team/oej/metermaids/include/asterisk/channel.h?rev=9746&r1=9745&r2=9746&view=diff
==============================================================================
--- team/oej/metermaids/include/asterisk/channel.h (original)
+++ team/oej/metermaids/include/asterisk/channel.h Mon Feb 13 03:57:22 2006
@@ -469,6 +469,7 @@
oh.priority = priority; \
oh.cid_num = cid_num; \
oh.cid_name = cid_name; \
+ oh.account = account; \
oh.vars = vars; \
oh.parent_channel = NULL; \
}
@@ -479,6 +480,7 @@
int priority;
const char *cid_num;
const char *cid_name;
+ const char *account;
struct ast_variable *vars;
struct ast_channel *parent_channel;
};
Modified: team/oej/metermaids/include/asterisk/manager.h
URL: http://svn.digium.com/view/asterisk/team/oej/metermaids/include/asterisk/manager.h?rev=9746&r1=9745&r2=9746&view=diff
==============================================================================
--- team/oej/metermaids/include/asterisk/manager.h (original)
+++ team/oej/metermaids/include/asterisk/manager.h Mon Feb 13 03:57:22 2006
@@ -56,8 +56,8 @@
#define EVENT_FLAG_USER (1 << 6) /* Ability to read/set user info */
/* Export manager structures */
-#define MAX_HEADERS 80
-#define MAX_LEN 256
+#define AST_MAX_MANHEADERS 80
+#define AST_MAX_MANHEADER_LEN 256
struct eventqent {
struct eventqent *next;
@@ -88,7 +88,7 @@
/*! Authorization for writing */
int writeperm;
/*! Buffer */
- char inbuf[MAX_LEN];
+ char inbuf[AST_MAX_MANHEADER_LEN];
int inlen;
int send_events;
/* Queued events that we've not had the ability to send yet */
@@ -101,7 +101,7 @@
struct message {
int hdrcount;
- char headers[MAX_HEADERS][MAX_LEN];
+ char headers[AST_MAX_MANHEADERS][AST_MAX_MANHEADER_LEN];
};
struct manager_action {
Modified: team/oej/metermaids/include/asterisk/pbx.h
URL: http://svn.digium.com/view/asterisk/team/oej/metermaids/include/asterisk/pbx.h?rev=9746&r1=9745&r2=9746&view=diff
==============================================================================
--- team/oej/metermaids/include/asterisk/pbx.h (original)
+++ team/oej/metermaids/include/asterisk/pbx.h Mon Feb 13 03:57:22 2006
@@ -563,11 +563,11 @@
/* Synchronously or asynchronously make an outbound call and send it to a
particular extension */
-int ast_pbx_outgoing_exten(const char *type, int format, void *data, int timeout, const char *context, const char *exten, int priority, int *reason, int sync, const char *cid_num, const char *cid_name, struct ast_variable *vars, struct ast_channel **locked_channel);
+int ast_pbx_outgoing_exten(const char *type, int format, void *data, int timeout, const char *context, const char *exten, int priority, int *reason, int sync, const char *cid_num, const char *cid_name, struct ast_variable *vars, const char *account, struct ast_channel **locked_channel);
/* Synchronously or asynchronously make an outbound call and send it to a
particular application with given extension */
-int ast_pbx_outgoing_app(const char *type, int format, void *data, int timeout, const char *app, const char *appdata, int *reason, int sync, const char *cid_num, const char *cid_name, struct ast_variable *vars, struct ast_channel **locked_channel);
+int ast_pbx_outgoing_app(const char *type, int format, void *data, int timeout, const char *app, const char *appdata, int *reason, int sync, const char *cid_num, const char *cid_name, struct ast_variable *vars, const char *account, struct ast_channel **locked_channel);
/* Functions for returning values from structures */
const char *ast_get_context_name(struct ast_context *con);
Modified: team/oej/metermaids/manager.c
URL: http://svn.digium.com/view/asterisk/team/oej/metermaids/manager.c?rev=9746&r1=9745&r2=9746&view=diff
==============================================================================
--- team/oej/metermaids/manager.c (original)
+++ team/oej/metermaids/manager.c Mon Feb 13 03:57:22 2006
@@ -66,16 +66,17 @@
#include "asterisk/utils.h"
struct fast_originate_helper {
- char tech[256];
- char data[256];
+ char tech[AST_MAX_MANHEADER_LEN];
+ char data[AST_MAX_MANHEADER_LEN];
int timeout;
- char app[256];
- char appdata[256];
- char cid_name[256];
- char cid_num[256];
- char context[256];
- char exten[256];
- char idtext[256];
+ char app[AST_MAX_APP];
+ char appdata[AST_MAX_MANHEADER_LEN];
+ char cid_name[AST_MAX_MANHEADER_LEN];
+ char cid_num[AST_MAX_MANHEADER_LEN];
+ char context[AST_MAX_CONTEXT];
+ char exten[AST_MAX_EXTENSION];
+ char idtext[AST_MAX_MANHEADER_LEN];
+ char account[AST_MAX_ACCOUNT_CODE];
int priority;
struct ast_variable *vars;
};
@@ -941,12 +942,12 @@
res = ast_pbx_outgoing_app(in->tech, AST_FORMAT_SLINEAR, in->data, in->timeout, in->app, in->appdata, &reason, 1,
!ast_strlen_zero(in->cid_num) ? in->cid_num : NULL,
!ast_strlen_zero(in->cid_name) ? in->cid_name : NULL,
- in->vars, &chan);
+ 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,
!ast_strlen_zero(in->cid_num) ? in->cid_num : NULL,
!ast_strlen_zero(in->cid_name) ? in->cid_name : NULL,
- in->vars, &chan);
+ in->vars, in->account, &chan);
}
/* Tell the manager what happened with the channel */
@@ -1048,12 +1049,6 @@
if (ast_strlen_zero(l))
l = NULL;
}
- if (account) {
- struct ast_variable *newvar;
- newvar = ast_variable_new("CDR(accountcode|r)", account);
- newvar->next = vars;
- vars = newvar;
- }
if (ast_true(async)) {
struct fast_originate_helper *fast = malloc(sizeof(struct fast_originate_helper));
if (!fast) {
@@ -1073,6 +1068,7 @@
fast->vars = vars;
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->timeout = to;
fast->priority = pi;
pthread_attr_init(&attr);
@@ -1084,10 +1080,10 @@
}
}
} else if (!ast_strlen_zero(app)) {
- res = ast_pbx_outgoing_app(tech, AST_FORMAT_SLINEAR, data, to, app, appdata, &reason, 1, l, n, vars, NULL);
+ res = ast_pbx_outgoing_app(tech, AST_FORMAT_SLINEAR, 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, NULL);
+ res = ast_pbx_outgoing_exten(tech, AST_FORMAT_SLINEAR, 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;
@@ -1406,7 +1402,7 @@
if (process_message(s, &m))
break;
memset(&m, 0, sizeof(m));
- } else if (m.hdrcount < MAX_HEADERS - 1)
+ } else if (m.hdrcount < AST_MAX_MANHEADERS - 1)
m.hdrcount++;
} else if (res < 0)
break;
Modified: team/oej/metermaids/pbx.c
URL: http://svn.digium.com/view/asterisk/team/oej/metermaids/pbx.c?rev=9746&r1=9745&r2=9746&view=diff
==============================================================================
--- team/oej/metermaids/pbx.c (original)
+++ team/oej/metermaids/pbx.c Mon Feb 13 03:57:22 2006
@@ -4864,7 +4864,7 @@
return 0; /* success */
}
-int ast_pbx_outgoing_exten(const char *type, int format, void *data, int timeout, const char *context, const char *exten, int priority, int *reason, int sync, const char *cid_num, const char *cid_name, struct ast_variable *vars, struct ast_channel **channel)
+int ast_pbx_outgoing_exten(const char *type, int format, void *data, int timeout, const char *context, const char *exten, int priority, int *reason, int sync, const char *cid_num, const char *cid_name, struct ast_variable *vars, const char *account, struct ast_channel **channel)
{
struct ast_channel *chan;
struct async_stat *as;
@@ -4881,7 +4881,7 @@
ast_mutex_lock(&chan->lock);
}
if (chan) {
- if(chan->cdr) { /* check if the channel already has a cdr record, if not give it one */
+ if (chan->cdr) { /* check if the channel already has a cdr record, if not give it one */
ast_log(LOG_WARNING, "%s already has a call record??\n", chan->name);
} else {
chan->cdr = ast_cdr_alloc(); /* allocate a cdr for the channel */
@@ -4958,6 +4958,8 @@
ast_copy_string(chan->exten, "failed", sizeof(chan->exten));
chan->priority = 1;
ast_set_variables(chan, vars);
+ if (account)
+ ast_cdr_setaccount(chan, account);
ast_pbx_run(chan);
} else
ast_log(LOG_WARNING, "Can't allocate the channel structure, skipping execution of extension 'failed'\n");
@@ -4987,6 +4989,8 @@
as->priority = priority;
as->timeout = timeout;
ast_set_variables(chan, vars);
+ if (account)
+ ast_cdr_setaccount(chan, account);
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
if (ast_pthread_create(&as->p, &attr, async_wait, as)) {
@@ -5028,7 +5032,7 @@
return NULL;
}
-int ast_pbx_outgoing_app(const char *type, int format, void *data, int timeout, const char *app, const char *appdata, int *reason, int sync, const char *cid_num, const char *cid_name, struct ast_variable *vars, struct ast_channel **locked_channel)
+int ast_pbx_outgoing_app(const char *type, int format, void *data, int timeout, const char *app, const char *appdata, int *reason, int sync, const char *cid_num, const char *cid_name, struct ast_variable *vars, const char *account, struct ast_channel **locked_channel)
{
struct ast_channel *chan;
struct async_stat *as;
@@ -5036,9 +5040,10 @@
int res = -1, cdr_res = -1;
struct outgoing_helper oh;
pthread_attr_t attr;
-
+
memset(&oh, 0, sizeof(oh));
- oh.vars = vars;
+ oh.vars = vars;
+ oh.account = account;
if (locked_channel)
*locked_channel = NULL;
@@ -5065,6 +5070,8 @@
ast_cdr_start(chan->cdr);
}
ast_set_variables(chan, vars);
+ if (account)
+ ast_cdr_setaccount(chan, account);
if (chan->_state == AST_STATE_UP) {
res = 0;
if (option_verbose > 3)
@@ -5144,6 +5151,8 @@
ast_copy_string(as->appdata, appdata, sizeof(as->appdata));
as->timeout = timeout;
ast_set_variables(chan, vars);
+ if (account)
+ ast_cdr_setaccount(chan, account);
/* Start a new thread, and get something handling this channel. */
pthread_attr_init(&attr);
pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
Modified: team/oej/metermaids/pbx/pbx_dundi.c
URL: http://svn.digium.com/view/asterisk/team/oej/metermaids/pbx/pbx_dundi.c?rev=9746&r1=9745&r2=9746&view=diff
==============================================================================
--- team/oej/metermaids/pbx/pbx_dundi.c (original)
+++ team/oej/metermaids/pbx/pbx_dundi.c Mon Feb 13 03:57:22 2006
@@ -4726,6 +4726,7 @@
ast_unregister_switch(&dundi_switch);
ast_custom_function_unregister(&dundi_function);
res = ast_unregister_application(app);
+ sched_context_destroy(sched);
return res;
}
Modified: team/oej/metermaids/pbx/pbx_spool.c
URL: http://svn.digium.com/view/asterisk/team/oej/metermaids/pbx/pbx_spool.c?rev=9746&r1=9745&r2=9746&view=diff
==============================================================================
--- team/oej/metermaids/pbx/pbx_spool.c (original)
+++ team/oej/metermaids/pbx/pbx_spool.c Mon Feb 13 03:57:22 2006
@@ -85,6 +85,9 @@
/* CallerID Information */
char cid_num[256];
char cid_name[256];
+
+ /* account code */
+ char account[AST_MAX_ACCOUNT_CODE];
/* Variables and Functions */
struct ast_variable *vars;
@@ -211,11 +214,7 @@
} else
ast_log(LOG_WARNING, "Malformed \"%s\" argument. Should be \"%s: variable=value\"\n", buf, buf);
} else if (!strcasecmp(buf, "account")) {
- var = ast_variable_new("CDR(accountcode|r)", c);
- if (var) {
- var->next = o->vars;
- o->vars = var;
- }
+ ast_copy_string(o->account, c, sizeof(o->account));
} else {
ast_log(LOG_WARNING, "Unknown keyword '%s' at line %d of %s\n", buf, lineno, fn);
}
@@ -259,11 +258,11 @@
if (!ast_strlen_zero(o->app)) {
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_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, AST_FORMAT_SLINEAR, o->dest, o->waittime * 1000, o->app, o->data, &reason, 2 /* wait to finish */, o->cid_num, o->cid_name, o->vars, NULL);
+ res = ast_pbx_outgoing_app(o->tech, AST_FORMAT_SLINEAR, 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);
} else {
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_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, AST_FORMAT_SLINEAR, o->dest, o->waittime * 1000, o->context, o->exten, o->priority, &reason, 2 /* wait to finish */, o->cid_num, o->cid_name, o->vars, NULL);
+ res = ast_pbx_outgoing_exten(o->tech, AST_FORMAT_SLINEAR, 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);
}
if (res) {
ast_log(LOG_NOTICE, "Call failed to go through, reason %d\n", reason);
More information about the asterisk-commits
mailing list