[asterisk-commits] oej: branch oej/earlyrtpfix r99543 - in /team/oej/earlyrtpfix: ./ apps/ build...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Jan 22 11:55:24 CST 2008
Author: oej
Date: Tue Jan 22 11:07:10 2008
New Revision: 99543
URL: http://svn.digium.com/view/asterisk?view=rev&rev=99543
Log:
reset, resolve
Added:
team/oej/earlyrtpfix/include/asterisk/audiohook.h
- copied unchanged from r99540, branches/1.4/include/asterisk/audiohook.h
team/oej/earlyrtpfix/main/audiohook.c
- copied unchanged from r99540, branches/1.4/main/audiohook.c
Removed:
team/oej/earlyrtpfix/include/asterisk/chanspy.h
Modified:
team/oej/earlyrtpfix/ (props changed)
team/oej/earlyrtpfix/.cleancount
team/oej/earlyrtpfix/apps/app_chanspy.c
team/oej/earlyrtpfix/apps/app_followme.c
team/oej/earlyrtpfix/apps/app_meetme.c
team/oej/earlyrtpfix/apps/app_mixmonitor.c
team/oej/earlyrtpfix/apps/app_queue.c
team/oej/earlyrtpfix/apps/app_voicemail.c
team/oej/earlyrtpfix/build_tools/menuselect-deps.in
team/oej/earlyrtpfix/channels/chan_iax2.c
team/oej/earlyrtpfix/channels/chan_local.c
team/oej/earlyrtpfix/channels/chan_sip.c
team/oej/earlyrtpfix/codecs/codec_speex.c
team/oej/earlyrtpfix/codecs/codec_zap.c
team/oej/earlyrtpfix/codecs/gsm/Makefile
team/oej/earlyrtpfix/configs/res_odbc.conf.sample
team/oej/earlyrtpfix/configs/zapata.conf.sample
team/oej/earlyrtpfix/configure
team/oej/earlyrtpfix/configure.ac
team/oej/earlyrtpfix/doc/security.txt
team/oej/earlyrtpfix/include/asterisk/autoconfig.h.in
team/oej/earlyrtpfix/include/asterisk/channel.h
team/oej/earlyrtpfix/include/asterisk/frame.h
team/oej/earlyrtpfix/include/asterisk/res_odbc.h
team/oej/earlyrtpfix/include/asterisk/translate.h
team/oej/earlyrtpfix/main/Makefile
team/oej/earlyrtpfix/main/abstract_jb.c
team/oej/earlyrtpfix/main/acl.c
team/oej/earlyrtpfix/main/asterisk.c
team/oej/earlyrtpfix/main/channel.c
team/oej/earlyrtpfix/main/dial.c
team/oej/earlyrtpfix/main/frame.c
team/oej/earlyrtpfix/main/http.c
team/oej/earlyrtpfix/main/rtp.c
team/oej/earlyrtpfix/main/slinfactory.c
team/oej/earlyrtpfix/main/translate.c
team/oej/earlyrtpfix/makeopts.in
team/oej/earlyrtpfix/pbx/pbx_dundi.c
team/oej/earlyrtpfix/res/res_agi.c
team/oej/earlyrtpfix/res/res_features.c
team/oej/earlyrtpfix/res/res_odbc.c
Change Statistics:
0 files changed
Propchange: team/oej/earlyrtpfix/
------------------------------------------------------------------------------
automerge = http://www.codename-pineapple.org/
Propchange: team/oej/earlyrtpfix/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Tue Jan 22 11:07:10 2008
@@ -1,1 +1,1 @@
-/branches/1.4:1-98103
+/branches/1.4:1-99541
Modified: team/oej/earlyrtpfix/.cleancount
URL: http://svn.digium.com/view/asterisk/team/oej/earlyrtpfix/.cleancount?view=diff&rev=99543&r1=99542&r2=99543
==============================================================================
--- team/oej/earlyrtpfix/.cleancount (original)
+++ team/oej/earlyrtpfix/.cleancount Tue Jan 22 11:07:10 2008
@@ -1,1 +1,1 @@
-30
+32
Modified: team/oej/earlyrtpfix/apps/app_chanspy.c
URL: http://svn.digium.com/view/asterisk/team/oej/earlyrtpfix/apps/app_chanspy.c?view=diff&rev=99543&r1=99542&r2=99543
==============================================================================
--- team/oej/earlyrtpfix/apps/app_chanspy.c (original)
+++ team/oej/earlyrtpfix/apps/app_chanspy.c Tue Jan 22 11:07:10 2008
@@ -40,7 +40,7 @@
#include "asterisk/file.h"
#include "asterisk/logger.h"
#include "asterisk/channel.h"
-#include "asterisk/chanspy.h"
+#include "asterisk/audiohook.h"
#include "asterisk/features.h"
#include "asterisk/options.h"
#include "asterisk/app.h"
@@ -143,7 +143,8 @@
struct chanspy_translation_helper {
/* spy data */
- struct ast_channel_spy spy;
+ struct ast_audiohook spy_audiohook;
+ struct ast_audiohook whisper_audiohook;
int fd;
int volfactor;
};
@@ -163,15 +164,17 @@
{
struct chanspy_translation_helper *csth = data;
struct ast_frame *f;
-
- if (csth->spy.status != CHANSPY_RUNNING)
- /* Channel is already gone more than likely */
+
+ ast_audiohook_lock(&csth->spy_audiohook);
+ if (csth->spy_audiohook.status != AST_AUDIOHOOK_STATUS_RUNNING) {
+ ast_audiohook_unlock(&csth->spy_audiohook);
return -1;
-
- ast_mutex_lock(&csth->spy.lock);
- f = ast_channel_spy_read_frame(&csth->spy, samples);
- ast_mutex_unlock(&csth->spy.lock);
-
+ }
+
+ f = ast_audiohook_read_frame(&csth->spy_audiohook, samples, AST_AUDIOHOOK_DIRECTION_BOTH, AST_FORMAT_SLINEAR);
+
+ ast_audiohook_unlock(&csth->spy_audiohook);
+
if (!f)
return 0;
@@ -194,50 +197,19 @@
.generate = spy_generate,
};
-static int start_spying(struct ast_channel *chan, struct ast_channel *spychan, struct ast_channel_spy *spy)
+static int start_spying(struct ast_channel *chan, struct ast_channel *spychan, struct ast_audiohook *audiohook)
{
int res;
struct ast_channel *peer;
ast_log(LOG_NOTICE, "Attaching %s to %s\n", spychan->name, chan->name);
- ast_channel_lock(chan);
- res = ast_channel_spy_add(chan, spy);
- ast_channel_unlock(chan);
+ res = ast_audiohook_attach(chan, audiohook);
if (!res && ast_test_flag(chan, AST_FLAG_NBRIDGE) && (peer = ast_bridged_channel(chan)))
ast_softhangup(peer, AST_SOFTHANGUP_UNBRIDGE);
return res;
-}
-
-/* Map 'volume' levels from -4 through +4 into
- decibel (dB) settings for channel drivers
-*/
-static signed char volfactor_map[] = {
- -24,
- -18,
- -12,
- -6,
- 0,
- 6,
- 12,
- 18,
- 24,
-};
-
-/* attempt to set the desired gain adjustment via the channel driver;
- if successful, clear it out of the csth structure so the
- generator will not attempt to do the adjustment itself
-*/
-static void set_volume(struct ast_channel *chan, struct chanspy_translation_helper *csth)
-{
- signed char volume_adjust = volfactor_map[csth->volfactor + 4];
-
- if (!ast_channel_setoption(chan, AST_OPTION_TXGAIN, &volume_adjust, sizeof(volume_adjust), 0))
- csth->volfactor = 0;
- csth->spy.read_vol_adjustment = csth->volfactor;
- csth->spy.write_vol_adjustment = csth->volfactor;
}
static int channel_spy(struct ast_channel *chan, struct ast_channel *spyee, int *volfactor, int fd,
@@ -258,49 +230,27 @@
ast_verbose(VERBOSE_PREFIX_2 "Spying on channel %s\n", name);
memset(&csth, 0, sizeof(csth));
- ast_set_flag(&csth.spy, CHANSPY_FORMAT_AUDIO);
- ast_set_flag(&csth.spy, CHANSPY_TRIGGER_NONE);
- ast_set_flag(&csth.spy, CHANSPY_MIXAUDIO);
- csth.spy.type = "ChanSpy";
- csth.spy.status = CHANSPY_RUNNING;
- csth.spy.read_queue.format = AST_FORMAT_SLINEAR;
- csth.spy.write_queue.format = AST_FORMAT_SLINEAR;
- ast_mutex_init(&csth.spy.lock);
+
+ ast_audiohook_init(&csth.spy_audiohook, AST_AUDIOHOOK_TYPE_SPY, "ChanSpy");
+
+ if (start_spying(spyee, chan, &csth.spy_audiohook)) {
+ ast_audiohook_destroy(&csth.spy_audiohook);
+ return 0;
+ }
+
+ if (ast_test_flag(flags, OPTION_WHISPER)) {
+ ast_audiohook_init(&csth.whisper_audiohook, AST_AUDIOHOOK_TYPE_WHISPER, "ChanSpy");
+ start_spying(spyee, chan, &csth.whisper_audiohook);
+ }
+
csth.volfactor = *volfactor;
- set_volume(chan, &csth);
+
if (csth.volfactor) {
- ast_set_flag(&csth.spy, CHANSPY_READ_VOLADJUST);
- csth.spy.read_vol_adjustment = csth.volfactor;
- ast_set_flag(&csth.spy, CHANSPY_WRITE_VOLADJUST);
- csth.spy.write_vol_adjustment = csth.volfactor;
- }
+ csth.spy_audiohook.options.read_volume = csth.volfactor;
+ csth.spy_audiohook.options.write_volume = csth.volfactor;
+ }
+
csth.fd = fd;
-
- if (start_spying(spyee, chan, &csth.spy)) {
- ast_mutex_destroy(&csth.spy.lock);
- return 0;
- }
-
- if (ast_test_flag(flags, OPTION_WHISPER)) {
- struct ast_filestream *beepstream;
- int old_write_format = 0;
-
- ast_channel_whisper_start(csth.spy.chan);
- old_write_format = chan->writeformat;
- if ((beepstream = ast_openstream_full(chan, "beep", chan->language, 1))) {
- struct ast_frame *f;
-
- while ((f = ast_readframe(beepstream))) {
- ast_channel_whisper_feed(csth.spy.chan, f);
- ast_frfree(f);
- }
-
- ast_closestream(beepstream);
- chan->stream = NULL;
- }
- if (old_write_format)
- ast_set_write_format(chan, old_write_format);
- }
if (ast_test_flag(flags, OPTION_PRIVATE))
silgen = ast_channel_start_silence_generator(chan);
@@ -321,17 +271,16 @@
has arrived, since the spied-on channel could have gone away while
we were waiting
*/
- while ((res = ast_waitfor(chan, -1) > -1) &&
- csth.spy.status == CHANSPY_RUNNING &&
- csth.spy.chan) {
+ while ((res = ast_waitfor(chan, -1) > -1) && csth.spy_audiohook.status == AST_AUDIOHOOK_STATUS_RUNNING) {
if (!(f = ast_read(chan)) || ast_check_hangup(chan)) {
running = -1;
break;
}
- if (ast_test_flag(flags, OPTION_WHISPER) &&
- (f->frametype == AST_FRAME_VOICE)) {
- ast_channel_whisper_feed(csth.spy.chan, f);
+ if (ast_test_flag(flags, OPTION_WHISPER) && (f->frametype == AST_FRAME_VOICE)) {
+ ast_audiohook_lock(&csth.whisper_audiohook);
+ ast_audiohook_write_frame(&csth.whisper_audiohook, AST_AUDIOHOOK_DIRECTION_WRITE, f);
+ ast_audiohook_unlock(&csth.whisper_audiohook);
ast_frfree(f);
continue;
}
@@ -364,38 +313,29 @@
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "Setting spy volume on %s to %d\n", chan->name, *volfactor);
csth.volfactor = *volfactor;
- set_volume(chan, &csth);
- if (csth.volfactor) {
- ast_set_flag(&csth.spy, CHANSPY_READ_VOLADJUST);
- csth.spy.read_vol_adjustment = csth.volfactor;
- ast_set_flag(&csth.spy, CHANSPY_WRITE_VOLADJUST);
- csth.spy.write_vol_adjustment = csth.volfactor;
- } else {
- ast_clear_flag(&csth.spy, CHANSPY_READ_VOLADJUST);
- ast_clear_flag(&csth.spy, CHANSPY_WRITE_VOLADJUST);
- }
+ csth.spy_audiohook.options.read_volume = csth.volfactor;
+ csth.spy_audiohook.options.write_volume = csth.volfactor;
} else if (res >= '0' && res <= '9') {
inp[x++] = res;
}
}
-
- if (ast_test_flag(flags, OPTION_WHISPER) && csth.spy.chan)
- ast_channel_whisper_stop(csth.spy.chan);
if (ast_test_flag(flags, OPTION_PRIVATE))
ast_channel_stop_silence_generator(chan, silgen);
else
ast_deactivate_generator(chan);
- csth.spy.status = CHANSPY_DONE;
-
- /* If a channel still exists on our spy structure then we need to remove ourselves */
- if (csth.spy.chan) {
- ast_channel_lock(csth.spy.chan);
- ast_channel_spy_remove(csth.spy.chan, &csth.spy);
- ast_channel_unlock(csth.spy.chan);
- }
- ast_channel_spy_free(&csth.spy);
+ if (ast_test_flag(flags, OPTION_WHISPER)) {
+ ast_audiohook_lock(&csth.whisper_audiohook);
+ ast_audiohook_detach(&csth.whisper_audiohook);
+ ast_audiohook_unlock(&csth.whisper_audiohook);
+ ast_audiohook_destroy(&csth.whisper_audiohook);
+ }
+
+ ast_audiohook_lock(&csth.spy_audiohook);
+ ast_audiohook_detach(&csth.spy_audiohook);
+ ast_audiohook_unlock(&csth.spy_audiohook);
+ ast_audiohook_destroy(&csth.spy_audiohook);
if (option_verbose >= 2)
ast_verbose(VERBOSE_PREFIX_2 "Done Spying on channel %s\n", name);
Modified: team/oej/earlyrtpfix/apps/app_followme.c
URL: http://svn.digium.com/view/asterisk/team/oej/earlyrtpfix/apps/app_followme.c?view=diff&rev=99543&r1=99542&r2=99543
==============================================================================
--- team/oej/earlyrtpfix/apps/app_followme.c (original)
+++ team/oej/earlyrtpfix/apps/app_followme.c Tue Jan 22 11:07:10 2008
@@ -1048,7 +1048,6 @@
pbx_builtin_setvar_helper(caller, "ANSWEREDTIME", toast);
if (outbound)
ast_hangup(outbound);
- res = 1;
}
}
outrun:
Modified: team/oej/earlyrtpfix/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/team/oej/earlyrtpfix/apps/app_meetme.c?view=diff&rev=99543&r1=99542&r2=99543
==============================================================================
--- team/oej/earlyrtpfix/apps/app_meetme.c (original)
+++ team/oej/earlyrtpfix/apps/app_meetme.c Tue Jan 22 11:07:10 2008
@@ -1578,7 +1578,7 @@
goto outrun;
}
- retryzap = (strcasecmp(chan->tech->type, "Zap") || (chan->spies || chan->monitor) ? 1 : 0);
+ retryzap = (strcasecmp(chan->tech->type, "Zap") || (chan->audiohooks || chan->monitor) ? 1 : 0);
user->zapchannel = !retryzap;
zapretry:
@@ -1896,14 +1896,14 @@
break;
if (c) {
- if (c->fds[0] != origfd || (user->zapchannel && (c->spies || c->monitor))) {
+ if (c->fds[0] != origfd || (user->zapchannel && (c->audiohooks || c->monitor))) {
if (using_pseudo) {
/* Kill old pseudo */
close(fd);
using_pseudo = 0;
}
ast_log(LOG_DEBUG, "Ooh, something swapped out under us, starting over\n");
- retryzap = (strcasecmp(c->tech->type, "Zap") || (c->spies || c->monitor) ? 1 : 0);
+ retryzap = (strcasecmp(c->tech->type, "Zap") || (c->audiohooks || c->monitor) ? 1 : 0);
user->zapchannel = !retryzap;
goto zapretry;
}
Modified: team/oej/earlyrtpfix/apps/app_mixmonitor.c
URL: http://svn.digium.com/view/asterisk/team/oej/earlyrtpfix/apps/app_mixmonitor.c?view=diff&rev=99543&r1=99542&r2=99543
==============================================================================
--- team/oej/earlyrtpfix/apps/app_mixmonitor.c (original)
+++ team/oej/earlyrtpfix/apps/app_mixmonitor.c Tue Jan 22 11:07:10 2008
@@ -45,7 +45,7 @@
#include "asterisk/file.h"
#include "asterisk/logger.h"
#include "asterisk/channel.h"
-#include "asterisk/chanspy.h"
+#include "asterisk/audiohook.h"
#include "asterisk/pbx.h"
#include "asterisk/module.h"
#include "asterisk/lock.h"
@@ -93,11 +93,12 @@
static const char *mixmonitor_spy_type = "MixMonitor";
struct mixmonitor {
- struct ast_channel_spy spy;
+ struct ast_audiohook audiohook;
char *filename;
char *post_process;
char *name;
unsigned int flags;
+ struct ast_channel *chan;
};
enum {
@@ -123,7 +124,7 @@
AST_APP_OPTION_ARG('W', MUXFLAG_VOLUME, OPT_ARG_VOLUME),
});
-static int startmon(struct ast_channel *chan, struct ast_channel_spy *spy)
+static int startmon(struct ast_channel *chan, struct ast_audiohook *audiohook)
{
struct ast_channel *peer;
int res;
@@ -131,9 +132,7 @@
if (!chan)
return -1;
- ast_channel_lock(chan);
- res = ast_channel_spy_add(chan, spy);
- ast_channel_unlock(chan);
+ res = ast_audiohook_attach(chan, audiohook);
if (!res && ast_test_flag(chan, AST_FLAG_NBRIDGE) && (peer = ast_bridged_channel(chan)))
ast_softhangup(peer, AST_SOFTHANGUP_UNBRIDGE);
@@ -146,7 +145,6 @@
static void *mixmonitor_thread(void *obj)
{
struct mixmonitor *mixmonitor = obj;
- struct ast_frame *f = NULL;
struct ast_filestream *fs = NULL;
unsigned int oflags;
char *ext;
@@ -155,58 +153,48 @@
if (option_verbose > 1)
ast_verbose(VERBOSE_PREFIX_2 "Begin MixMonitor Recording %s\n", mixmonitor->name);
- ast_mutex_lock(&mixmonitor->spy.lock);
-
- while (mixmonitor->spy.chan) {
- struct ast_frame *next;
- int write;
-
- ast_channel_spy_trigger_wait(&mixmonitor->spy);
-
- if (!mixmonitor->spy.chan || mixmonitor->spy.status != CHANSPY_RUNNING)
+ ast_audiohook_lock(&mixmonitor->audiohook);
+
+ while (mixmonitor->audiohook.status == AST_AUDIOHOOK_STATUS_RUNNING) {
+ struct ast_frame *fr = NULL;
+
+ ast_audiohook_trigger_wait(&mixmonitor->audiohook);
+
+ if (mixmonitor->audiohook.status != AST_AUDIOHOOK_STATUS_RUNNING)
break;
- while (1) {
- if (!(f = ast_channel_spy_read_frame(&mixmonitor->spy, SAMPLES_PER_FRAME)))
- break;
-
- write = (!ast_test_flag(mixmonitor, MUXFLAG_BRIDGED) ||
- ast_bridged_channel(mixmonitor->spy.chan));
-
- /* it is possible for ast_channel_spy_read_frame() to return a chain
- of frames if a queue flush was necessary, so process them
- */
- for (; f; f = next) {
- next = AST_LIST_NEXT(f, frame_list);
- if (write && errflag == 0) {
- if (!fs) {
- /* Determine creation flags and filename plus extension for filestream */
- oflags = O_CREAT | O_WRONLY;
- oflags |= ast_test_flag(mixmonitor, MUXFLAG_APPEND) ? O_APPEND : O_TRUNC;
-
- if ((ext = strrchr(mixmonitor->filename, '.')))
- *(ext++) = '\0';
- else
- ext = "raw";
-
- /* Move onto actually creating the filestream */
- if (!(fs = ast_writefile(mixmonitor->filename, ext, NULL, oflags, 0, 0644))) {
- ast_log(LOG_ERROR, "Cannot open %s.%s\n", mixmonitor->filename, ext);
- errflag = 1;
- }
-
- }
- if (fs)
- ast_writestream(fs, f);
+ if (!(fr = ast_audiohook_read_frame(&mixmonitor->audiohook, SAMPLES_PER_FRAME, AST_AUDIOHOOK_DIRECTION_BOTH, AST_FORMAT_SLINEAR)))
+ continue;
+
+ if (!ast_test_flag(mixmonitor, MUXFLAG_BRIDGED) || ast_bridged_channel(mixmonitor->chan)) {
+ /* Initialize the file if not already done so */
+ if (!fs && !errflag) {
+ oflags = O_CREAT | O_WRONLY;
+ oflags |= ast_test_flag(mixmonitor, MUXFLAG_APPEND) ? O_APPEND : O_TRUNC;
+
+ if ((ext = strrchr(mixmonitor->filename, '.')))
+ *(ext++) = '\0';
+ else
+ ext = "raw";
+
+ if (!(fs = ast_writefile(mixmonitor->filename, ext, NULL, oflags, 0, 0644))) {
+ ast_log(LOG_ERROR, "Cannot open %s.%s\n", mixmonitor->filename, ext);
+ errflag = 1;
}
- ast_frame_free(f, 0);
}
+
+ /* Write out the frame */
+ if (fs)
+ ast_writestream(fs, fr);
}
- }
-
- ast_mutex_unlock(&mixmonitor->spy.lock);
-
- ast_channel_spy_free(&mixmonitor->spy);
+
+ /* All done! free it. */
+ ast_frame_free(fr, 0);
+ }
+
+ ast_audiohook_detach(&mixmonitor->audiohook);
+ ast_audiohook_unlock(&mixmonitor->audiohook);
+ ast_audiohook_destroy(&mixmonitor->audiohook);
if (option_verbose > 1)
ast_verbose(VERBOSE_PREFIX_2 "End MixMonitor Recording %s\n", mixmonitor->name);
@@ -271,27 +259,23 @@
strcpy(mixmonitor->filename, filename);
/* Setup the actual spy before creating our thread */
- ast_set_flag(&mixmonitor->spy, CHANSPY_FORMAT_AUDIO);
- ast_set_flag(&mixmonitor->spy, CHANSPY_MIXAUDIO);
- mixmonitor->spy.type = mixmonitor_spy_type;
- mixmonitor->spy.status = CHANSPY_RUNNING;
- mixmonitor->spy.read_queue.format = AST_FORMAT_SLINEAR;
- mixmonitor->spy.write_queue.format = AST_FORMAT_SLINEAR;
- if (readvol) {
- ast_set_flag(&mixmonitor->spy, CHANSPY_READ_VOLADJUST);
- mixmonitor->spy.read_vol_adjustment = readvol;
- }
- if (writevol) {
- ast_set_flag(&mixmonitor->spy, CHANSPY_WRITE_VOLADJUST);
- mixmonitor->spy.write_vol_adjustment = writevol;
- }
- ast_mutex_init(&mixmonitor->spy.lock);
-
- if (startmon(chan, &mixmonitor->spy)) {
+ if (ast_audiohook_init(&mixmonitor->audiohook, AST_AUDIOHOOK_TYPE_SPY, mixmonitor_spy_type)) {
+ free(mixmonitor);
+ return;
+ }
+
+ ast_set_flag(&mixmonitor->audiohook, AST_AUDIOHOOK_TRIGGER_WRITE);
+
+ if (readvol)
+ mixmonitor->audiohook.options.read_volume = readvol;
+ if (writevol)
+ mixmonitor->audiohook.options.write_volume = writevol;
+
+ if (startmon(chan, &mixmonitor->audiohook)) {
ast_log(LOG_WARNING, "Unable to add '%s' spy to channel '%s'\n",
- mixmonitor->spy.type, chan->name);
+ mixmonitor_spy_type, chan->name);
/* Since we couldn't add ourselves - bail out! */
- ast_mutex_destroy(&mixmonitor->spy.lock);
+ ast_audiohook_destroy(&mixmonitor->audiohook);
free(mixmonitor);
return;
}
@@ -391,9 +375,7 @@
u = ast_module_user_add(chan);
- ast_channel_lock(chan);
- ast_channel_spy_stop_by_type(chan, mixmonitor_spy_type);
- ast_channel_unlock(chan);
+ ast_audiohook_detach_source(chan, mixmonitor_spy_type);
ast_module_user_remove(u);
@@ -415,7 +397,7 @@
if (!strcasecmp(argv[1], "start"))
mixmonitor_exec(chan, argv[3]);
else if (!strcasecmp(argv[1], "stop"))
- ast_channel_spy_stop_by_type(chan, mixmonitor_spy_type);
+ ast_audiohook_detach_source(chan, mixmonitor_spy_type);
ast_channel_unlock(chan);
Modified: team/oej/earlyrtpfix/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/oej/earlyrtpfix/apps/app_queue.c?view=diff&rev=99543&r1=99542&r2=99543
==============================================================================
--- team/oej/earlyrtpfix/apps/app_queue.c (original)
+++ team/oej/earlyrtpfix/apps/app_queue.c Tue Jan 22 11:07:10 2008
@@ -795,6 +795,17 @@
q->context[0] = '\0';
q->monfmt[0] = '\0';
q->periodicannouncefrequency = 0;
+ q->reportholdtime = 0;
+ q->monjoin = 0;
+ q->wrapuptime = 0;
+ q->autofill = 0;
+ q->joinempty = 0;
+ q->leavewhenempty = 0;
+ q->memberdelay = 0;
+ q->maskmemberstatus = 0;
+ q->eventwhencalled = 0;
+ q->weight = 0;
+ q->timeoutrestart = 0;
if (!q->members)
q->members = ao2_container_alloc(37, member_hash_fn, member_cmp_fn);
q->membercount = 0;
Modified: team/oej/earlyrtpfix/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/oej/earlyrtpfix/apps/app_voicemail.c?view=diff&rev=99543&r1=99542&r2=99543
==============================================================================
--- team/oej/earlyrtpfix/apps/app_voicemail.c (original)
+++ team/oej/earlyrtpfix/apps/app_voicemail.c Tue Jan 22 11:07:10 2008
@@ -8812,8 +8812,10 @@
if (vlist->vms->imapuser) {
if (!strcmp(vlist->vms->imapuser,user)) {
if (interactive == 2) {
+ ast_mutex_unlock(&vmstate_lock);
return vlist->vms;
} else if (vlist->vms->interactive == interactive) {
+ ast_mutex_unlock(&vmstate_lock);
return vlist->vms;
}
}
@@ -8849,6 +8851,7 @@
if (!strcmp(vlist->vms->username,mailbox) && vlist->vms->interactive == interactive) {
if (option_debug > 2)
ast_log(LOG_DEBUG, " Found it!\n");
+ ast_mutex_unlock(&vmstate_lock);
return vlist->vms;
}
} else {
Modified: team/oej/earlyrtpfix/build_tools/menuselect-deps.in
URL: http://svn.digium.com/view/asterisk/team/oej/earlyrtpfix/build_tools/menuselect-deps.in?view=diff&rev=99543&r1=99542&r2=99543
==============================================================================
--- team/oej/earlyrtpfix/build_tools/menuselect-deps.in (original)
+++ team/oej/earlyrtpfix/build_tools/menuselect-deps.in Tue Jan 22 11:07:10 2008
@@ -22,6 +22,7 @@
PRI=@PBX_PRI@
RADIUS=@PBX_RADIUS@
SPEEX=@PBX_SPEEX@
+SPEEXDSP=@PBX_SPEEXDSP@
SQLITE=@PBX_SQLITE@
SSL=@PBX_OPENSSL@
TONEZONE=@PBX_TONEZONE@
Modified: team/oej/earlyrtpfix/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/oej/earlyrtpfix/channels/chan_iax2.c?view=diff&rev=99543&r1=99542&r2=99543
==============================================================================
--- team/oej/earlyrtpfix/channels/chan_iax2.c (original)
+++ team/oej/earlyrtpfix/channels/chan_iax2.c Tue Jan 22 11:07:10 2008
@@ -1801,7 +1801,7 @@
the IAX thread with the iaxsl lock held. */
struct iax_frame *fr = data;
fr->retrans = -1;
- fr->af.has_timing_info = 0;
+ ast_clear_flag(&fr->af, AST_FRFLAG_HAS_TIMING_INFO);
if (iaxs[fr->callno] && !ast_test_flag(iaxs[fr->callno], IAX_ALREADYGONE))
iax2_queue_frame(fr->callno, &fr->af);
/* Free our iax frame */
@@ -2683,7 +2683,7 @@
if (peername) {
var = ast_load_realtime("iaxpeers", "name", peername, "host", "dynamic", NULL);
if (!var && sin)
- var = ast_load_realtime("iaxpeers", "name", peername, "host", ast_inet_ntoa(sin->sin_addr));
+ var = ast_load_realtime("iaxpeers", "name", peername, "host", ast_inet_ntoa(sin->sin_addr), NULL);
} else if (sin) {
char porta[25];
sprintf(porta, "%d", ntohs(sin->sin_port));
@@ -2802,7 +2802,7 @@
var = ast_load_realtime("iaxusers", "name", username, "host", "dynamic", NULL);
if (!var)
- var = ast_load_realtime("iaxusers", "name", username, "host", ast_inet_ntoa(sin->sin_addr));
+ var = ast_load_realtime("iaxusers", "name", username, "host", ast_inet_ntoa(sin->sin_addr), NULL);
if (!var && sin) {
char porta[6];
snprintf(porta, sizeof(porta), "%d", ntohs(sin->sin_port));
@@ -2896,12 +2896,13 @@
char mohsuggest[MAX_MUSICCLASS];
};
-static int create_addr(const char *peername, struct sockaddr_in *sin, struct create_addr_info *cai)
+static int create_addr(const char *peername, struct ast_channel *c, struct sockaddr_in *sin, struct create_addr_info *cai)
{
struct ast_hostent ahp;
struct hostent *hp;
struct iax2_peer *peer;
int res = -1;
+ struct ast_codec_pref ourprefs;
ast_clear_flag(cai, IAX_SENDANI | IAX_TRUNK);
cai->sockfd = defaultsockfd;
@@ -2916,7 +2917,11 @@
memcpy(&sin->sin_addr, hp->h_addr, sizeof(sin->sin_addr));
sin->sin_port = htons(IAX_DEFAULT_PORTNO);
/* use global iax prefs for unknown peer/user */
- ast_codec_pref_convert(&prefs, cai->prefs, sizeof(cai->prefs), 1);
+ /* But move the calling channel's native codec to the top of the preference list */
+ memcpy(&ourprefs, &prefs, sizeof(ourprefs));
+ if (c)
+ ast_codec_pref_prepend(&ourprefs, c->nativeformats, 1);
+ ast_codec_pref_convert(&ourprefs, cai->prefs, sizeof(cai->prefs), 1);
return 0;
} else {
ast_log(LOG_WARNING, "No such host: %s\n", peername);
@@ -2940,7 +2945,13 @@
cai->encmethods = peer->encmethods;
cai->sockfd = peer->sockfd;
cai->adsi = peer->adsi;
- ast_codec_pref_convert(&peer->prefs, cai->prefs, sizeof(cai->prefs), 1);
+ memcpy(&ourprefs, &peer->prefs, sizeof(ourprefs));
+ /* Move the calling channel's native codec to the top of the preference list */
+ if (c) {
+ ast_log(LOG_DEBUG, "prepending %x to prefs\n", c->nativeformats);
+ ast_codec_pref_prepend(&ourprefs, c->nativeformats, 1);
+ }
+ ast_codec_pref_convert(&ourprefs, cai->prefs, sizeof(cai->prefs), 1);
ast_copy_string(cai->context, peer->context, sizeof(cai->context));
ast_copy_string(cai->peercontext, peer->peercontext, sizeof(cai->peercontext));
ast_copy_string(cai->username, peer->username, sizeof(cai->username));
@@ -3115,7 +3126,7 @@
if (!pds.exten)
pds.exten = defaultrdest;
- if (create_addr(pds.peer, &sin, &cai)) {
+ if (create_addr(pds.peer, c, &sin, &cai)) {
ast_log(LOG_WARNING, "No address associated with '%s'\n", pds.peer);
return -1;
}
@@ -8499,7 +8510,7 @@
if (end) {
memcpy(&sin, end, sizeof(sin));
cai.sockfd = sockfd;
- } else if (create_addr(dest, &sin, &cai))
+ } else if (create_addr(dest, NULL, &sin, &cai))
return -1;
/* Build the rest of the message */
@@ -8722,7 +8733,7 @@
/* Populate our address from the given */
- if (create_addr(pds.peer, &sin, &cai)) {
+ if (create_addr(pds.peer, NULL, &sin, &cai)) {
*cause = AST_CAUSE_UNREGISTERED;
return NULL;
}
@@ -10037,7 +10048,7 @@
parse_dial_string(tmpstr, &pds);
/* Populate our address from the given */
- if (create_addr(pds.peer, &sin, &cai))
+ if (create_addr(pds.peer, NULL, &sin, &cai))
return -1;
if (option_debug)
Modified: team/oej/earlyrtpfix/channels/chan_local.c
URL: http://svn.digium.com/view/asterisk/team/oej/earlyrtpfix/channels/chan_local.c?view=diff&rev=99543&r1=99542&r2=99543
==============================================================================
--- team/oej/earlyrtpfix/channels/chan_local.c (original)
+++ team/oej/earlyrtpfix/channels/chan_local.c Tue Jan 22 11:07:10 2008
@@ -221,6 +221,7 @@
static void check_bridge(struct local_pvt *p, int isoutbound)
{
+ struct ast_channel_monitor *tmp;
if (ast_test_flag(p, LOCAL_ALREADY_MASQED) || ast_test_flag(p, LOCAL_NO_OPTIMIZATION) || !p->chan || !p->owner || (p->chan->_bridge != ast_bridged_channel(p->chan)))
return;
@@ -238,6 +239,16 @@
if (!p->chan->_bridge->_softhangup) {
if (!ast_mutex_trylock(&p->owner->lock)) {
if (!p->owner->_softhangup) {
+ if(p->owner->monitor && !p->chan->_bridge->monitor) {
+ /* If a local channel is being monitored, we don't want a masquerade
+ * to cause the monitor to go away. Since the masquerade swaps the monitors,
+ * pre-swapping the monitors before the masquerade will ensure that the monitor
+ * ends up where it is expected.
+ */
+ tmp = p->owner->monitor;
+ p->owner->monitor = p->chan->_bridge->monitor;
+ p->chan->_bridge->monitor = tmp;
+ }
ast_channel_masquerade(p->owner, p->chan->_bridge);
ast_set_flag(p, LOCAL_ALREADY_MASQED);
}
@@ -493,8 +504,16 @@
isoutbound = IS_OUTBOUND(ast, p);
if (isoutbound) {
const char *status = pbx_builtin_getvar_helper(p->chan, "DIALSTATUS");
- if ((status) && (p->owner))
+ if ((status) && (p->owner)) {
+ /* Deadlock avoidance */
+ while (ast_channel_trylock(p->owner)) {
+ ast_mutex_unlock(&p->lock);
+ usleep(1);
+ ast_mutex_lock(&p->lock);
+ }
pbx_builtin_setvar_helper(p->owner, "CHANLOCALSTATUS", status);
+ ast_channel_unlock(p->owner);
+ }
p->chan = NULL;
ast_clear_flag(p, LOCAL_LAUNCHED_PBX);
ast_module_user_remove(p->u_chan);
Modified: team/oej/earlyrtpfix/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/oej/earlyrtpfix/channels/chan_sip.c?view=diff&rev=99543&r1=99542&r2=99543
==============================================================================
--- team/oej/earlyrtpfix/channels/chan_sip.c (original)
+++ team/oej/earlyrtpfix/channels/chan_sip.c Tue Jan 22 11:07:10 2008
@@ -150,7 +150,6 @@
#include "asterisk/threadstorage.h"
#include "asterisk/translate.h"
#include "asterisk/dnsmgr.h"
-#include "asterisk/astobj2.h"
#ifndef FALSE
#define FALSE 0
@@ -1029,6 +1028,7 @@
/*! \brief sip packet - raw format for outbound packets that are sent or scheduled for transmission */
struct sip_pkt {
+ struct sip_pkt *next; /*!< Next packet in linked list */
int retrans; /*!< Retransmission number */
int method; /*!< SIP method for this packet */
int seqno; /*!< Sequence number */
@@ -1856,7 +1856,7 @@
if (!(hist = ast_calloc(1, sizeof(*hist) + l)))
return;
if (!p->history && !(p->history = ast_calloc(1, sizeof(*p->history)))) {
- ast_free(hist);
+ free(hist);
return;
}
memcpy(hist->event, buf, l);
@@ -1893,15 +1893,12 @@
/*! \brief Retransmit SIP message if no answer (Called from scheduler) */
static int retrans_pkt(const void *data)
{
- struct sip_pkt *pkt = (struct sip_pkt *)data, *prev;
+ struct sip_pkt *pkt = (struct sip_pkt *)data, *prev, *cur = NULL;
int reschedule = DEFAULT_RETRANS;
int xmitres = 0;
- ao2_ref(pkt, 1); /* Make sure this cannot go away while we're using it */
-
/* Lock channel PVT */
- if (pkt->owner)
- ast_mutex_lock(&pkt->owner->lock);
+ ast_mutex_lock(&pkt->owner->lock);
if (pkt->retrans < MAX_RETRANS) {
pkt->retrans++;
@@ -1929,7 +1926,7 @@
ast_log(LOG_DEBUG, "** SIP timers: Rescheduling retransmission %d to %d ms (t1 %d ms (Retrans id #%d)) \n", pkt->retrans +1, siptimer_a, pkt->timer_t1, pkt->retransid);
}
- if (pkt->owner && sip_debug_test_pvt(pkt->owner)) {
+ if (sip_debug_test_pvt(pkt->owner)) {
const struct sockaddr_in *dst = sip_real_dst(pkt->owner);
ast_verbose("Retransmitting #%d (%s) to %s:%d:\n%s\n---\n",
pkt->retrans, sip_nat_mode(pkt->owner),
@@ -1939,43 +1936,38 @@
append_history(pkt->owner, "ReTx", "%d %s", reschedule, pkt->data);
xmitres = __sip_xmit(pkt->owner, pkt->data, pkt->packetlen);
- if (pkt->owner)
- ast_mutex_unlock(&pkt->owner->lock);
+ ast_mutex_unlock(&pkt->owner->lock);
if (xmitres == XMIT_ERROR)
- ast_log(LOG_WARNING, "Network error on retransmit in dialog %s\n", pkt->owner ? pkt->owner->callid : "<unknown>");
- else {
- ao2_ref(pkt, -1);
+ ast_log(LOG_WARNING, "Network error on retransmit in dialog %s\n", pkt->owner->callid);
+ else
return reschedule;
- }
}
/* Too many retries */
if (pkt->owner && pkt->method != SIP_OPTIONS && xmitres == 0) {
if (ast_test_flag(pkt, FLAG_FATAL) || sipdebug) /* Tell us if it's critical or if we're debugging */
ast_log(LOG_WARNING, "Maximum retries exceeded on transmission %s for seqno %d (%s %s)\n", pkt->owner->callid, pkt->seqno, (ast_test_flag(pkt, FLAG_FATAL)) ? "Critical" : "Non-critical", (ast_test_flag(pkt, FLAG_RESPONSE)) ? "Response" : "Request");
- } else if (pkt->owner && (pkt->method == SIP_OPTIONS) && sipdebug) {
- ast_log(LOG_WARNING, "Cancelling retransmit of OPTIONs (call id %s) \n", pkt->owner->callid);
- }
- if (pkt->owner) {
- if (xmitres == XMIT_ERROR) {
- ast_log(LOG_WARNING, "Transmit error :: Cancelling transmission of transaction in call id %s \n", pkt->owner->callid);
- append_history(pkt->owner, "XmitErr", "%s", (ast_test_flag(pkt, FLAG_FATAL)) ? "(Critical)" : "(Non-critical)");
- } else
- append_history(pkt->owner, "MaxRetries", "%s", (ast_test_flag(pkt, FLAG_FATAL)) ? "(Critical)" : "(Non-critical)");
- }
+ } else if ((pkt->method == SIP_OPTIONS) && sipdebug) {
+ ast_log(LOG_WARNING, "Cancelling retransmit of OPTIONs (call id %s) \n", pkt->owner->callid);
+ }
+ if (xmitres == XMIT_ERROR) {
+ ast_log(LOG_WARNING, "Transmit error :: Cancelling transmission of transaction in call id %s \n", pkt->owner->callid);
+ append_history(pkt->owner, "XmitErr", "%s", (ast_test_flag(pkt, FLAG_FATAL)) ? "(Critical)" : "(Non-critical)");
+ } else
+ append_history(pkt->owner, "MaxRetries", "%s", (ast_test_flag(pkt, FLAG_FATAL)) ? "(Critical)" : "(Non-critical)");
+
pkt->retransid = -1;
if (ast_test_flag(pkt, FLAG_FATAL)) {
- while (pkt->owner && pkt->owner->owner && ast_channel_trylock(pkt->owner->owner)) {
+ while(pkt->owner->owner && ast_channel_trylock(pkt->owner->owner)) {
ast_mutex_unlock(&pkt->owner->lock); /* SIP_PVT, not channel */
usleep(1);
- if (pkt->owner)
- ast_mutex_lock(&pkt->owner->lock);
- }
-
- if (pkt->owner && pkt->owner->owner && !pkt->owner->owner->hangupcause)
+ ast_mutex_lock(&pkt->owner->lock);
+ }
+
+ if (pkt->owner->owner && !pkt->owner->owner->hangupcause)
pkt->owner->owner->hangupcause = AST_CAUSE_NO_USER_RESPONSE;
- if (pkt->owner && pkt->owner->owner) {
+ if (pkt->owner->owner) {
sip_alreadygone(pkt->owner);
ast_log(LOG_WARNING, "Hanging up call %s - no reply to our critical packet.\n", pkt->owner->callid);
ast_queue_hangup(pkt->owner->owner);
@@ -1984,7 +1976,7 @@
/* If no channel owner, destroy now */
/* Let the peerpoke system expire packets when the timer expires for poke_noanswer */
- if (pkt->owner && pkt->method != SIP_OPTIONS) {
+ if (pkt->method != SIP_OPTIONS) {
ast_set_flag(&pkt->owner->flags[0], SIP_NEEDDESTROY);
sip_alreadygone(pkt->owner);
if (option_debug)
@@ -1993,7 +1985,7 @@
}
}
- if (pkt->owner && pkt->method == SIP_BYE) {
+ if (pkt->method == SIP_BYE) {
/* We're not getting answers on SIP BYE's. Tear down the call anyway. */
if (pkt->owner->owner)
ast_channel_unlock(pkt->owner->owner);
@@ -2002,23 +1994,23 @@
}
/* In any case, go ahead and remove the packet */
- if (pkt->owner && (prev = ao2_find(pkt->owner->packets, pkt, OBJ_UNLINK | OBJ_POINTER))) {
- /* Destroy the container's reference (inherited) */
- ao2_ref(prev, -1);
+ for (prev = NULL, cur = pkt->owner->packets; cur; prev = cur, cur = cur->next) {
+ if (cur == pkt)
+ break;
+ }
+ if (cur) {
+ if (prev)
+ prev->next = cur->next;
+ else
+ pkt->owner->packets = cur->next;
ast_mutex_unlock(&pkt->owner->lock);
- /* Now destroy our initial reference */
- ao2_ref(pkt, -1);
- /* And destroy the sched ref */
- ao2_ref(pkt, -1);
- return 0;
- } else {
+ free(cur);
+ pkt = NULL;
+ } else
ast_log(LOG_WARNING, "Weird, couldn't find packet owner!\n");
- if (pkt->owner)
- ast_mutex_unlock(&pkt->owner->lock);
- ao2_ref(pkt, -1); /* Initial ref */
- ao2_ref(pkt, -1); /* Sched ref */
- return 0;
- }
+ if (pkt)
+ ast_mutex_unlock(&pkt->owner->lock);
+ return 0;
}
/*! \brief Transmit packet with retransmits
@@ -2030,11 +2022,12 @@
int siptimer_a = DEFAULT_RETRANS;
int xmitres = 0;
- if (!(pkt = ao2_alloc(sizeof(*pkt) + len + 1, ast_free)))
+ if (!(pkt = ast_calloc(1, sizeof(*pkt) + len + 1)))
return AST_FAILURE;
memcpy(pkt->data, data, len);
pkt->method = sipmethod;
pkt->packetlen = len;
+ pkt->next = p->packets;
pkt->owner = p;
pkt->seqno = seqno;
if (resp)
@@ -2046,9 +2039,12 @@
if (pkt->timer_t1)
siptimer_a = pkt->timer_t1 * 2;
+ /* Schedule retransmission */
+ pkt->retransid = ast_sched_add_variable(sched, siptimer_a, retrans_pkt, pkt, 1);
if (option_debug > 3 && sipdebug)
ast_log(LOG_DEBUG, "*** SIP TIMER: Initializing retransmit timer on packet: Id #%d\n", pkt->retransid);
-
+ pkt->next = p->packets;
+ p->packets = pkt;
if (sipmethod == SIP_INVITE) {
/* Note this is a pending invite */
p->pendinginvite = seqno;
@@ -2058,25 +2054,11 @@
if (xmitres == XMIT_ERROR) { /* Serious network trouble, no need to try again */
append_history(pkt->owner, "XmitErr", "%s", (ast_test_flag(pkt, FLAG_FATAL)) ? "(Critical)" : "(Non-critical)");
+ ast_sched_del(sched, pkt->retransid); /* No more retransmission */
pkt->retransid = -1;
- ao2_ref(pkt, -1); /* and deallocate */
return AST_FAILURE;
- } else {
- /* Add refcount for scheduler pointer */
- ao2_ref(pkt, 1);
- /* Schedule retransmission */
- pkt->retransid = ast_sched_add_variable(sched, siptimer_a, retrans_pkt, pkt, 1);
- /* Link into the list of packets */
- ao2_link(p->packets, pkt);
+ } else
return AST_SUCCESS;
- }
-}
-
-static int __deref_ao2_owner_cb(void *obj, void *unused, int flags)
-{
- struct sip_pkt *pkt = obj;
- pkt->owner = NULL;
- return 0;
}
/*! \brief Kill a SIP dialog (called by scheduler) */
@@ -2090,15 +2072,16 @@
p->subscribed = NONE;
append_history(p, "Subscribestatus", "timeout");
if (option_debug > 2)
- ast_log(LOG_DEBUG, "Re-scheduled destruction of SIP subscription %s\n", p->callid ? p->callid : "<unknown>");
+ ast_log(LOG_DEBUG, "Re-scheduled destruction of SIP subsription %s\n", p->callid ? p->callid : "<unknown>");
return 10000; /* Reschedule this destruction so that we know that it's gone */
}
- /* If there are packets still waiting for delivery, make sure they can't callback to us anymore. */
- if (ao2_container_count(p->packets)) {
- ast_mutex_lock(&p->lock);
- ao2_callback(p->packets, 0, __deref_ao2_owner_cb, NULL);
- ast_mutex_unlock(&p->lock);
+ /* If there are packets still waiting for delivery, delay the destruction */
+ if (p->packets) {
+ if (option_debug > 2)
+ ast_log(LOG_DEBUG, "Re-scheduled destruction of SIP call %s\n", p->callid ? p->callid : "<unknown>");
+ append_history(p, "ReliableXmit", "timeout");
+ return 10000;
}
/* If we're destroying a subscription, dereference peer object too */
@@ -2155,8 +2138,7 @@
/*! \brief Acknowledges receipt of a packet and stops retransmission */
static void __sip_ack(struct sip_pvt *p, int seqno, int resp, int sipmethod)
{
- struct sip_pkt *cur;
- struct ao2_iterator ao2i;
+ struct sip_pkt *cur, *prev = NULL;
/* Just in case... */
char *msg;
@@ -2165,8 +2147,7 @@
msg = sip_methods[sipmethod].text;
ast_mutex_lock(&p->lock);
- ao2i = ao2_iterator_init(p->packets, 0);
- while ((cur = ao2_iterator_next(&ao2i))) {
+ for (cur = p->packets; cur; prev = cur, cur = cur->next) {
if ((cur->seqno == seqno) && ((ast_test_flag(cur, FLAG_RESPONSE)) == resp) &&
((ast_test_flag(cur, FLAG_RESPONSE)) ||
(!strncasecmp(msg, cur->data, strlen(msg)) && (cur->data[strlen(msg)] < 33)))) {
@@ -2177,68 +2158,59 @@
}
/* this is our baby */
res = TRUE;
+ UNLINK(cur, p->packets, prev);
if (cur->retransid > -1) {
if (sipdebug && option_debug > 3)
ast_log(LOG_DEBUG, "** SIP TIMER: Cancelling retransmit of packet (reply received) Retransid #%d\n", cur->retransid);
- if (!ast_sched_del(sched, cur->retransid))
- ao2_ref(cur, -1); /* scheduler deref */
+ ast_sched_del(sched, cur->retransid);
cur->retransid = -1;
}
-
- /* Remove it from the list */
- ao2_unlink(p->packets, cur);
- ao2_ref(cur, -1); /* iterator deref */
+ free(cur);
break;
}
-
- ao2_ref(cur, -1); /* iterator deref */
}
ast_mutex_unlock(&p->lock);
if (option_debug)
[... 2406 lines stripped ...]
More information about the asterisk-commits
mailing list