[asterisk-commits] branch oej/astum r9748 - in /team/oej/astum: ./
apps/ channels/ channels/misd...
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Mon Feb 13 02:59:02 MST 2006
Author: oej
Date: Mon Feb 13 03:58:19 2006
New Revision: 9748
URL: http://svn.digium.com/view/asterisk?rev=9748&view=rev
Log:
Update
Added:
team/oej/astum/codecs/gsm/libgsm.vcproj
- copied unchanged from r9508, trunk/codecs/gsm/libgsm.vcproj
team/oej/astum/codecs/ilbc/libilbc.vcproj
- copied unchanged from r9508, trunk/codecs/ilbc/libilbc.vcproj
team/oej/astum/codecs/lpc10/liblpc10.vcproj
- copied unchanged from r9508, trunk/codecs/lpc10/liblpc10.vcproj
team/oej/astum/configs/smdi.conf.sample
- copied unchanged from r9508, trunk/configs/smdi.conf.sample
team/oej/astum/doc/smdi.txt
- copied unchanged from r9508, trunk/doc/smdi.txt
team/oej/astum/include/asterisk/smdi.h
- copied unchanged from r9508, trunk/include/asterisk/smdi.h
team/oej/astum/res/res_smdi.c
- copied unchanged from r9508, trunk/res/res_smdi.c
Removed:
team/oej/astum/funcs/pbx_functions.c
Modified:
team/oej/astum/ (props changed)
team/oej/astum/Makefile
team/oej/astum/UPGRADE.txt
team/oej/astum/apps/Makefile
team/oej/astum/apps/app_osplookup.c
team/oej/astum/apps/app_voicemail.c
team/oej/astum/cdr.c
team/oej/astum/channel.c
team/oej/astum/channels/Makefile
team/oej/astum/channels/chan_iax2.c
team/oej/astum/channels/chan_local.c
team/oej/astum/channels/chan_mgcp.c
team/oej/astum/channels/chan_misdn.c
team/oej/astum/channels/chan_oss.c
team/oej/astum/channels/chan_sip.c
team/oej/astum/channels/chan_zap.c
team/oej/astum/channels/misdn/ (props changed)
team/oej/astum/channels/misdn/isdn_lib.c
team/oej/astum/cli.c
team/oej/astum/codecs/gsm/src/add.c
team/oej/astum/codecs/gsm/src/code.c
team/oej/astum/codecs/gsm/src/decode.c
team/oej/astum/codecs/gsm/src/long_term.c
team/oej/astum/codecs/gsm/src/lpc.c
team/oej/astum/codecs/gsm/src/preprocess.c
team/oej/astum/codecs/gsm/src/rpe.c
team/oej/astum/codecs/gsm/src/short_term.c
team/oej/astum/codecs/lpc10/bsynz.c
team/oej/astum/codecs/lpc10/decode.c
team/oej/astum/codecs/lpc10/encode.c
team/oej/astum/codecs/lpc10/energy.c
team/oej/astum/codecs/lpc10/f2clib.c
team/oej/astum/codecs/lpc10/irc2pc.c
team/oej/astum/codecs/lpc10/lpc10.h
team/oej/astum/codecs/lpc10/onset.c
team/oej/astum/codecs/lpc10/pitsyn.c
team/oej/astum/codecs/lpc10/tbdm.c
team/oej/astum/codecs/lpc10/voicin.c
team/oej/astum/codecs/lpc10/vparms.c
team/oej/astum/config.c
team/oej/astum/configs/voicemail.conf.sample
team/oej/astum/configs/zapata.conf.sample
team/oej/astum/db.c
team/oej/astum/devicestate.c
team/oej/astum/dnsmgr.c
team/oej/astum/doc/channelvariables.txt
team/oej/astum/funcs/Makefile
team/oej/astum/funcs/func_base64.c (contents, props changed)
team/oej/astum/funcs/func_callerid.c
team/oej/astum/funcs/func_cdr.c
team/oej/astum/funcs/func_cut.c
team/oej/astum/funcs/func_db.c
team/oej/astum/funcs/func_enum.c
team/oej/astum/funcs/func_env.c
team/oej/astum/funcs/func_groupcount.c
team/oej/astum/funcs/func_language.c
team/oej/astum/funcs/func_logic.c
team/oej/astum/funcs/func_math.c
team/oej/astum/funcs/func_md5.c
team/oej/astum/funcs/func_moh.c
team/oej/astum/funcs/func_odbc.c
team/oej/astum/funcs/func_rand.c
team/oej/astum/funcs/func_sha1.c (contents, props changed)
team/oej/astum/funcs/func_strings.c
team/oej/astum/funcs/func_timeout.c
team/oej/astum/funcs/func_uri.c
team/oej/astum/include/asterisk/callerid.h
team/oej/astum/include/asterisk/channel.h
team/oej/astum/res/Makefile
Propchange: team/oej/astum/
------------------------------------------------------------------------------
Binary property 'branch-1.2-blocked' - no diff available.
Propchange: team/oej/astum/
------------------------------------------------------------------------------
Binary property 'branch-1.2-merged' - no diff available.
Propchange: team/oej/astum/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Mon Feb 13 03:58:19 2006
@@ -1,1 +1,1 @@
-/trunk:1-9274
+/trunk:1-9512
Modified: team/oej/astum/Makefile
URL: http://svn.digium.com/view/asterisk/team/oej/astum/Makefile?rev=9748&r1=9747&r2=9748&view=diff
==============================================================================
--- team/oej/astum/Makefile (original)
+++ team/oej/astum/Makefile Mon Feb 13 03:58:19 2006
@@ -72,6 +72,11 @@
#ifneq ($(CROSS_COMPILE),)
#OPTIONS += -DLOW_MEMORY
#endif
+
+#
+# Asterisk SMDI integration
+#
+WITH_SMDI = 1
# Optional debugging parameters
DEBUG_THREADS = #-DDUMP_SCHEDULER #-DDEBUG_SCHEDULER #-DDEBUG_THREADS #-DDO_CRASH #-DDETECT_DEADLOCKS
Modified: team/oej/astum/UPGRADE.txt
URL: http://svn.digium.com/view/asterisk/team/oej/astum/UPGRADE.txt?rev=9748&r1=9747&r2=9748&view=diff
==============================================================================
--- team/oej/astum/UPGRADE.txt (original)
+++ team/oej/astum/UPGRADE.txt Mon Feb 13 03:58:19 2006
@@ -35,6 +35,11 @@
* The function ${CHECK_MD5()} has been deprecated in favor of using an
expression: $[${MD5(<string>)} = ${saved_md5}].
+* The 'builtin' functions that used to be combined in pbx_functions.so are
+ now built as separate modules. If you are not using 'autoload=yes' in your
+ modules.conf file then you will need to explicitly load the modules that
+ contain the functions you want to use.
+
The SIP channel:
* The "incominglimit" setting is replaced by the "call-limit" setting in sip.conf.
Modified: team/oej/astum/apps/Makefile
URL: http://svn.digium.com/view/asterisk/team/oej/astum/apps/Makefile?rev=9748&r1=9747&r2=9748&view=diff
==============================================================================
--- team/oej/astum/apps/Makefile (original)
+++ team/oej/astum/apps/Makefile Mon Feb 13 03:58:19 2006
@@ -59,7 +59,12 @@
APPS+=app_sms.so
endif
+# Asterisk SMDI integration
#
+ifeq (${WITH_SMDI},1)
+CFLAGS+=-DWITH_SMDI
+endif
+
# If you have UnixODBC you can use ODBC voicemail
# storage
#
Modified: team/oej/astum/apps/app_osplookup.c
URL: http://svn.digium.com/view/asterisk/team/oej/astum/apps/app_osplookup.c?rev=9748&r1=9747&r2=9748&view=diff
==============================================================================
--- team/oej/astum/apps/app_osplookup.c (original)
+++ team/oej/astum/apps/app_osplookup.c Mon Feb 13 03:58:19 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>
*
@@ -184,6 +184,7 @@
int res=0;
struct localuser *u;
char *temp;
+ const char *val;
int cause;
struct ast_osp_result result;
int priority_jump = 0;
@@ -212,11 +213,11 @@
}
cause = str2cause(args.cause);
- temp = pbx_builtin_getvar_helper(chan, "OSPHANDLE");
+ val = pbx_builtin_getvar_helper(chan, "OSPHANDLE");
result.handle = -1;
- if (!ast_strlen_zero(temp) && (sscanf(temp, "%d", &result.handle) == 1) && (result.handle > -1)) {
- temp = pbx_builtin_getvar_helper(chan, "OSPRESULTS");
- if (ast_strlen_zero(temp) || (sscanf(temp, "%d", &result.numresults) != 1)) {
+ if (!ast_strlen_zero(val) && (sscanf(val, "%d", &result.handle) == 1) && (result.handle > -1)) {
+ val = pbx_builtin_getvar_helper(chan, "OSPRESULTS");
+ if (ast_strlen_zero(val) || (sscanf(val, "%d", &result.numresults) != 1)) {
result.numresults = 0;
}
if ((res = ast_osp_next(&result, cause)) > 0) {
@@ -255,6 +256,7 @@
int res=0;
struct localuser *u;
char *temp;
+ const char *val;
int cause;
time_t start=0, duration=0;
struct ast_osp_result result;
@@ -293,9 +295,9 @@
ast_log(LOG_WARNING, "OSPFinish called on channel '%s' with no CDR!\n", chan->name);
cause = str2cause(args.status);
- temp = pbx_builtin_getvar_helper(chan, "OSPHANDLE");
+ val = pbx_builtin_getvar_helper(chan, "OSPHANDLE");
result.handle = -1;
- if (!ast_strlen_zero(temp) && (sscanf(temp, "%d", &result.handle) == 1) && (result.handle > -1)) {
+ if (!ast_strlen_zero(val) && (sscanf(val, "%d", &result.handle) == 1) && (result.handle > -1)) {
if (!ast_osp_terminate(result.handle, cause, start, duration)) {
pbx_builtin_setvar_helper(chan, "_OSPHANDLE", "");
pbx_builtin_setvar_helper(chan, "OSPFINISHSTATUS", "SUCCESS");
Modified: team/oej/astum/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/oej/astum/apps/app_voicemail.c?rev=9748&r1=9747&r2=9748&view=diff
==============================================================================
--- team/oej/astum/apps/app_voicemail.c (original)
+++ team/oej/astum/apps/app_voicemail.c Mon Feb 13 03:58:19 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>
*
@@ -73,6 +73,10 @@
#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
@@ -393,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;
@@ -2318,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 {
@@ -5842,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;
@@ -5951,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';
}
Modified: team/oej/astum/cdr.c
URL: http://svn.digium.com/view/asterisk/team/oej/astum/cdr.c?rev=9748&r1=9747&r2=9748&view=diff
==============================================================================
--- team/oej/astum/cdr.c (original)
+++ team/oej/astum/cdr.c Mon Feb 13 03:58:19 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>
*
@@ -1181,8 +1181,6 @@
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) {
ast_log(LOG_ERROR, "Unable to start CDR thread.\n");
ast_sched_del(sched, cdr_sched);
Modified: team/oej/astum/channel.c
URL: http://svn.digium.com/view/asterisk/team/oej/astum/channel.c?rev=9748&r1=9747&r2=9748&view=diff
==============================================================================
--- team/oej/astum/channel.c (original)
+++ team/oej/astum/channel.c Mon Feb 13 03:58:19 2006
@@ -164,6 +164,22 @@
{ AST_CAUSE_INTERWORKING, "Interworking, unspecified" },
};
+
+struct ast_variable *ast_channeltype_list(void)
+{
+ struct chanlist *cl;
+ struct ast_variable *var=NULL, *prev = NULL;
+ AST_LIST_TRAVERSE(&backends, cl, list) {
+ if (prev) {
+ if ((prev->next = ast_variable_new(cl->tech->type, cl->tech->description)))
+ prev = prev->next;
+ } else {
+ var = ast_variable_new(cl->tech->type, cl->tech->description);
+ prev = var;
+ }
+ }
+ return var;
+}
static int show_channeltypes(int fd, int argc, char *argv[])
{
Modified: team/oej/astum/channels/Makefile
URL: http://svn.digium.com/view/asterisk/team/oej/astum/channels/Makefile?rev=9748&r1=9747&r2=9748&view=diff
==============================================================================
--- team/oej/astum/channels/Makefile (original)
+++ team/oej/astum/channels/Makefile Mon Feb 13 03:58:19 2006
@@ -63,6 +63,13 @@
ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/linux/ixjuser.h)$(wildcard $(CROSS_COMPILE_TARGET)/usr/local/include/ixjuser.h),)
CHANNEL_LIBS+=chan_phone.so
+endif
+
+#
+# Asterisk SMDI integration
+#
+ifeq (${WITH_SMDI},1)
+CFLAGS+=-DWITH_SMDI
endif
ifneq ($(wildcard h323/libchanh323.a),)
Modified: team/oej/astum/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/oej/astum/channels/chan_iax2.c?rev=9748&r1=9747&r2=9748&view=diff
==============================================================================
--- team/oej/astum/channels/chan_iax2.c (original)
+++ team/oej/astum/channels/chan_iax2.c Mon Feb 13 03:58:19 2006
@@ -234,7 +234,8 @@
enum {
IAX_STATE_STARTED = (1 << 0),
IAX_STATE_AUTHENTICATED = (1 << 1),
- IAX_STATE_TBD = (1 << 2)
+ IAX_STATE_TBD = (1 << 2),
+ IAX_STATE_UNCHANGED = (1 << 3),
} iax2_state;
struct iax2_context {
@@ -5011,7 +5012,7 @@
int x;
int expire = 0;
- ast_clear_flag(&iaxs[callno]->state, IAX_STATE_AUTHENTICATED);
+ ast_clear_flag(&iaxs[callno]->state, IAX_STATE_AUTHENTICATED | IAX_STATE_UNCHANGED);
iaxs[callno]->peer[0] = '\0';
if (ies->username)
ast_copy_string(peer, ies->username, sizeof(peer));
@@ -5056,6 +5057,8 @@
destroy_peer(p);
return -1;
}
+ if (!inaddrcmp(&p->addr, sin))
+ ast_set_flag(&iaxs[callno]->state, IAX_STATE_UNCHANGED);
ast_copy_string(iaxs[callno]->secret, p->secret, sizeof(iaxs[callno]->secret));
ast_copy_string(iaxs[callno]->inkeys, p->inkeys, sizeof(iaxs[callno]->inkeys));
/* Check secret against what we have on file */
@@ -7362,7 +7365,8 @@
auth_fail(fr.callno, IAX_COMMAND_REGREJ);
break;
}
- if ((ast_strlen_zero(iaxs[fr.callno]->secret) && ast_strlen_zero(iaxs[fr.callno]->inkeys)) || ast_test_flag(&iaxs[fr.callno]->state, IAX_STATE_AUTHENTICATED)) {
+ if ((ast_strlen_zero(iaxs[fr.callno]->secret) && ast_strlen_zero(iaxs[fr.callno]->inkeys)) ||
+ ast_test_flag(&iaxs[fr.callno]->state, IAX_STATE_AUTHENTICATED | IAX_STATE_UNCHANGED)) {
if (f.subclass == IAX_COMMAND_REGREL)
memset(&sin, 0, sizeof(sin));
if (update_registry(iaxs[fr.callno]->peer, &sin, fr.callno, ies.devicetype, fd, ies.refresh))
Modified: team/oej/astum/channels/chan_local.c
URL: http://svn.digium.com/view/asterisk/team/oej/astum/channels/chan_local.c?rev=9748&r1=9747&r2=9748&view=diff
==============================================================================
--- team/oej/astum/channels/chan_local.c (original)
+++ team/oej/astum/channels/chan_local.c Mon Feb 13 03:58:19 2006
@@ -69,9 +69,6 @@
#define IS_OUTBOUND(a,b) (a == b->chan ? 1 : 0)
-/* Protect the interface list (of sip_pvt's) */
-AST_MUTEX_DEFINE_STATIC(locallock);
-
static struct ast_channel *local_request(const char *type, int format, void *data, int *cause);
static int local_digit(struct ast_channel *ast, char digit);
static int local_call(struct ast_channel *ast, char *dest, int timeout);
@@ -101,7 +98,7 @@
.send_html = local_sendhtml,
};
-static struct local_pvt {
+struct local_pvt {
ast_mutex_t lock; /* Channel private lock */
char context[AST_MAX_CONTEXT]; /* Context to call */
char exten[AST_MAX_EXTENSION]; /* Extension to call */
@@ -113,8 +110,10 @@
int nooptimization; /* Don't leave masq state */
struct ast_channel *owner; /* Master Channel */
struct ast_channel *chan; /* Outbound channel */
- struct local_pvt *next; /* Next entity */
-} *locals = NULL;
+ AST_LIST_ENTRY(local_pvt) list; /* Next entity */
+};
+
+static AST_LIST_HEAD_STATIC(locals, local_pvt);
static int local_queue_frame(struct local_pvt *p, int isoutbound, struct ast_frame *f, struct ast_channel *us)
{
@@ -357,23 +356,19 @@
#if 0
static void local_destroy(struct local_pvt *p)
{
- struct local_pvt *cur, *prev = NULL;
- ast_mutex_lock(&locallock);
- cur = locals;
- while(cur) {
+ struct local_pvt *cur;
+
+ AST_LIST_LOCK(&locals);
+ AST_LIST_TRAVERSE_SAFE_BEGIN(&locals, cur, list) {
if (cur == p) {
- if (prev)
- prev->next = cur->next;
- else
- locals = cur->next;
- ast_mutex_destroy(cur);
+ AST_LIST_REMOVE_CURRENT(&locals, list);
+ ast_mutex_destroy(&cur->lock);
free(cur);
break;
}
- prev = cur;
- cur = cur->next;
- }
- ast_mutex_unlock(&locallock);
+ }
+ AST_LIST_TRAVERSE_SAFE_END
+ AST_LIST_UNLOCK(&locals);
if (!cur)
ast_log(LOG_WARNING, "Unable ot find local '%s@%s' in local list\n", p->exten, p->context);
}
@@ -385,7 +380,6 @@
struct local_pvt *p = ast->tech_pvt;
int isoutbound;
struct ast_frame f = { AST_FRAME_CONTROL, AST_CONTROL_HANGUP };
- struct local_pvt *cur, *prev=NULL;
struct ast_channel *ochan = NULL;
int glaredetect;
const char *status;
@@ -415,20 +409,9 @@
p->cancelqueue = 1;
ast_mutex_unlock(&p->lock);
/* Remove from list */
- ast_mutex_lock(&locallock);
- cur = locals;
- while(cur) {
- if (cur == p) {
- if (prev)
- prev->next = cur->next;
- else
- locals = cur->next;
- break;
- }
- prev = cur;
- cur = cur->next;
- }
- ast_mutex_unlock(&locallock);
+ AST_LIST_LOCK(&locals);
+ AST_LIST_REMOVE(&locals, p, list);
+ AST_LIST_UNLOCK(&locals);
/* Grab / release lock just in case */
ast_mutex_lock(&p->lock);
ast_mutex_unlock(&p->lock);
@@ -484,10 +467,9 @@
tmp = NULL;
} else {
/* Add to list */
- ast_mutex_lock(&locallock);
- tmp->next = locals;
- locals = tmp;
- ast_mutex_unlock(&locallock);
+ AST_LIST_LOCK(&locals);
+ AST_LIST_INSERT_HEAD(&locals, tmp, list);
+ AST_LIST_UNLOCK(&locals);
}
return tmp;
@@ -563,17 +545,15 @@
if (argc != 3)
return RESULT_SHOWUSAGE;
- ast_mutex_lock(&locallock);
- p = locals;
- while(p) {
+ if (AST_LIST_EMPTY(&locals))
+ ast_cli(fd, "No local channels in use\n");
+ AST_LIST_LOCK(&locals);
+ AST_LIST_TRAVERSE(&locals, p, list) {
ast_mutex_lock(&p->lock);
ast_cli(fd, "%s -- %s@%s\n", p->owner ? p->owner->name : "<unowned>", p->exten, p->context);
ast_mutex_unlock(&p->lock);
- p = p->next;
- }
- if (!locals)
- ast_cli(fd, "No local channels in use\n");
- ast_mutex_unlock(&locallock);
+ }
+ AST_LIST_UNLOCK(&locals);
return RESULT_SUCCESS;
}
@@ -611,16 +591,14 @@
/* First, take us out of the channel loop */
ast_cli_unregister(&cli_show_locals);
ast_channel_unregister(&local_tech);
- if (!ast_mutex_lock(&locallock)) {
+ if (!AST_LIST_LOCK(&locals)) {
/* Hangup all interfaces if they have an owner */
- p = locals;
- while(p) {
+ AST_LIST_TRAVERSE(&locals, p, list) {
if (p->owner)
ast_softhangup(p->owner, AST_SOFTHANGUP_APPUNLOAD);
- p = p->next;
}
- locals = NULL;
- ast_mutex_unlock(&locallock);
+ AST_LIST_UNLOCK(&locals);
+ AST_LIST_HEAD_DESTROY(&locals);
} else {
ast_log(LOG_WARNING, "Unable to lock the monitor\n");
return -1;
Modified: team/oej/astum/channels/chan_mgcp.c
URL: http://svn.digium.com/view/asterisk/team/oej/astum/channels/chan_mgcp.c?rev=9748&r1=9747&r2=9748&view=diff
==============================================================================
--- team/oej/astum/channels/chan_mgcp.c (original)
+++ team/oej/astum/channels/chan_mgcp.c Mon Feb 13 03:58:19 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>
*
@@ -3528,10 +3528,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;
@@ -3549,7 +3545,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;
Modified: team/oej/astum/channels/chan_misdn.c
URL: http://svn.digium.com/view/asterisk/team/oej/astum/channels/chan_misdn.c?rev=9748&r1=9747&r2=9748&view=diff
==============================================================================
--- team/oej/astum/channels/chan_misdn.c (original)
+++ team/oej/astum/channels/chan_misdn.c Mon Feb 13 03:58:19 2006
@@ -120,6 +120,7 @@
MISDN_EXTCANTMATCH, /*!< when asterisk couldnt match our ext */
MISDN_DIALING, /*!< when pbx_start */
MISDN_PROGRESS, /*!< we got a progress */
+ MISDN_PROCEEDING, /*!< we got a progress */
MISDN_CALLING, /*!< when misdn_call is called */
MISDN_CALLING_ACKNOWLEDGE, /*!< when we get SETUP_ACK */
MISDN_ALERTING, /*!< when Alerting */
@@ -158,6 +159,8 @@
int ast_dsp;
+ int jb_len;
+ int jb_upper_threshold;
struct misdn_jb *jb;
struct ast_dsp *dsp;
@@ -595,27 +598,29 @@
return NULL;
}
-static int misdn_reload (int fd, int argc, char *argv[])
+
+
+void reload_config(void)
{
int i, cfg_debug;
-
- ast_cli(fd, "Reloading mISDN Config\n");
chan_misdn_log(-1, 0, "Dynamic Crypting Activation is not support during reload at the moment\n");
free_robin_list();
-
misdn_cfg_reload();
-
misdn_cfg_update_ptp();
-
misdn_cfg_get( 0, MISDN_GEN_TRACEFILE, global_tracefile, BUFFERSIZE);
-
misdn_cfg_get( 0, MISDN_GEN_DEBUG, &cfg_debug, sizeof(int));
+
for (i = 0; i <= max_ports; i++) {
misdn_debug[i] = cfg_debug;
misdn_debug_only[i] = 0;
}
-
+}
+
+static int misdn_reload (int fd, int argc, char *argv[])
+{
+ ast_cli(fd, "Reloading mISDN Config\n");
+ reload_config();
return 0;
}
@@ -1138,6 +1143,40 @@
}
+
+
+void config_jitterbuffer(struct chan_list *ch)
+{
+ struct misdn_bchannel *bc=ch->bc;
+ int len=ch->jb_len, threshold=ch->jb_upper_threshold;
+
+ chan_misdn_log(1,bc->port, "config_jb: Called\n");
+
+ if ( ! len ) {
+ chan_misdn_log(1,bc->port, "config_jb: Deactivating Jitterbuffer\n");
+ bc->nojitter=1;
+ } else {
+
+ if (len <=100 || len > 8000) {
+ chan_misdn_log(-1,bc->port,"config_jb: Jitterbuffer out of Bounds, setting to 1000\n");
+ len=1000;
+ }
+
+ if ( threshold > len ) {
+ chan_misdn_log(-1,bc->port,"config_jb: Jitterbuffer Threshold > Jitterbuffer setting to Jitterbuffer -1\n");
+ }
+
+ if ( ch->jb) {
+ cb_log(0,bc->port,"config_jb: We've got a Jitterbuffer Already on this port.\n");
+ misdn_jb_destroy(ch->jb);
+ ch->jb=NULL;
+ }
+
+ ch->jb=misdn_jb_init(len, threshold);
+ }
+}
+
+
static int read_config(struct chan_list *ch, int orig) {
if (!ch) {
@@ -1178,33 +1217,10 @@
/*Initialize new Jitterbuffer*/
{
- int jb_len,jb_upper_threshold;
- misdn_cfg_get( port, MISDN_CFG_JITTERBUFFER, &jb_len, sizeof(int));
- misdn_cfg_get( port, MISDN_CFG_JITTERBUFFER_UPPER_THRESHOLD, &jb_upper_threshold, sizeof(int));
-
- if ( ! jb_len ) {
- chan_misdn_log(1,bc->port, "read_config: Deactivating Jitterbuffer\n");
- bc->nojitter=1;
- } else {
-
- if (jb_len <=100 || jb_len > 8000) {
- chan_misdn_log(-1,bc->port,"read_config: Jitterbuffer out of Bounds, setting to 1000\n");
- jb_len=1000;
- }
-
- if ( jb_upper_threshold > jb_len ) {
- chan_misdn_log(-1,bc->port,"read_config: Jitterbuffer Threshold > Jitterbuffer setting to Jitterbuffer -1\n");
- }
-
-
- if ( ch->jb) {
- cb_log(0,bc->port,"read_config: We've got a Jitterbuffer Already on this port.\n");
- misdn_jb_destroy(ch->jb);
- ch->jb=NULL;
- }
-
- ch->jb=misdn_jb_init(jb_len, jb_upper_threshold);
- }
+ misdn_cfg_get( port, MISDN_CFG_JITTERBUFFER, &ch->jb_len, sizeof(int));
+ misdn_cfg_get( port, MISDN_CFG_JITTERBUFFER_UPPER_THRESHOLD, &ch->jb_upper_threshold, sizeof(int));
+
+ config_jitterbuffer(ch);
}
misdn_cfg_get( bc->port, MISDN_CFG_CONTEXT, ch->context, sizeof(ch->context));
@@ -1760,7 +1776,11 @@
break;
case -1 :
chan_misdn_log(1, p->bc->port, " --> * IND :\t-1! (stop indication) pid:%d\n",p->bc?p->bc->pid:-1);
- tone_indicate(p, TONE_NONE);
+
+ if (p->state == MISDN_CONNECTED)
+ start_bc_tones(p);
+ else
+ tone_indicate(p, TONE_NONE);
break;
case AST_CONTROL_HOLD:
@@ -1858,6 +1878,8 @@
break;
case MISDN_ALERTING:
+ case MISDN_PROGRESS:
+ case MISDN_PROCEEDING:
chan_misdn_log(2, bc->port, " --> * State Alerting\n");
if (p->orginator != ORG_AST)
@@ -3262,6 +3284,8 @@
start_bc_tones(ch);
}
+ ch->state = MISDN_PROCEEDING;
+
ast_queue_control(ch->ast, AST_CONTROL_PROCEEDING);
}
break;
@@ -3727,6 +3751,13 @@
return 0;
}
+int reload(void)
+{
+ reload_config();
+
+ return 0;
+}
+
int usecount(void)
{
int res;
@@ -3800,6 +3831,7 @@
int keyidx=0;
int rxgain=0;
int txgain=0;
+ int change_jitter=0;
if (strcasecmp(chan->tech->type,"mISDN")) {
ast_log(LOG_WARNING, "misdn_set_opt makes only sense with chan_misdn channels!\n");
@@ -3834,8 +3866,32 @@
break;
case 'j':
- chan_misdn_log(1, ch->bc->port, "SETOPT: No jitter\n");
- ch->bc->nojitter=1;
+ chan_misdn_log(1, ch->bc->port, "SETOPT: jitter\n");
+ tok++;
+ change_jitter=1;
+
+ switch ( tok[0] ) {
+ case 'b' :
+ ch->jb_len=atoi(++tok);
+ chan_misdn_log(1, ch->bc->port, " --> buffer_len:%d\n",ch->jb_len);
+ break;
+ case 't' :
+ ch->jb_upper_threshold=atoi(++tok);
+ chan_misdn_log(1, ch->bc->port, " --> upper_threshold:%d\n",ch->jb_upper_threshold);
+ break;
+
+ case 'n':
+ ch->bc->nojitter=1;
+ chan_misdn_log(1, ch->bc->port, " --> nojitter\n");
+ break;
+
+ default:
+ ch->jb_len=1000;
+ ch->jb_upper_threshold=0;
+ chan_misdn_log(1, ch->bc->port, " --> buffer_len:%d (default)\n",ch->jb_len);
+ chan_misdn_log(1, ch->bc->port, " --> upper_threshold:%d (default)\n",ch->jb_upper_threshold);
+ }
+
break;
case 'v':
@@ -3879,6 +3935,7 @@
chan_misdn_log(1, ch->bc->port, "SETOPT: EchoCancel\n");
if (neglect) {
+ chan_misdn_log(1, ch->bc->port, " --> disabled\n");
ch->bc->ec_enable=0;
} else {
ch->bc->ec_enable=1;
@@ -3933,6 +3990,10 @@
break;
}
}
+
+ if (change_jitter)
+ config_jitterbuffer(ch);
+
if (ch->faxdetect || ch->ast_dsp) {
Modified: team/oej/astum/channels/chan_oss.c
URL: http://svn.digium.com/view/asterisk/team/oej/astum/channels/chan_oss.c?rev=9748&r1=9747&r2=9748&view=diff
==============================================================================
--- team/oej/astum/channels/chan_oss.c (original)
+++ team/oej/astum/channels/chan_oss.c Mon Feb 13 03:58:19 2006
@@ -34,6 +34,7 @@
#include <stdio.h>
#include <ctype.h> /* for isalnum */
+#include <math.h> /* exp and log */
#include <string.h>
#include <unistd.h>
#include <sys/ioctl.h>
@@ -90,6 +91,7 @@
* where 'foo' is the name of the card you want.
*
* oss.conf parameters are
+START_CONFIG
[general]
; general config options, default values are shown
@@ -109,6 +111,9 @@
; mixer="-f /dev/mixer0 pcm 80 ; mixer command to run on start
; queuesize=10 ; frames in device driver
; frags=8 ; argument to SETFRAGMENT
+; boost = n ; mic volume boost in dB
+
+END_CONFIG
.. and so on for the other cards.
@@ -280,6 +285,13 @@
int overridecontext;
int mute;
+
+ /* boost support. BOOST_SCALE * 10 ^(BOOST_MAX/20) must
+ * be representable in 16 bits to avoid overflows.
+ */
+#define BOOST_SCALE (1<<9)
+#define BOOST_MAX 40 /* slightly less than 7 bits */
+ int boost; /* input boost, scaled by BOOST_SCALE */
char device[64]; /* device to open */
pthread_t sthread;
@@ -314,6 +326,7 @@
.ctx = "default",
.readpos = AST_FRIENDLY_OFFSET, /* start here on reads */
.lastopen = { 0, 0 },
+ .boost = BOOST_SCALE,
};
static char *oss_active; /* the active device */
@@ -354,11 +367,13 @@
static struct chan_oss_pvt *find_desc(char *dev)
{
struct chan_oss_pvt *o;
-
- for (o = oss_default.next; o && strcmp(o->name, dev) != 0; o = o->next)
+ if (dev == NULL)
+ ast_log(LOG_WARNING, "null dev\n");
+
+ for (o = oss_default.next; o && o->name && dev && strcmp(o->name, dev) != 0; o = o->next)
;
if (o == NULL)
- ast_log(LOG_WARNING, "could not find <%s>\n", dev);
+ ast_log(LOG_WARNING, "could not find <%s>\n", dev ? dev : "--no-device--");
return o;
}
@@ -698,8 +713,8 @@
struct chan_oss_pvt *o = c->tech_pvt;
struct ast_frame f = { 0, };
- ast_verbose(" << Call to '%s' on console from <%s><%s><%s> >>\n",
- dest, c->cid.cid_dnid, c->cid.cid_num, c->cid.cid_name);
+ ast_verbose(" << Call to device '%s' dnid '%s' rdnis '%s' on console from '%s' <%s> >>\n",
+ dest, c->cid.cid_dnid, c->cid.cid_rdnis, c->cid.cid_name, c->cid.cid_num);
if (o->autoanswer) {
ast_verbose( " << Auto-answered >> \n" );
f.frametype = AST_FRAME_CONTROL;
@@ -803,6 +818,7 @@
struct chan_oss_pvt *o = c->tech_pvt;
struct ast_frame *f = &o->read_f;
+ /* XXX can be simplified returning &ast_null_frame */
/* prepare a NULL frame in case we don't have enough data to return */
bzero(f, sizeof(struct ast_frame));
f->frametype = AST_FRAME_NULL;
@@ -829,6 +845,19 @@
f->samples = FRAME_SIZE;
f->datalen = FRAME_SIZE * 2;
f->data = o->oss_read_buf + AST_FRIENDLY_OFFSET;
+ if (o->boost != BOOST_SCALE) { /* scale and clip values */
+ int i, x;
+ int16_t *p = (int16_t *)f->data;
+ for (i = 0; i < f->samples; i++) {
+ x = (p[i] * o->boost) / BOOST_SCALE;
+ if (x > 32767)
+ x = 32767;
+ else if (x < -32768)
+ x = -32768;
+ p[i] = x;
+ }
+ }
+
f->offset = AST_FRIENDLY_OFFSET;
return f;
}
@@ -884,6 +913,8 @@
return NULL;
c->tech = &oss_tech;
ast_string_field_build(c, name, "OSS/%s", o->device + 5);
+ if (o->sounddev < 0)
+ setformat(o, O_RDWR);
c->fds[0] = o->sounddev; /* -1 if device closed, override later */
c->nativeformats = AST_FORMAT_SLINEAR;
c->readformat = AST_FORMAT_SLINEAR;
@@ -900,6 +931,8 @@
c->cid.cid_num = ast_strdup(o->cid_num);
if (!ast_strlen_zero(o->cid_name))
c->cid.cid_name = ast_strdup(o->cid_name);
+ if (!ast_strlen_zero(ext))
+ c->cid.cid_dnid = strdup(ext);
o->owner = c;
ast_setstate(c, state);
@@ -1026,14 +1059,13 @@
" Sends a text message for display on the remote terminal.\n";
/*
- * concatenate all arguments into a single string
+ * concatenate all arguments into a single string. argv is NULL-terminated
+ * so we can use it right away
*/
static int console_sendtext(int fd, int argc, char *argv[])
{
struct chan_oss_pvt *o = find_desc(oss_active);
- int tmparg = 2;
- char text2send[TEXT_SIZE] = "";
- struct ast_frame f = { 0, };
+ char buf[TEXT_SIZE];
if (argc < 2)
return RESULT_SHOWUSAGE;
@@ -1041,18 +1073,15 @@
ast_cli(fd, "Not in a call\n");
return RESULT_FAILURE;
}
- while (tmparg < argc) {
- strncat(text2send, argv[tmparg++],
- sizeof(text2send) - strlen(text2send) - 1);
- strncat(text2send, " ",
- sizeof(text2send) - strlen(text2send) - 1);
- }
- if (!ast_strlen_zero(text2send)) {
- text2send[strlen(text2send) - 1] = '\n';
+ ast_join(buf, sizeof(buf) - 1, argv+2);
+ if (!ast_strlen_zero(buf)) {
+ struct ast_frame f = { 0, };
+ int i = strlen(buf);
+ buf[i] = '\n';
f.frametype = AST_FRAME_TEXT;
f.subclass = 0;
- f.data = text2send;
- f.datalen = strlen(text2send);
+ f.data = buf;
+ f.datalen = i + 1;
ast_queue_frame(o->owner, &f);
}
return RESULT_SUCCESS;
@@ -1247,6 +1276,42 @@
return RESULT_SUCCESS;
}
+/*
+ * store the boost factor
+ */
+static void store_boost(struct chan_oss_pvt *o, char *s)
+{
+ double boost = 0;
+ if (sscanf(s, "%lf", &boost) != 1) {
+ ast_log(LOG_WARNING, "invalid boost <%s>\n", s);
+ return;
+ }
+ if (boost < - BOOST_MAX) {
+ ast_log(LOG_WARNING, "boost %s too small, using %d\n",
+ s, -BOOST_MAX);
+ boost = -BOOST_MAX;
+ } else if (boost > BOOST_MAX) {
+ ast_log(LOG_WARNING, "boost %s too large, using %d\n",
+ s, BOOST_MAX);
+ boost = BOOST_MAX;
+ }
+ boost = exp(log(10)*boost/20) * BOOST_SCALE;
+ o->boost = boost;
+ ast_log(LOG_WARNING, "setting boost %s to %d\n", s, o->boost);
+}
+
+static int do_boost(int fd, int argc, char *argv[])
+{
+ struct chan_oss_pvt *o = find_desc(oss_active);
+
+ if (argc == 2)
+ ast_cli(fd, "boost currently %5.1f\n",
+ 20 * log10(((double)o->boost/(double)BOOST_SCALE)) );
+ else if (argc == 3)
+ store_boost(o, argv[2]);
+ return RESULT_SUCCESS;
+}
+
static struct ast_cli_entry myclis[] = {
{ { "answer", NULL }, console_answer, "Answer an incoming console call", answer_usage },
{ { "hangup", NULL }, console_hangup, "Hangup a call on the console", hangup_usage },
@@ -1257,6 +1322,7 @@
{ { "transfer", NULL }, console_transfer, "Transfer a call to a different extension", transfer_usage },
{ { "send", "text", NULL }, console_sendtext, "Send text to the remote device", sendtext_usage },
{ { "autoanswer", NULL }, console_autoanswer, "Sets/displays autoanswer", autoanswer_usage, autoanswer_complete },
+ { { "oss", "boost", NULL }, do_boost, "Sets/displays mic boost in dB"},
{ { "console", NULL }, console_active, "Sets/displays active console", console_usage },
};
@@ -1331,6 +1397,7 @@
M_STR("extension", o->ext)
M_F("mixer", store_mixer(o, v->value))
M_F("callerid", store_callerid(o, v->value))
+ M_F("boost", store_boost(o, v->value))
M_END(;);
}
if (ast_strlen_zero(o->device))
Modified: team/oej/astum/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/oej/astum/channels/chan_sip.c?rev=9748&r1=9747&r2=9748&view=diff
==============================================================================
--- team/oej/astum/channels/chan_sip.c (original)
+++ team/oej/astum/channels/chan_sip.c Mon Feb 13 03:58:19 2006
@@ -11447,7 +11447,6 @@
/*! \brief 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;
@@ -11464,10 +11463,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;
Modified: team/oej/astum/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/team/oej/astum/channels/chan_zap.c?rev=9748&r1=9747&r2=9748&view=diff
==============================================================================
--- team/oej/astum/channels/chan_zap.c (original)
+++ team/oej/astum/channels/chan_zap.c Mon Feb 13 03:58:19 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>
*
@@ -101,6 +101,11 @@
#include "asterisk/utils.h"
#include "asterisk/transcap.h"
#include "asterisk/stringfields.h"
+#ifdef WITH_SMDI
+#include "asterisk/smdi.h"
+#include "asterisk/astobj.h"
+#define SMDI_MD_WAIT_TIMEOUT 1500 /* 1.5 seconds */
+#endif
#ifndef ZT_SIG_HARDHDLC
#error "Your zaptel is too old. please update"
@@ -279,7 +284,10 @@
static int amaflags = 0;
static int adsi = 0;
-
+#ifdef WITH_SMDI
+static int use_smdi = 0;
+static char smdi_port[SMDI_MAX_FILENAME_LEN] = "/dev/ttyS0";
+#endif
static int numbufs = 4;
static int cur_prewink = -1;
@@ -604,6 +612,10 @@
unsigned int hasr2call:1;
unsigned int r2blocked:1;
unsigned int sigchecked:1;
+#endif
+#ifdef WITH_SMDI
+ unsigned int use_smdi:1; /* Whether to use SMDI on this channel */
+ struct ast_smdi_interface *smdi_iface; /* The serial port to listen for SMDI data on */
#endif
struct zt_distRings drings;
@@ -2165,6 +2177,10 @@
p->prev->next = p->next;
if(p->next)
p->next->prev = p->prev;
+#ifdef WITH_SMDI
+ if(p->use_smdi)
+ ASTOBJ_UNREF(p->smdi_iface, ast_smdi_interface_destroy);
+#endif
ast_mutex_destroy(&p->lock);
free(p);
*pvt = NULL;
@@ -5274,7 +5290,7 @@
unsigned char buf[256];
char dtmfcid[300];
char dtmfbuf[300];
- struct callerid_state *cs;
+ struct callerid_state *cs=NULL;
char *name=NULL, *number=NULL;
int distMatches;
int curRingData[3];
@@ -5282,7 +5298,9 @@
int counter1;
int counter;
int samples = 0;
-
+#ifdef WITH_SMDI
+ struct ast_smdi_md_message *smdi_msg = NULL;
+#endif
int flags;
int i;
int timeout;
@@ -5928,10 +5946,35 @@
}
}
#endif
+#ifdef WITH_SMDI
+ /* check for SMDI messages */
+ if (p->use_smdi && p->smdi_iface) {
+ smdi_msg = ast_smdi_md_message_wait(p->smdi_iface, SMDI_MD_WAIT_TIMEOUT);
+
+ if (smdi_msg != NULL) {
+ ast_copy_string(chan->exten, smdi_msg->fwd_st, sizeof(chan->exten));
+
+ if (smdi_msg->type == 'B')
+ pbx_builtin_setvar_helper(chan, "_SMDI_VM_TYPE", "b");
+ else if (smdi_msg->type == 'N')
+ pbx_builtin_setvar_helper(chan, "_SMDI_VM_TYPE", "u");
+
+ ast_log(LOG_DEBUG, "Recieved SMDI message on %s\n", chan->name);
+ } else {
+ ast_log(LOG_WARNING, "SMDI enabled but no SMDI message present\n");
+ }
+ }
+
+ if (p->use_callerid && (p->cid_signalling == CID_SIG_SMDI && smdi_msg)) {
+ number = smdi_msg->calling_st;
+
[... 5649 lines stripped ...]
More information about the asterisk-commits
mailing list