[svn-commits] russell: branch jamesgolovich/chan_sip-ast_str r101529 - in /team/jamesgolovi...
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Thu Jan 31 14:35:25 CST 2008
Author: russell
Date: Thu Jan 31 14:35:24 2008
New Revision: 101529
URL: http://svn.digium.com/view/asterisk?view=rev&rev=101529
Log:
sync with trunk
Modified:
team/jamesgolovich/chan_sip-ast_str/ (props changed)
team/jamesgolovich/chan_sip-ast_str/.cleancount
team/jamesgolovich/chan_sip-ast_str/CHANGES
team/jamesgolovich/chan_sip-ast_str/Makefile
team/jamesgolovich/chan_sip-ast_str/apps/app_controlplayback.c
team/jamesgolovich/chan_sip-ast_str/apps/app_queue.c
team/jamesgolovich/chan_sip-ast_str/apps/app_rpt.c
team/jamesgolovich/chan_sip-ast_str/apps/app_speech_utils.c
team/jamesgolovich/chan_sip-ast_str/apps/app_voicemail.c
team/jamesgolovich/chan_sip-ast_str/build_tools/make_defaults_h
team/jamesgolovich/chan_sip-ast_str/build_tools/make_version
team/jamesgolovich/chan_sip-ast_str/channels/chan_agent.c
team/jamesgolovich/chan_sip-ast_str/channels/chan_h323.c
team/jamesgolovich/chan_sip-ast_str/channels/chan_iax2.c
team/jamesgolovich/chan_sip-ast_str/channels/chan_local.c
team/jamesgolovich/chan_sip-ast_str/channels/chan_mgcp.c
team/jamesgolovich/chan_sip-ast_str/channels/chan_misdn.c
team/jamesgolovich/chan_sip-ast_str/channels/chan_sip.c
team/jamesgolovich/chan_sip-ast_str/channels/chan_zap.c
team/jamesgolovich/chan_sip-ast_str/channels/misdn_config.c
team/jamesgolovich/chan_sip-ast_str/configs/cli.conf.sample
team/jamesgolovich/chan_sip-ast_str/configs/extensions.conf.sample
team/jamesgolovich/chan_sip-ast_str/configure
team/jamesgolovich/chan_sip-ast_str/configure.ac
team/jamesgolovich/chan_sip-ast_str/funcs/func_realtime.c
team/jamesgolovich/chan_sip-ast_str/include/asterisk/app.h
team/jamesgolovich/chan_sip-ast_str/include/asterisk/channel.h
team/jamesgolovich/chan_sip-ast_str/include/asterisk/dial.h
team/jamesgolovich/chan_sip-ast_str/include/asterisk/rtp.h
team/jamesgolovich/chan_sip-ast_str/include/asterisk/sched.h
team/jamesgolovich/chan_sip-ast_str/main/Makefile
team/jamesgolovich/chan_sip-ast_str/main/cdr.c
team/jamesgolovich/chan_sip-ast_str/main/channel.c
team/jamesgolovich/chan_sip-ast_str/main/dial.c
team/jamesgolovich/chan_sip-ast_str/main/dnsmgr.c
team/jamesgolovich/chan_sip-ast_str/main/features.c
team/jamesgolovich/chan_sip-ast_str/main/file.c
team/jamesgolovich/chan_sip-ast_str/main/logger.c
team/jamesgolovich/chan_sip-ast_str/main/pbx.c
team/jamesgolovich/chan_sip-ast_str/main/rtp.c
team/jamesgolovich/chan_sip-ast_str/main/slinfactory.c
team/jamesgolovich/chan_sip-ast_str/pbx/pbx_dundi.c
team/jamesgolovich/chan_sip-ast_str/res/res_config_curl.c
Propchange: team/jamesgolovich/chan_sip-ast_str/
------------------------------------------------------------------------------
Binary property 'branch-1.4-blocked' - no diff available.
Propchange: team/jamesgolovich/chan_sip-ast_str/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.
Propchange: team/jamesgolovich/chan_sip-ast_str/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Thu Jan 31 14:35:24 2008
@@ -1,1 +1,1 @@
-/trunk:1-100242
+/trunk:1-101528
Modified: team/jamesgolovich/chan_sip-ast_str/.cleancount
URL: http://svn.digium.com/view/asterisk/team/jamesgolovich/chan_sip-ast_str/.cleancount?view=diff&rev=101529&r1=101528&r2=101529
==============================================================================
--- team/jamesgolovich/chan_sip-ast_str/.cleancount (original)
+++ team/jamesgolovich/chan_sip-ast_str/.cleancount Thu Jan 31 14:35:24 2008
@@ -1,1 +1,1 @@
-34
+35
Modified: team/jamesgolovich/chan_sip-ast_str/CHANGES
URL: http://svn.digium.com/view/asterisk/team/jamesgolovich/chan_sip-ast_str/CHANGES?view=diff&rev=101529&r1=101528&r2=101529
==============================================================================
--- team/jamesgolovich/chan_sip-ast_str/CHANGES (original)
+++ team/jamesgolovich/chan_sip-ast_str/CHANGES Thu Jan 31 14:35:24 2008
@@ -159,7 +159,7 @@
* Added separate settings for media QoS in mgcp.conf
Console Channel Driver changes
--------------------
+------------------------------
* Added experimental support for video send & receive to chan_oss.
This requires SDL and ffmpeg/avcodec, plus Video4Linux or X11 to act as
a video source.
@@ -467,6 +467,8 @@
backend functionality.
* Added a new module, res_config_ldap, which permits the use of an LDAP
server for realtime data access.
+ * Added support for writing and running your dialplan in lua using the pbx_lua
+ module. See configs/extensions.lua.sample for examples of how to do this.
Miscellaneous
-------------
@@ -486,8 +488,6 @@
will now be available in the failed extension using the REASON dialplan variable.
* Added support for reading the TOUCH_MONITOR_PREFIX channel variable.
It allows you to configure a prefix for auto-monitor recordings.
- * Added support for writing and running your dialplan in lua. See
- configs/extensions.lua.sample for examples of how to do this.
* A new extension pattern matching algorithm, based on a trie, is introduced
here, that could noticeably speed up mid-sized to large dialplans.
It is NOT used by default, as duplicating the behaviour of the old pattern
@@ -502,3 +502,5 @@
* Added logging to 'make update' command. See update.log
* Added strictrtp option to rtp.conf. If enabled this will drop RTP packets that
do not come from the remote party.
+ * Added the 'n' option to the SpeechBackground application to tell it to not
+ answer the channel if it has not already been answered.
Modified: team/jamesgolovich/chan_sip-ast_str/Makefile
URL: http://svn.digium.com/view/asterisk/team/jamesgolovich/chan_sip-ast_str/Makefile?view=diff&rev=101529&r1=101528&r2=101529
==============================================================================
--- team/jamesgolovich/chan_sip-ast_str/Makefile (original)
+++ team/jamesgolovich/chan_sip-ast_str/Makefile Thu Jan 31 14:35:24 2008
@@ -57,6 +57,7 @@
export ASTSPOOLDIR
export ASTVARLIBDIR
export ASTDATADIR
+export ASTDBDIR
export ASTLOGDIR
export ASTLIBDIR
export ASTMANDIR
@@ -107,7 +108,9 @@
#Uncomment this to see all build commands instead of 'quiet' output
#NOISY_BUILD=yes
-ASTTOPDIR:=$(CURDIR)
+empty:=
+space:=$(empty) $(empty)
+ASTTOPDIR:=$(subst $(space),\$(space),$(CURDIR))
# Overwite config files on "make samples"
OVERWRITE=y
Modified: team/jamesgolovich/chan_sip-ast_str/apps/app_controlplayback.c
URL: http://svn.digium.com/view/asterisk/team/jamesgolovich/chan_sip-ast_str/apps/app_controlplayback.c?view=diff&rev=101529&r1=101528&r2=101529
==============================================================================
--- team/jamesgolovich/chan_sip-ast_str/apps/app_controlplayback.c (original)
+++ team/jamesgolovich/chan_sip-ast_str/apps/app_controlplayback.c Thu Jan 31 14:35:24 2008
@@ -78,6 +78,17 @@
return key == 35 || key == 42 || (key >= 48 && key <= 57);
}
+static int is_argument(const char *haystack, int needle)
+{
+ if (ast_strlen_zero(haystack))
+ return 0;
+
+ if (strchr(haystack, needle))
+ return -1;
+
+ return 0;
+}
+
static int controlplayback_exec(struct ast_channel *chan, void *data)
{
int res = 0;
@@ -114,10 +125,21 @@
skipms = args.skip ? (atoi(args.skip) ? atoi(args.skip) : 3000) : 3000;
- if (!args.fwd || !is_on_phonepad(*args.fwd))
- args.fwd = "#";
- if (!args.rev || !is_on_phonepad(*args.rev))
- args.rev = "*";
+ if (!args.fwd || !is_on_phonepad(*args.fwd)) {
+ char *digit = "#";
+ if (!is_argument(args.rev, *digit) && !is_argument(args.stop, *digit) && !is_argument(args.pause, *digit) && !is_argument(args.restart, *digit))
+ args.fwd = digit;
+ else
+ args.fwd = NULL;
+ }
+ if (!args.rev || !is_on_phonepad(*args.rev)) {
+ char *digit = "*";
+ if (!is_argument(args.fwd, *digit) && !is_argument(args.stop, *digit) && !is_argument(args.pause, *digit) && !is_argument(args.restart, *digit))
+ args.rev = digit;
+ else
+ args.rev = NULL;
+ }
+ ast_log(LOG_WARNING, "args.fwd = %s, args.rew = %s\n", args.fwd, args.rev);
if (args.stop && !is_on_phonepad(*args.stop))
args.stop = NULL;
if (args.pause && !is_on_phonepad(*args.pause))
Modified: team/jamesgolovich/chan_sip-ast_str/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/jamesgolovich/chan_sip-ast_str/apps/app_queue.c?view=diff&rev=101529&r1=101528&r2=101529
==============================================================================
--- team/jamesgolovich/chan_sip-ast_str/apps/app_queue.c (original)
+++ team/jamesgolovich/chan_sip-ast_str/apps/app_queue.c Thu Jan 31 14:35:24 2008
@@ -1306,7 +1306,7 @@
if ((m = create_queue_member(interface, membername, penalty, paused, state_interface))) {
m->dead = 0;
m->realtime = 1;
- add_to_interfaces(state_interface);
+ add_to_interfaces(m->state_interface);
ao2_link(q->members, m);
ao2_ref(m, -1);
m = NULL;
@@ -1555,8 +1555,7 @@
char *interface = NULL;
struct ao2_iterator mem_iter;
- member_config = ast_load_realtime_multientry("queue_members", "interface LIKE", "%", "queue_name", q->name , NULL);
- if (!member_config) {
+ if (!(member_config = ast_load_realtime_multientry("queue_members", "interface LIKE", "%", "queue_name", q->name , NULL))) {
/*This queue doesn't have realtime members*/
ast_debug(3, "Queue %s has no realtime members defined. No need for update\n", q->name);
return;
@@ -1591,6 +1590,7 @@
ao2_ref(m, -1);
}
ao2_unlock(q);
+ ast_config_destroy(member_config);
}
static int join_queue(char *queuename, struct queue_ent *qe, enum queue_result *reason)
@@ -2666,8 +2666,9 @@
ast_debug(1, "There are %d available members.\n", avl);
- while ((idx < avl) && (ch) && !ch->pending && (ch != qe)) {
- idx++;
+ while ((idx < avl) && (ch) && (ch != qe)) {
+ if (!ch->pending)
+ idx++;
ch = ch->next;
}
@@ -3708,7 +3709,7 @@
ao2_lock(q);
if ((old_member = interface_exists(q, interface)) == NULL) {
if ((new_member = create_queue_member(interface, membername, penalty, paused, state_interface))) {
- add_to_interfaces(state_interface);
+ add_to_interfaces(new_member->state_interface);
new_member->dynamic = 1;
ao2_link(q->members, new_member);
q->membercount++;
@@ -4007,7 +4008,7 @@
if (set_member_paused(args.queuename, args.interface, args.reason, 1)) {
ast_log(LOG_WARNING, "Attempt to pause interface %s, not found\n", args.interface);
pbx_builtin_setvar_helper(chan, "PQMSTATUS", "NOTFOUND");
- return -1;
+ return 0;
}
pbx_builtin_setvar_helper(chan, "PQMSTATUS", "PAUSED");
@@ -4042,7 +4043,7 @@
if (set_member_paused(args.queuename, args.interface, args.reason, 0)) {
ast_log(LOG_WARNING, "Attempt to unpause interface %s, not found\n", args.interface);
pbx_builtin_setvar_helper(chan, "UPQMSTATUS", "NOTFOUND");
- return -1;
+ return 0;
}
pbx_builtin_setvar_helper(chan, "UPQMSTATUS", "UNPAUSED");
Modified: team/jamesgolovich/chan_sip-ast_str/apps/app_rpt.c
URL: http://svn.digium.com/view/asterisk/team/jamesgolovich/chan_sip-ast_str/apps/app_rpt.c?view=diff&rev=101529&r1=101528&r2=101529
==============================================================================
--- team/jamesgolovich/chan_sip-ast_str/apps/app_rpt.c (original)
+++ team/jamesgolovich/chan_sip-ast_str/apps/app_rpt.c Thu Jan 31 14:35:24 2008
@@ -2675,7 +2675,7 @@
ast_copy_string(mychannel->context, myrpt->patchcontext, sizeof(mychannel->context));
if (myrpt->p.acctcode)
- ast_copy_string((char *)mychannel->accountcode, myrpt->p.acctcode, sizeof(mychannel->accountcode));
+ ast_string_field_set(mychannel, accountcode, myrpt->p.acctcode);
mychannel->priority = 1;
ast_channel_undefer_dtmf(mychannel);
if (ast_pbx_start(mychannel) < 0) {
@@ -4637,7 +4637,7 @@
{
char *s, *modestr;
const char *val;
- int i, j, ht, k, l, ls2, res, offset, offsave, modesave, defmode;
+ int i, j, ht, k, l, ls2, res, offset, offsave, modesave, defmode = 0;
char multimode = 0;
char oc;
char tmp[20], freq[20] = "", savestr[20] = "";
Modified: team/jamesgolovich/chan_sip-ast_str/apps/app_speech_utils.c
URL: http://svn.digium.com/view/asterisk/team/jamesgolovich/chan_sip-ast_str/apps/app_speech_utils.c?view=diff&rev=101529&r1=101528&r2=101529
==============================================================================
--- team/jamesgolovich/chan_sip-ast_str/apps/app_speech_utils.c (original)
+++ team/jamesgolovich/chan_sip-ast_str/apps/app_speech_utils.c Thu Jan 31 14:35:24 2008
@@ -56,15 +56,17 @@
"fed to it. This has no arguments.\n";
static char *speechbackground_descrip =
-" SpeechBackground(Sound File,Timeout):\n"
+" SpeechBackground(<Sound File>[,Timeout[,options]]):\n"
"This application plays a sound file and waits for the person to speak. Once they start speaking playback\n"
"of the file stops, and silence is heard. Once they stop talking the processing sound is played to indicate\n"
"the speech recognition engine is working. Once results are available the application returns and results \n"
"(score and text) are available using dialplan functions.\n"
-"The first text and score are ${SPEECH_TEXT(0)} AND ${SPEECH_SCORE(0)} while the second are ${SPEECH_TEXT(1)}\n"
+" The first text and score are ${SPEECH_TEXT(0)} AND ${SPEECH_SCORE(0)} while the second are ${SPEECH_TEXT(1)}\n"
"and ${SPEECH_SCORE(1)}.\n"
-"The first argument is the sound file and the second is the timeout integer in seconds. Note the timeout will\n"
-"only start once the sound file has stopped playing.\n";
+" The first argument is the sound file and the second is the timeout integer in seconds. Note the timeout will\n"
+"only start once the sound file has stopped playing. The third argument specifies options:\n"
+" Valid Options:\n"
+" n - Don't answer the channel if it has not already been answered.\n";
static char *speechdeactivategrammar_descrip =
" SpeechDeactivateGrammar(Grammar Name):\n"
@@ -487,6 +489,14 @@
return 0;
}
+enum {
+ SB_OPT_NOANSWER = (1 << 0),
+};
+
+AST_APP_OPTIONS(speech_background_options, BEGIN_OPTIONS
+ AST_APP_OPTION('n', SB_OPT_NOANSWER),
+END_OPTIONS );
+
/*! \brief SpeechBackground(Sound File,Timeout) Dialplan Application */
static int speech_background(struct ast_channel *chan, void *data)
{
@@ -500,9 +510,11 @@
struct ast_datastore *datastore = NULL;
char *parse, *filename_tmp = NULL, *filename = NULL, tmp[2] = "", dtmf_terminator = '#';
const char *tmp2 = NULL;
+ struct ast_flags options = { 0 };
AST_DECLARE_APP_ARGS(args,
AST_APP_ARG(soundfile);
AST_APP_ARG(timeout);
+ AST_APP_ARG(options);
);
parse = ast_strdupa(data);
@@ -511,9 +523,16 @@
if (speech == NULL)
return -1;
+ if (!ast_strlen_zero(args.options)) {
+ char *options_buf = ast_strdupa(args.options);
+ ast_app_parse_options(speech_background_options, &options, NULL, options_buf);
+ }
+
/* If channel is not already answered, then answer it */
- if (chan->_state != AST_STATE_UP && ast_answer(chan))
- return -1;
+ if (chan->_state != AST_STATE_UP && !ast_test_flag(&options, SB_OPT_NOANSWER)
+ && ast_answer(chan)) {
+ return -1;
+ }
/* Record old read format */
oldreadformat = chan->readformat;
Modified: team/jamesgolovich/chan_sip-ast_str/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/jamesgolovich/chan_sip-ast_str/apps/app_voicemail.c?view=diff&rev=101529&r1=101528&r2=101529
==============================================================================
--- team/jamesgolovich/chan_sip-ast_str/apps/app_voicemail.c (original)
+++ team/jamesgolovich/chan_sip-ast_str/apps/app_voicemail.c Thu Jan 31 14:35:24 2008
@@ -2244,36 +2244,55 @@
return ast_strftime(s, len, "%a %b %e %r UTC %Y", &tm);
}
-static int invent_message(struct ast_channel *chan, char *context, char *ext, int busy, char *ecodes)
+static int play_greeting(struct ast_channel *chan, struct ast_vm_user *vmu, char *filename, char *ecodes)
+{
+ int res = -2;
+
+#ifdef ODBC_STORAGE
+ int success =
+#endif
+ RETRIEVE(filename, -1, vmu->mailbox, vmu->context);
+ if (ast_fileexists(filename, NULL, NULL) > 0) {
+ res = ast_streamfile(chan, filename, chan->language);
+ if (res > -1)
+ res = ast_waitstream(chan, ecodes);
+#ifdef ODBC_STORAGE
+ if (success == -1) {
+ /* We couldn't retrieve the file from the database, but we found it on the file system. Let's put it in the database. */
+ ast_debug(1, "Greeting not retrieved from database, but found in file storage. Inserting into database\n");
+ store_file(filename, vmu->mailbox, vmu->context, -1);
+ }
+#endif
+ }
+ DISPOSE(filename, -1);
+
+ return res;
+}
+
+static int invent_message(struct ast_channel *chan, struct ast_vm_user *vmu, char *ext, int busy, char *ecodes)
{
int res;
char fn[PATH_MAX];
char dest[PATH_MAX];
- snprintf(fn, sizeof(fn), "%s%s/%s/greet", VM_SPOOL_DIR, context, ext);
-
- if ((res = create_dirpath(dest, sizeof(dest), context, ext, ""))) {
+ snprintf(fn, sizeof(fn), "%s%s/%s/greet", VM_SPOOL_DIR, vmu->context, ext);
+
+ if ((res = create_dirpath(dest, sizeof(dest), vmu->context, ext, ""))) {
ast_log(LOG_WARNING, "Failed to make directory(%s)\n", fn);
return -1;
}
- RETRIEVE(fn, -1, ext, context);
- if (ast_fileexists(fn, NULL, NULL) > 0) {
- res = ast_stream_and_wait(chan, fn, ecodes);
- if (res) {
- DISPOSE(fn, -1);
- return res;
- }
- } else {
- /* Dispose just in case */
- DISPOSE(fn, -1);
+ res = play_greeting(chan, vmu, fn, ecodes);
+ if (res == -2) {
+ /* File did not exist */
res = ast_stream_and_wait(chan, "vm-theperson", ecodes);
if (res)
return res;
res = ast_say_digit_str(chan, ext, ecodes, chan->language);
- if (res)
- return res;
- }
+ }
+ if (res)
+ return res;
+
res = ast_stream_and_wait(chan, busy ? "vm-isonphone" : "vm-isunavail", ecodes);
return res;
}
@@ -3100,25 +3119,12 @@
/* Play the beginning intro if desired */
if (!ast_strlen_zero(prefile)) {
-#ifdef ODBC_STORAGE
- int success =
-#endif
- RETRIEVE(prefile, -1, ext, context);
- if (ast_fileexists(prefile, NULL, NULL) > 0) {
- if (ast_streamfile(chan, prefile, chan->language) > -1)
- res = ast_waitstream(chan, ecodes);
-#ifdef ODBC_STORAGE
- if (success == -1) {
- /* We couldn't retrieve the file from the database, but we found it on the file system. Let's put it in the database. */
- ast_debug(1, "Greeting not retrieved from database, but found in file storage. Inserting into database\n");
- store_file(prefile, vmu->mailbox, vmu->context, -1);
- }
-#endif
- } else {
+ res = play_greeting(chan, vmu, prefile, ecodes);
+ if (res == -2) {
+ /* The file did not exist */
ast_debug(1, "%s doesn't exist, doing what we can\n", prefile);
- res = invent_message(chan, vmu->context, ext, ast_test_flag(options, OPT_BUSY_GREETING), ecodes);
- }
- DISPOSE(prefile, -1);
+ res = invent_message(chan, vmu, ext, ast_test_flag(options, OPT_BUSY_GREETING), ecodes);
+ }
if (res < 0) {
ast_debug(1, "Hang up during prefile playback\n");
free_user(vmu);
@@ -8034,10 +8040,11 @@
if (AST_LIST_EMPTY(&users)) {
astman_send_ack(s, m, "There are no voicemail users currently defined.");
AST_LIST_UNLOCK(&users);
+ astman_append(s, "Event: VoicemailUserEntryComplete\r\n%s\r\n", actionid);
return RESULT_SUCCESS;
}
- astman_send_ack(s, m, "Voicemail user list will follow\r\n");
+ astman_send_ack(s, m, "Voicemail user list will follow");
AST_LIST_TRAVERSE(&users, vmu, list) {
char dirname[256];
Modified: team/jamesgolovich/chan_sip-ast_str/build_tools/make_defaults_h
URL: http://svn.digium.com/view/asterisk/team/jamesgolovich/chan_sip-ast_str/build_tools/make_defaults_h?view=diff&rev=101529&r1=101528&r2=101529
==============================================================================
--- team/jamesgolovich/chan_sip-ast_str/build_tools/make_defaults_h (original)
+++ team/jamesgolovich/chan_sip-ast_str/build_tools/make_defaults_h Thu Jan 31 14:35:24 2008
@@ -17,7 +17,7 @@
#define DEFAULT_PID "${INSTALL_PATH}${ASTVARRUNDIR}/asterisk.pid"
#define DEFAULT_VAR_DIR "${INSTALL_PATH}${ASTVARLIBDIR}"
-#define DEFAULT_DB "${INSTALL_PATH}${ASTVARLIBDIR}/astdb"
+#define DEFAULT_DB "${INSTALL_PATH}${ASTDBDIR}/astdb"
#define DEFAULT_DATA_DIR "${INSTALL_PATH}${ASTDATADIR}"
#define DEFAULT_KEY_DIR "${INSTALL_PATH}${ASTDATADIR}/keys"
Modified: team/jamesgolovich/chan_sip-ast_str/build_tools/make_version
URL: http://svn.digium.com/view/asterisk/team/jamesgolovich/chan_sip-ast_str/build_tools/make_version?view=diff&rev=101529&r1=101528&r2=101529
==============================================================================
--- team/jamesgolovich/chan_sip-ast_str/build_tools/make_version (original)
+++ team/jamesgolovich/chan_sip-ast_str/build_tools/make_version Thu Jan 31 14:35:24 2008
@@ -19,6 +19,12 @@
for PART in $PARTS ; do
if [ ${TAG} != 0 ] ; then
+ if [ "${PART}" = "autotag_for_be" ] ; then
+ continue
+ fi
+ if [ "${PART}" = "autotag_for_sx00i" ] ; then
+ continue
+ fi
RESULT="${PART}"
break
fi
Modified: team/jamesgolovich/chan_sip-ast_str/channels/chan_agent.c
URL: http://svn.digium.com/view/asterisk/team/jamesgolovich/chan_sip-ast_str/channels/chan_agent.c?view=diff&rev=101529&r1=101528&r2=101529
==============================================================================
--- team/jamesgolovich/chan_sip-ast_str/channels/chan_agent.c (original)
+++ team/jamesgolovich/chan_sip-ast_str/channels/chan_agent.c Thu Jan 31 14:35:24 2008
@@ -1507,6 +1507,7 @@
long logintime;
int ret = -1; /* Return -1 if no agent if found */
+ AST_LIST_LOCK(&agents);
AST_LIST_TRAVERSE(&agents, p, list) {
if (!strcasecmp(p->agent, agent)) {
ret = 0;
@@ -1526,6 +1527,7 @@
break;
}
}
+ AST_LIST_UNLOCK(&agents);
return ret;
}
@@ -1592,20 +1594,26 @@
static char *complete_agent_logoff_cmd(const char *line, const char *word, int pos, int state)
{
+ char *ret = NULL;
+
if (pos == 2) {
struct agent_pvt *p;
char name[AST_MAX_AGENT];
int which = 0, len = strlen(word);
+ AST_LIST_LOCK(&agents);
AST_LIST_TRAVERSE(&agents, p, list) {
snprintf(name, sizeof(name), "Agent/%s", p->agent);
- if (!strncasecmp(word, name, len) && p->loginstart && ++which > state)
- return ast_strdup(name);
- }
+ if (!strncasecmp(word, name, len) && p->loginstart && ++which > state) {
+ ret = ast_strdup(name);
+ break;
+ }
+ }
+ AST_LIST_UNLOCK(&agents);
} else if (pos == 3 && state == 0)
return ast_strdup("soft");
- return NULL;
+ return ret;
}
/*!
@@ -2242,6 +2250,9 @@
return res;
}
+/*!
+ * \note This function expects the agent list to be locked
+ */
static struct agent_pvt *find_agent(char *agentid)
{
struct agent_pvt *cur;
@@ -2277,7 +2288,10 @@
if (!args.item)
args.item = "status";
+ AST_LIST_LOCK(&agents);
+
if (!(agent = find_agent(args.agentid))) {
+ AST_LIST_UNLOCK(&agents);
ast_log(LOG_WARNING, "Agent '%s' not found!\n", args.agentid);
return -1;
}
@@ -2303,6 +2317,8 @@
} else if (!strcasecmp(args.item, "exten"))
ast_copy_string(buf, agent->loginchan, len);
+ AST_LIST_UNLOCK(&agents);
+
return 0;
}
Modified: team/jamesgolovich/chan_sip-ast_str/channels/chan_h323.c
URL: http://svn.digium.com/view/asterisk/team/jamesgolovich/chan_sip-ast_str/channels/chan_h323.c?view=diff&rev=101529&r1=101528&r2=101529
==============================================================================
--- team/jamesgolovich/chan_sip-ast_str/channels/chan_h323.c (original)
+++ team/jamesgolovich/chan_sip-ast_str/channels/chan_h323.c Thu Jan 31 14:35:24 2008
@@ -368,14 +368,12 @@
if (pvt->newdigit == ' ') { /* signalUpdate message */
f.subclass = pvt->curDTMF;
if (pvt->DTMFsched >= 0) {
- ast_sched_del(sched, pvt->DTMFsched);
- pvt->DTMFsched = -1;
+ AST_SCHED_DEL(sched, pvt->DTMFsched);
}
} else { /* Regular input or signal message */
if (pvt->newduration) { /* This is a signal, signalUpdate follows */
f.frametype = AST_FRAME_DTMF_BEGIN;
- if (pvt->DTMFsched >= 0)
- ast_sched_del(sched, pvt->DTMFsched);
+ AST_SCHED_DEL(sched, pvt->DTMFsched);
pvt->DTMFsched = ast_sched_add(sched, pvt->newduration, oh323_simulate_dtmf_end, pvt);
if (h323debug)
ast_log(LOG_DTMF, "Scheduled DTMF END simulation for %d ms, id=%d\n", pvt->newduration, pvt->DTMFsched);
@@ -448,10 +446,7 @@
{
struct oh323_pvt *cur, *prev = NULL;
- if (pvt->DTMFsched >= 0) {
- ast_sched_del(sched, pvt->DTMFsched);
- pvt->DTMFsched = -1;
- }
+ AST_SCHED_DEL(sched, pvt->DTMFsched);
if (pvt->rtp) {
ast_rtp_destroy(pvt->rtp);
@@ -1846,15 +1841,11 @@
};
if (digit == ' ') { /* signalUpdate message */
f.subclass = pvt->curDTMF;
- if (pvt->DTMFsched >= 0) {
- ast_sched_del(sched, pvt->DTMFsched);
- pvt->DTMFsched = -1;
- }
+ AST_SCHED_DEL(sched, pvt->DTMFsched);
} else { /* Regular input or signal message */
if (pvt->DTMFsched >= 0) {
/* We still don't send DTMF END from previous event, send it now */
- ast_sched_del(sched, pvt->DTMFsched);
- pvt->DTMFsched = -1;
+ AST_SCHED_DEL(sched, pvt->DTMFsched);
f.subclass = pvt->curDTMF;
f.samples = f.len = 0;
ast_queue_frame(pvt->owner, &f);
Modified: team/jamesgolovich/chan_sip-ast_str/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/jamesgolovich/chan_sip-ast_str/channels/chan_iax2.c?view=diff&rev=101529&r1=101528&r2=101529
==============================================================================
--- team/jamesgolovich/chan_sip-ast_str/channels/chan_iax2.c (original)
+++ team/jamesgolovich/chan_sip-ast_str/channels/chan_iax2.c Thu Jan 31 14:35:24 2008
@@ -1094,14 +1094,12 @@
#define schedule_action(func, data) __schedule_action(func, data, __PRETTY_FUNCTION__)
#endif
-static int iax2_sched_replace(int old_id, struct sched_context *con, int when, ast_sched_cb callback, const void *data)
-{
- int res;
-
- res = ast_sched_replace(old_id, con, when, callback, data);
+static int iax2_sched_replace(int id, struct sched_context *con, int when, ast_sched_cb callback, const void *data)
+{
+ AST_SCHED_REPLACE(id, con, when, callback, data);
signal_condition(&sched_lock, &sched_cond);
- return res;
+ return id;
}
static int iax2_sched_add(struct sched_context *con, int when, ast_sched_cb callback, const void *data)
@@ -1155,7 +1153,7 @@
int callno = (long)data;
/* Ping only if it's real not if it's bridged */
ast_mutex_lock(&iaxsl[callno]);
- if (iaxs[callno] && iaxs[callno]->lagid != -1) {
+ if (iaxs[callno] && iaxs[callno]->lagid > -1) {
send_command(iaxs[callno], AST_FRAME_IAX, IAX_COMMAND_LAGRQ, 0, NULL, 0, -1);
iaxs[callno]->lagid = iax2_sched_add(sched, lagrq_time * 1000, send_lagrq, data);
}
@@ -1568,8 +1566,7 @@
static void iax2_frame_free(struct iax_frame *fr)
{
- if (fr->retrans > -1)
- ast_sched_del(sched, fr->retrans);
+ AST_SCHED_DEL(sched, fr->retrans);
iax_frame_free(fr);
}
@@ -2040,24 +2037,12 @@
ast_clear_flag(pvt, IAX_MAXAUTHREQ);
}
/* No more pings or lagrq's */
- if (pvt->pingid > -1)
- ast_sched_del(sched, pvt->pingid);
- pvt->pingid = -1;
- if (pvt->lagid > -1)
- ast_sched_del(sched, pvt->lagid);
- pvt->lagid = -1;
- if (pvt->autoid > -1)
- ast_sched_del(sched, pvt->autoid);
- pvt->autoid = -1;
- if (pvt->authid > -1)
- ast_sched_del(sched, pvt->authid);
- pvt->authid = -1;
- if (pvt->initid > -1)
- ast_sched_del(sched, pvt->initid);
- pvt->initid = -1;
- if (pvt->jbid > -1)
- ast_sched_del(sched, pvt->jbid);
- pvt->jbid = -1;
+ AST_SCHED_DEL(sched, pvt->pingid);
+ AST_SCHED_DEL(sched, pvt->lagid);
+ AST_SCHED_DEL(sched, pvt->autoid);
+ AST_SCHED_DEL(sched, pvt->authid);
+ AST_SCHED_DEL(sched, pvt->initid);
+ AST_SCHED_DEL(sched, pvt->jbid);
}
/*!
@@ -2693,8 +2678,8 @@
when = ast_tvdiff_ms(ast_tvnow(), pvt->rxcore);
when = jb_next(pvt->jb) - when;
-
- if(when <= 0) {
+
+ if (when <= 0) {
/* XXX should really just empty until when > 0.. */
when = 1;
}
@@ -2847,10 +2832,7 @@
jb_reset(iaxs[fr->callno]->jb);
- if (iaxs[fr->callno]->jbid > -1)
- ast_sched_del(sched, iaxs[fr->callno]->jbid);
-
- iaxs[fr->callno]->jbid = -1;
+ AST_SCHED_DEL(sched, iaxs[fr->callno]->jbid);
/* deliver this frame now */
if (tsout)
@@ -2974,8 +2956,9 @@
if (var && sin) {
for (tmp = var; tmp; tmp = tmp->next) {
if (!strcasecmp(tmp->name, "host")) {
- struct in_addr sin2 = { 0, };
+ struct in_addr sin2;
struct ast_dnsmgr_entry *dnsmgr = NULL;
+ memset(&sin2, 0, sizeof(sin2));
if ((ast_dnsmgr_lookup(tmp->value, &sin2, &dnsmgr) < 0) || (memcmp(&sin2, &sin->sin_addr, sizeof(sin2)) != 0)) {
/* No match */
ast_variables_destroy(var);
@@ -3086,8 +3069,9 @@
if (var) {
for (tmp = var; tmp; tmp = tmp->next) {
if (!strcasecmp(tmp->name, "host")) {
- struct in_addr sin2 = { 0, };
+ struct in_addr sin2;
struct ast_dnsmgr_entry *dnsmgr = NULL;
+ memset(&sin2, 0, sizeof(sin2));
if ((ast_dnsmgr_lookup(tmp->value, &sin2, &dnsmgr) < 0) || (memcmp(&sin2, &sin->sin_addr, sizeof(sin2)) != 0)) {
/* No match */
ast_variables_destroy(var);
@@ -7988,11 +7972,7 @@
}
}
if (f.frametype == AST_FRAME_IAX) {
- if (iaxs[fr->callno]->initid > -1) {
- /* Don't auto congest anymore since we've gotten something usefulb ack */
- ast_sched_del(sched, iaxs[fr->callno]->initid);
- iaxs[fr->callno]->initid = -1;
- }
+ AST_SCHED_DEL(sched, iaxs[fr->callno]->initid);
/* Handle the IAX pseudo frame itself */
if (iaxdebug)
ast_debug(1, "IAX subclass %d received\n", f.subclass);
@@ -9966,9 +9946,7 @@
}
} else {
/* Non-dynamic. Make sure we become that way if we're not */
- if (peer->expire > -1)
- ast_sched_del(sched, peer->expire);
- peer->expire = -1;
+ AST_SCHED_DEL(sched, peer->expire);
ast_clear_flag(peer, IAX_DYNAMIC);
if (ast_dnsmgr_lookup(v->value, &peer->addr.sin_addr, &peer->dnsmgr))
return peer_unref(peer);
@@ -10347,8 +10325,7 @@
AST_LIST_LOCK(®istrations);
while ((reg = AST_LIST_REMOVE_HEAD(®istrations, entry))) {
- if (reg->expire > -1)
- ast_sched_del(sched, reg->expire);
+ AST_SCHED_DEL(sched, reg->expire);
if (reg->callno) {
ast_mutex_lock(&iaxsl[reg->callno]);
if (iaxs[reg->callno]) {
Modified: team/jamesgolovich/chan_sip-ast_str/channels/chan_local.c
URL: http://svn.digium.com/view/asterisk/team/jamesgolovich/chan_sip-ast_str/channels/chan_local.c?view=diff&rev=101529&r1=101528&r2=101529
==============================================================================
--- team/jamesgolovich/chan_sip-ast_str/channels/chan_local.c (original)
+++ team/jamesgolovich/chan_sip-ast_str/channels/chan_local.c Thu Jan 31 14:35:24 2008
@@ -161,8 +161,6 @@
{
struct ast_channel *other = NULL;
-retrylock:
-
/* Recalculate outbound channel */
other = isoutbound ? p->owner : p->chan;
@@ -180,27 +178,28 @@
ast_clear_flag(p, LOCAL_GLARE_DETECT);
return 0;
}
- if (ast_channel_trylock(other)) {
- /* Failed to lock. Release main lock and try again */
- ast_mutex_unlock(&p->lock);
- if (us) {
- if (ast_channel_unlock(us)) {
- ast_log(LOG_WARNING, "%s wasn't locked while sending %d/%d\n",
- us->name, f->frametype, f->subclass);
- us = NULL;
- }
- }
- /* Wait just a bit */
- usleep(1);
- /* Only we can destroy ourselves, so we can't disappear here */
- if (us)
+
+ ast_mutex_unlock(&p->lock);
+
+ /* Ensure that we have both channels locked */
+ if (us) {
+ while (ast_channel_trylock(other)) {
+ ast_channel_unlock(us);
+ usleep(1);
ast_channel_lock(us);
- ast_mutex_lock(&p->lock);
- goto retrylock;
- }
+ }
+ } else {
+ ast_channel_lock(other);
+ }
+
ast_queue_frame(other, f);
+
ast_channel_unlock(other);
+
+ ast_mutex_lock(&p->lock);
+
ast_clear_flag(p, LOCAL_GLARE_DETECT);
+
return 0;
}
Modified: team/jamesgolovich/chan_sip-ast_str/channels/chan_mgcp.c
URL: http://svn.digium.com/view/asterisk/team/jamesgolovich/chan_sip-ast_str/channels/chan_mgcp.c?view=diff&rev=101529&r1=101528&r2=101529
==============================================================================
--- team/jamesgolovich/chan_sip-ast_str/channels/chan_mgcp.c (original)
+++ team/jamesgolovich/chan_sip-ast_str/channels/chan_mgcp.c Thu Jan 31 14:35:24 2008
@@ -3355,9 +3355,8 @@
}
/* stop retrans timer if the queue is empty */
- if (!gw->msgs && (gw->retransid != -1)) {
- ast_sched_del(sched, gw->retransid);
- gw->retransid = -1;
+ if (!gw->msgs) {
+ AST_SCHED_DEL(sched, gw->retransid);
}
ast_mutex_unlock(&gw->msgs_lock);
@@ -3609,9 +3608,7 @@
}
} else {
/* Non-dynamic. Make sure we become that way if we're not */
- if (gw->expire > -1)
- ast_sched_del(sched, gw->expire);
- gw->expire = -1;
+ AST_SCHED_DEL(sched, gw->expire);
gw->dynamic = 0;
if (ast_get_ip(&gw->addr, v->value)) {
if (!gw_reload) {
Modified: team/jamesgolovich/chan_sip-ast_str/channels/chan_misdn.c
URL: http://svn.digium.com/view/asterisk/team/jamesgolovich/chan_sip-ast_str/channels/chan_misdn.c?view=diff&rev=101529&r1=101528&r2=101529
==============================================================================
--- team/jamesgolovich/chan_sip-ast_str/channels/chan_misdn.c (original)
+++ team/jamesgolovich/chan_sip-ast_str/channels/chan_misdn.c Thu Jan 31 14:35:24 2008
@@ -652,7 +652,7 @@
static void misdn_tasks_remove (int task_id)
{
- ast_sched_del(misdn_tasks, task_id);
+ AST_SCHED_DEL(misdn_tasks, task_id);
}
static int misdn_l1_task (const void *data)
@@ -1251,10 +1251,19 @@
help = cl_te;
ast_cli(a->fd, "Channel List: %p\n", cl_te);
-
+
for (; help; help = help->next) {
struct misdn_bchannel *bc = help->bc;
struct ast_channel *ast = help->ast;
+ if (!ast) {
+ if (!bc) {
+ ast_cli(a->fd, "chan_list obj. with l3id:%x has no bc and no ast Leg\n", help->l3id);
+ continue;
+ }
+ ast_cli(a->fd, "bc with pid:%d has no Ast Leg\n", bc->pid);
+ continue;
+ }
+
if (misdn_debug[0] > 2)
ast_cli(a->fd, "Bc:%p Ast:%p\n", bc, ast);
if (bc) {
@@ -4163,6 +4172,7 @@
/* sending INFOS as DTMF-Frames :) */
struct ast_frame fr;
int digits;
+ memset(&fr, 0, sizeof(fr));
fr.frametype = AST_FRAME_DTMF;
fr.subclass = bc->info_dad[0] ;
fr.src = NULL;
Modified: team/jamesgolovich/chan_sip-ast_str/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/jamesgolovich/chan_sip-ast_str/channels/chan_sip.c?view=diff&rev=101529&r1=101528&r2=101529
==============================================================================
--- team/jamesgolovich/chan_sip-ast_str/channels/chan_sip.c (original)
+++ team/jamesgolovich/chan_sip-ast_str/channels/chan_sip.c Thu Jan 31 14:35:24 2008
@@ -965,6 +965,7 @@
#define SIP_PAGE2_RTCACHEFRIENDS (1 << 0) /*!< GP: Should we keep RT objects in memory for extended time? */
#define SIP_PAGE2_RTAUTOCLEAR (1 << 2) /*!< GP: Should we clean memory from peers after expiry? */
/* Space for addition of other realtime flags in the future */
+#define SIP_PAGE2_STATECHANGEQUEUE (1 << 9) /*!< D: Unsent state pending change exists */
#define SIP_PAGE2_VIDEOSUPPORT (1 << 14) /*!< DP: Video supported if offered? */
#define SIP_PAGE2_TEXTSUPPORT (1 << 15) /*!< GDP: Global text enable */
@@ -1263,7 +1264,7 @@
int noncecount; /*!< Nonce-count */
char lastmsg[256]; /*!< Last Message sent/received */
int amaflags; /*!< AMA Flags */
- int pendinginvite; /*!< Any pending invite ? (seqno of this) */
+ int pendinginvite; /*!< Any pending INVITE or state NOTIFY (in subscribe pvt's) ? (seqno of this) */
struct sip_request initreq; /*!< Latest request that opened a new transaction
within this dialog.
NOT the request that opened the dialog
@@ -1495,6 +1496,7 @@
struct sip_st_cfg stimer; /*!< SIP Session-Timers */
int timer_t1; /*!< The maximum T1 value for the peer */
int timer_b; /*!< The maximum timer B (transaction timeouts) */
+ int deprecated_username; /*!< If it's a realtime peer, are they using the deprecated "username" instead of "defaultuser" */
};
@@ -1663,6 +1665,12 @@
(head) = (element)->next; \
} while (0)
+enum t38_action_flag {
+ SDP_T38_NONE = 0, /*!< Do not modify T38 information at all */
+ SDP_T38_INITIATE, /*!< Remote side has requested T38 with us */
+ SDP_T38_ACCEPT, /*!< Remote side accepted our T38 request */
+};
+
/*---------------------------- Forward declarations of functions in chan_sip.c */
/*! \note This is added to help splitting up chan_sip.c into several files
in coming releases */
@@ -1682,7 +1690,7 @@
static int sip_fixup(struct ast_channel *oldchan, struct ast_channel *newchan);
static int sip_senddigit_begin(struct ast_channel *ast, char digit);
static int sip_senddigit_end(struct ast_channel *ast, char digit, unsigned int duration);
-static char *sip_get_callid(struct ast_channel *chan);
+static const char *sip_get_callid(struct ast_channel *chan);
static int handle_request_do(struct sip_request *req, struct sockaddr_in *sin);
static int sip_standard_port(struct sip_socket s);
@@ -1727,7 +1735,7 @@
int useglobal_nat, const int intended_method);
static int __sip_autodestruct(const void *data);
static void sip_scheddestroy(struct sip_pvt *p, int ms);
-static void sip_cancel_destroy(struct sip_pvt *p);
+static int sip_cancel_destroy(struct sip_pvt *p);
static struct sip_pvt *sip_destroy(struct sip_pvt *p);
static void __sip_destroy(struct sip_pvt *p, int lockowner, int lockdialoglist);
static void __sip_ack(struct sip_pvt *p, int seqno, int resp, int sipmethod);
@@ -1754,7 +1762,7 @@
static const char* get_sdp_iterate(int* start, struct sip_request *req, const char *name);
static const char *get_sdp(struct sip_request *req, const char *name);
static int find_sdp(struct sip_request *req);
-static int process_sdp(struct sip_pvt *p, struct sip_request *req);
+static int process_sdp(struct sip_pvt *p, struct sip_request *req, int t38action);
static void add_codec_to_sdp(const struct sip_pvt *p, int codec, int sample_rate,
struct ast_str **m_buf, struct ast_str **a_buf,
int debug, int *min_packet_size);
@@ -1890,7 +1898,7 @@
static int handle_common_options(struct ast_flags *flags, struct ast_flags *mask, struct ast_variable *v);
/* Realtime device support */
-static void realtime_update_peer(const char *peername, struct sockaddr_in *sin, const char *username, const char *fullcontact, int expirey);
+static void realtime_update_peer(const char *peername, struct sockaddr_in *sin, const char *username, const char *fullcontact, int expirey, int deprecated_username);
static struct sip_user *realtime_user(const char *username);
static void update_peer(struct sip_peer *p, int expiry);
static struct ast_variable *get_insecure_variable_from_config(struct ast_config *config);
@@ -2823,8 +2831,7 @@
siptimer_a = pkt->timer_t1 * 2;
/* Schedule retransmission */
- pkt->retransid = ast_sched_replace_variable(pkt->retransid, sched,
- siptimer_a, retrans_pkt, pkt, 1);
+ AST_SCHED_REPLACE_VARIABLE(pkt->retransid, sched, siptimer_a, retrans_pkt, pkt, 1);
if (sipdebug)
ast_debug(4, "*** SIP TIMER: Initializing retransmit timer on packet: Id #%d\n", pkt->retransid);
@@ -2832,13 +2839,12 @@
if (xmitres == XMIT_ERROR) { /* Serious network trouble, no need to try again */
append_history(pkt->owner, "XmitErr", "%s", pkt->is_fatal ? "(Critical)" : "(Non-critical)");
[... 2178 lines stripped ...]
More information about the svn-commits
mailing list