[asterisk-commits] murf: branch murf/cdr-debug-1.4 r168512 - in /team/murf/cdr-debug-1.4: ./ app...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Jan 12 15:16:01 CST 2009
Author: murf
Date: Mon Jan 12 15:16:01 2009
New Revision: 168512
URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=168512
Log:
Merged revisions 166093,166157,166262,166297,166380,166509,166568,166592,166772,166953,167095,167179,167260,167299,167432,167541,167545,167554,167566,167620,167714,167840,168128,168191,168198,168267,168379,168382,168480,168482,168507 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
................
r166093 | murf | 2008-12-19 15:30:32 -0700 (Fri, 19 Dec 2008) | 133 lines
This merges the masqpark branch into 1.4
These changes eliminate the need for (and use of)
the KEEPALIVE return code in res_features.c;
There are other places that use this result code
for similar purposes at a higher level, these appear
to be left alone in 1.4, but attacked in trunk.
The reason these changes are being made in 1.4, is
that parking ends a channel's life, in some situations,
and the code in the bridge (and some other places),
was not checking the result code properly, and dereferencing
the channel pointer, which could lead to memory corruption
and crashes.
Calling the masq_park function eliminates this danger
in higher levels.
A series of previous commits have replaced some parking calls
with masq_park, but this patch puts them ALL to rest,
(except one, purposely left alone because a masquerade
is done anyway), and gets rid of the code that tests
the KEEPALIVE result, and the NOHANGUP_PEER result codes.
While bug 13820 inspired this work, this patch does
not solve all the problems mentioned there.
I have tested this patch (again) to make sure I have
not introduced regressions.
Crashes that occurred when a parked party hung up
while the parking party was listening to the numbers
of the parking stall being assigned, is eliminated.
These are the cases where parking code may be activated:
1. Feature one touch (eg. *3)
2. Feature blind xfer to parking lot (eg ##700)
3. Run Park() app from dialplan (eg sip xfer to 700)
(eg. dahdi hookflash xfer to 700)
4. Run Park via manager.
The interesting testing cases for parking are:
I. A calls B, A parks B
a. B hangs up while A is getting the numbers announced.
b. B hangs up after A gets the announcement, but
before the parking time expires
c. B waits, time expires, A is redialed,
A answers, B and A are connected, after
which, B hangs up.
d. C picks up B while still in parking lot.
II. A calls B, B parks A
a. A hangs up while B is getting the numbers announced.
b. A hangs up after B gets the announcement, but
before the parking time expires
c. A waits, time expires, B is redialed,
B answers, A and B are connected, after
which, A hangs up.
d. C picks up A while still in parking lot.
Testing this throroughly involves acting all the permutations
of I and II, in situations 1,2,3, and 4.
Since I added a few more changes (ALL references to KEEPALIVE in the bridge
code eliimated (I missed one earlier), I retested
most of the above cases, and no crashes.
H-extension weirdness.
Current h-extension execution is not completely
correct for several of the cases.
For the case where A calls B, and A parks B, the
'h' exten is run on A's channel as soon as the park
is accomplished. This is expected behavior.
But when A calls B, and B parks A, this will be
current behavior:
After B parks A, B is hung up by the system, and
the 'h' (hangup) exten gets run, but the channel
mentioned will be a derivative of A's...
Thus, if A is DAHDI/1, and B is DAHDI/2,
the h-extension will be run on channel
Parked/DAHDI/1-1<ZOMBIE>, and the
start/answer/end info will be those
relating to Channel A.
And, in the case where A is reconnected to
B after the park time expires, when both parties
hang up after the joyful reunion, no h-exten
will be run at all.
In the case where C picks up A from the
parking lot, when either A or C hang up,
the h-exten will be run for the C channel.
CDR's are a separate issue, and not addressed
here.
As to WHY this strange behavior occurs,
the answer lies in the procedure followed
to accomplish handing over the channel
to the parking manager thread. This procedure
is called masquerading. In the process,
a duplicate copy of the channel is created,
and most of the active data is given to the
new copy. The original channel gets its name
changed to XXX<ZOMBIE> and keeps the PBX
information for the sake of the original
thread (preserving its role as a call
originator, if it had this role to begin
with), while the new channel is without
this info and becomes a call target (a
"peer").
In this case, the parking lot manager
thread is handed the new (masqueraded)
channel. It will not run an h-exten
on the channel if it hangs up while
in the parking lot. The h exten will
be run on the original channel instead,
in the original thread, after the bridge
completes.
See bug 13820 for our intentions as
to how to clean up the h exten behavior.
Review: http://reviewboard.digium.com/r/29/
................
r166157 | mmichelson | 2008-12-19 16:34:57 -0700 (Fri, 19 Dec 2008) | 9 lines
Backport of AUDIOHOOK_INHERIT for Asterisk 1.4
(closes issue #13538)
Reported by: mbit
Patches:
13538.patch uploaded by putnopvut (license 60)
Tested by: putnopvut
................
r166262 | russell | 2008-12-22 07:45:27 -0700 (Mon, 22 Dec 2008) | 7 lines
Re-work ref count handling of MoH classes using astobj2 to resolve crashes.
(closes issue #13566)
Reported by: igorcarneiro
Tested by: russell
Review: http://reviewboard.digium.com/r/106/
................
r166297 | russell | 2008-12-22 10:22:56 -0700 (Mon, 22 Dec 2008) | 2 lines
Fix up timeout handling in ast_carefulwrite().
................
r166380 | mmichelson | 2008-12-22 13:56:29 -0700 (Mon, 22 Dec 2008) | 36 lines
Fix a deadlock relating to channel locks and autoservice
It has been discovered that if a channel is locked prior
to a call to ast_autoservice_stop, then it is likely that
a deadlock will occur. The reason is that the call to
ast_autoservice_stop has a check built into it to be sure
that the thread running autoservice is not currently trying
to manipulate the channel we are about to pull out of
autoservice.
The autoservice thread, however, cannot advance beyond where
it currently is, though, because it is trying to acquire
the lock of the channel for which autoservice is attempting
to be stopped.
The gist of all this is that a channel MUST NOT be locked
when attempting to stop autoservice on the channel.
In this particular case, the channel was locked by a call
to ast_read. A call to ast_exists_extension led to autoservice
being started and stopped due to the existence of dialplan
switches.
It may be that there are future commits which handle the same
symptoms but in a different location, but based on my looks through
the code, it is very rare to see a construct such as this one.
(closes issue #14057)
Reported by: rtrauntvein
Patches:
14057v3.patch uploaded by putnopvut (license 60)
Tested by: rtrauntvein
Review: http://reviewboard.digium.com/r/107/
................
r166509 | tilghman | 2008-12-22 21:05:25 -0700 (Mon, 22 Dec 2008) | 4 lines
Use the integer form of condition for integer comparisons.
(closes issue #14127)
Reported by: andrew
................
r166568 | mmichelson | 2008-12-23 08:16:26 -0700 (Tue, 23 Dec 2008) | 12 lines
Fix a crash resulting from a datastore with inheritance but no duplicate callback
The fix for this is to simply set the newly created datastore's data pointer
to NULL if it is inherited but has no duplicate callback.
(closes issue #14113)
Reported by: francesco_r
Patches:
14113.patch uploaded by putnopvut (license 60)
Tested by: francesco_r
................
r166592 | tilghman | 2008-12-23 08:35:38 -0700 (Tue, 23 Dec 2008) | 3 lines
Compile, even if both DAHDI and Zaptel are not installed.
(Closes issue #14120)
................
r166772 | russell | 2008-12-28 08:13:48 -0700 (Sun, 28 Dec 2008) | 4 lines
Use strncat() instead of an sprintf() in which source and target buffers overlap
http://lists.digium.com/pipermail/asterisk-dev/2008-December/035919.html
................
r166953 | tilghman | 2008-12-31 12:20:35 -0700 (Wed, 31 Dec 2008) | 5 lines
Also inherit the musiconhold class.
(Closes #14153)
Reported by: Jerry Geis, via the users list.
Patch by: me (license 14)
................
r167095 | tilghman | 2008-12-31 17:01:22 -0700 (Wed, 31 Dec 2008) | 5 lines
Repeat attempts to write when we receive -EAGAIN from the driver, as detailed
in the ALSA sample code (see http://www.alsa-project.org/alsa-doc/alsa-lib/_2test_2pcm_8c-example.html#a32)
Reported by: Jerry Geis (via the -users list)
Fixed by: me (license 14)
................
r167179 | mmichelson | 2009-01-05 09:51:59 -0700 (Mon, 05 Jan 2009) | 41 lines
A couple of changes to T.38 SDP attribute handling
There are some boolean attributes for T.38 such
as T38FaxFillBitRemoval, T38FaxTranscodingMMR, and
T38FaxTranscodingJBIG. By simply being present, we
should treat these as a "true" value. The current
code, however, was requiring a 1 or 0 as the value
of the attribute in order to parse it. This is due
to the fact that there are some T.38 endpoints and
gateways that also transmit this information
incorrectly. This patch follows the "be liberal in
what you accept and strict in what you send"
philosophy by accepting both the correctly- and
incorrectly-formatted attributes, but only sending
information as it is supposed to be sent.
It was also discovered that a particular type of
T.38 gateway sends some non-standard T.38 SDP
attributes. Instead of using T38FaxMaxDatagram
and T38MaxBitRate, it used T38MaxDatagram and
T38FaxMaxRate respectively. We now will properly
accept these attributes as well.
Note that there are a lot of patches cited in
the below commit message template. This is
because the person who submitted these patches is
an awesome person and wrote 1.4, 1.6.0, and 1.6.1
variants.
(closes issue #13976)
Reported by: linulin
Patches:
chan_sip.c.1.4-update1.diff uploaded by arcivanov (license 648)
chan_sip.c.1.6.0-update1.diff uploaded by arcivanov (license 648)
chan_sip.c.1.6.1-update1.diff uploaded by arcivanov (license 648)
chan_sip.c.1.4-relaxedT38_update1.diff uploaded by arcivanov (license 648)
chan_sip.c.1.6.0-relaxedT38_update1.diff uploaded by arcivanov (license 648)
chan_sip.c.1.6.1-relaxedT38_update1.diff uploaded by arcivanov (license 648)
Tested by: arcivanov
................
r167260 | tilghman | 2009-01-06 13:48:05 -0700 (Tue, 06 Jan 2009) | 9 lines
Merged revisions 167259 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2
........
r167259 | tilghman | 2009-01-06 14:44:03 -0600 (Tue, 06 Jan 2009) | 2 lines
Security fix AST-2009-001.
........
................
r167299 | mmichelson | 2009-01-06 14:35:57 -0700 (Tue, 06 Jan 2009) | 8 lines
Use the correct variable when creating the format string
(closes issue #14177)
Reported by: nic_bellamy
Patches:
asterisk-trunk-svn-r167242-ast_db_gettree.patch uploaded by nic (license 299)
................
r167432 | russell | 2009-01-07 10:29:53 -0700 (Wed, 07 Jan 2009) | 4 lines
Treat an empty string the same way as a NULL country argument.
In passing, simplify the handling of returning a default tone zone.
................
r167541 | russell | 2009-01-07 15:03:59 -0700 (Wed, 07 Jan 2009) | 4 lines
Don't use free() directly. This caused a crash since ast_filestream is now an ao2 object.
Reported by JunK-Y on IRC, #asterisk-dev
................
r167545 | russell | 2009-01-07 15:19:47 -0700 (Wed, 07 Jan 2009) | 2 lines
Only try to close the file if one was actually opened
................
r167554 | russell | 2009-01-07 15:26:42 -0700 (Wed, 07 Jan 2009) | 2 lines
Don't fclose() the file early, the filestream destructor will handle it.
................
r167566 | russell | 2009-01-07 15:35:36 -0700 (Wed, 07 Jan 2009) | 2 lines
Fix the last couple of places where free() was improperly used directly.
................
r167620 | kpfleming | 2009-01-07 16:32:21 -0700 (Wed, 07 Jan 2009) | 5 lines
When a SIP request or response arrives for a dialog with an associated Asterisk channel, and the lock on that channel cannot be obtained because it is held by another thread, instead of dropping the request/response, queue it for later processing when the channel lock becomes available.
http://reviewboard.digium.com/r/117/
................
r167714 | kpfleming | 2009-01-08 10:24:21 -0700 (Thu, 08 Jan 2009) | 1 line
remove an unnecessary argument to queue_request()
................
r167840 | tilghman | 2009-01-08 15:08:56 -0700 (Thu, 08 Jan 2009) | 6 lines
Don't truncate database results at 255 chars.
(closes issue #14069)
Reported by: evandro
Patches:
20081214__bug14069.diff.txt uploaded by Corydon76 (license 14)
................
r168128 | mmichelson | 2009-01-09 13:08:04 -0700 (Fri, 09 Jan 2009) | 13 lines
Add check_via calls to more request handlers
INFO, NOTIFY, OPTIONS, REFER, and MESSAGE requests
were not checking the topmost Via to determine where
to send the response. Adding check_via calls to those
request handlers solves this.
(closes issue #13071)
Reported by: baron
Patches:
check_via.patch uploaded by baron (license 531)
Tested by: baron
................
r168191 | rmudgett | 2009-01-09 14:28:42 -0700 (Fri, 09 Jan 2009) | 3 lines
* Fix for JIRA AST-175/ABE-1757
* Miscellaneous doxygen comments added.
................
r168198 | russell | 2009-01-09 15:14:38 -0700 (Fri, 09 Jan 2009) | 2 lines
Make this compile for mvanbaak
................
r168267 | kpfleming | 2009-01-09 16:12:29 -0700 (Fri, 09 Jan 2009) | 1 line
update to use new sound file packages that include license files
................
r168379 | kpfleming | 2009-01-10 13:38:38 -0700 (Sat, 10 Jan 2009) | 1 line
small commit to test new server
................
r168382 | kpfleming | 2009-01-10 13:47:31 -0700 (Sat, 10 Jan 2009) | 1 line
small commit to test new server
................
r168480 | russell | 2009-01-12 07:57:27 -0700 (Mon, 12 Jan 2009) | 2 lines
s/ringdance/ringcadence/ for Bulgaria
................
r168482 | mmichelson | 2009-01-12 07:58:25 -0700 (Mon, 12 Jan 2009) | 5 lines
I am reverting the fix made in revision 168128 (and its upward merges)
after being contacted by Olle Johansson and being shown how this fix is
incorrect. Thanks to Olle for clearing this up for me.
................
r168507 | jpeeler | 2009-01-12 13:26:22 -0700 (Mon, 12 Jan 2009) | 9 lines
(closes issue #12269)
Reported by: IgorG
Tested by: denisgalvao
This gits rid of the notion of an owning_app allowing the request and hangup to be initiated by different threads. Originating from an active agent channel requires this. The implementation primarily changes __login_exec to wait on a condition variable rather than a lock.
Review: http://reviewboard.digium.com/r/35/
................
Added:
team/murf/cdr-debug-1.4/funcs/func_audiohookinherit.c
- copied unchanged from r168507, branches/1.4/funcs/func_audiohookinherit.c
Modified:
team/murf/cdr-debug-1.4/ (props changed)
team/murf/cdr-debug-1.4/CHANGES
team/murf/cdr-debug-1.4/README
team/murf/cdr-debug-1.4/apps/app_dial.c
team/murf/cdr-debug-1.4/apps/app_queue.c
team/murf/cdr-debug-1.4/channels/chan_agent.c
team/murf/cdr-debug-1.4/channels/chan_alsa.c
team/murf/cdr-debug-1.4/channels/chan_dahdi.c
team/murf/cdr-debug-1.4/channels/chan_iax2.c
team/murf/cdr-debug-1.4/channels/chan_local.c
team/murf/cdr-debug-1.4/channels/chan_misdn.c
team/murf/cdr-debug-1.4/channels/chan_sip.c
team/murf/cdr-debug-1.4/channels/misdn_config.c
team/murf/cdr-debug-1.4/configs/indications.conf.sample
team/murf/cdr-debug-1.4/include/asterisk/audiohook.h
team/murf/cdr-debug-1.4/include/asterisk/pbx.h
team/murf/cdr-debug-1.4/include/asterisk/strings.h
team/murf/cdr-debug-1.4/main/asterisk.c
team/murf/cdr-debug-1.4/main/audiohook.c
team/murf/cdr-debug-1.4/main/channel.c
team/murf/cdr-debug-1.4/main/db.c
team/murf/cdr-debug-1.4/main/file.c
team/murf/cdr-debug-1.4/main/indications.c
team/murf/cdr-debug-1.4/main/utils.c
team/murf/cdr-debug-1.4/res/res_agi.c
team/murf/cdr-debug-1.4/res/res_features.c
team/murf/cdr-debug-1.4/res/res_musiconhold.c
team/murf/cdr-debug-1.4/sounds/Makefile
Propchange: team/murf/cdr-debug-1.4/
------------------------------------------------------------------------------
automerge = heckyeah
Propchange: team/murf/cdr-debug-1.4/
------------------------------------------------------------------------------
Binary property 'branch-1.2-merged' - no diff available.
Propchange: team/murf/cdr-debug-1.4/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Mon Jan 12 15:16:01 2009
@@ -1,1 +1,1 @@
-/branches/1.4:1-166019
+/branches/1.4:1-168507
Modified: team/murf/cdr-debug-1.4/CHANGES
URL: http://svn.digium.com/svn-view/asterisk/team/murf/cdr-debug-1.4/CHANGES?view=diff&rev=168512&r1=168511&r2=168512
==============================================================================
--- team/murf/cdr-debug-1.4/CHANGES (original)
+++ team/murf/cdr-debug-1.4/CHANGES Mon Jan 12 15:16:01 2009
@@ -120,6 +120,7 @@
19. SQL_ESC()
20. STAT()
21. STRPTIME()
+ 22. AUDIOHOOK_INHERIT()
* Apps that have changes to their interface:
1. Authenticate() -- optional maxdigits argument added.
2. ChanSpy() -- new options:
Modified: team/murf/cdr-debug-1.4/README
URL: http://svn.digium.com/svn-view/asterisk/team/murf/cdr-debug-1.4/README?view=diff&rev=168512&r1=168511&r2=168512
==============================================================================
--- team/murf/cdr-debug-1.4/README (original)
+++ team/murf/cdr-debug-1.4/README Mon Jan 12 15:16:01 2009
@@ -2,7 +2,7 @@
by Mark Spencer <markster at digium.com>
and the Asterisk.org developer community
-Copyright (C) 2001-2008 Digium, Inc.
+Copyright (C) 2001-2009 Digium, Inc.
and other copyright holders.
================================================================
@@ -11,7 +11,7 @@
the security information file (doc/security.txt) before you attempt
to configure and run an Asterisk server.
-* WHAT IS ASTERISK ?
+* WHAT IS ASTERISK?
Asterisk is an Open Source PBX and telephony toolkit. It is, in a
sense, middleware between Internet and telephony channels on the bottom,
and Internet and telephony applications at the top. For more information
Modified: team/murf/cdr-debug-1.4/apps/app_dial.c
URL: http://svn.digium.com/svn-view/asterisk/team/murf/cdr-debug-1.4/apps/app_dial.c?view=diff&rev=168512&r1=168511&r2=168512
==============================================================================
--- team/murf/cdr-debug-1.4/apps/app_dial.c (original)
+++ team/murf/cdr-debug-1.4/apps/app_dial.c Mon Jan 12 15:16:01 2009
@@ -1842,39 +1842,29 @@
ast_log(LOG_NOTICE,"==== 4 =====\n");
- if (res != AST_PBX_NO_HANGUP_PEER && res != AST_PBX_NO_HANGUP_PEER_PARKED) {
- if (res != AST_PBX_KEEPALIVE && !chan->_softhangup)
- ast_log(LOG_NOTICE,"==== 5 =====\n");
- chan->hangupcause = peer->hangupcause;
- ast_hangup(peer);
- }
+ if (!chan->_softhangup)
+ chan->hangupcause = peer->hangupcause;
+ ast_hangup(peer);
}
out:
- /* cleaning up chan is not a good idea here if AST_PBX_KEEPALIVE
- is returned; chan will get the love it needs from another
- thread */
- if (res != AST_PBX_KEEPALIVE) {
- if (moh) {
- moh = 0;
- ast_moh_stop(chan);
- } else if (sentringing) {
- sentringing = 0;
- ast_indicate(chan, -1);
- }
- ast_rtp_early_bridge(chan, NULL);
- hanguptree(outgoing, NULL);
- pbx_builtin_setvar_helper(chan, "DIALSTATUS", status);
- if (option_debug)
- ast_log(LOG_DEBUG, "Exiting with DIALSTATUS=%s.\n", status);
-
- if ((ast_test_flag(peerflags, OPT_GO_ON)) && (!chan->_softhangup) && (res != AST_PBX_KEEPALIVE)) {
- ast_log(LOG_NOTICE,"==== 8 =====\n");
- if (timelimit)
- chan->whentohangup = 0;
- res = 0;
- }
- }
-
+ if (moh) {
+ moh = 0;
+ ast_moh_stop(chan);
+ } else if (sentringing) {
+ sentringing = 0;
+ ast_indicate(chan, -1);
+ }
+ ast_rtp_early_bridge(chan, NULL);
+ hanguptree(outgoing, NULL);
+ pbx_builtin_setvar_helper(chan, "DIALSTATUS", status);
+ if (option_debug)
+ ast_log(LOG_DEBUG, "Exiting with DIALSTATUS=%s.\n", status);
+
+ if (ast_test_flag(peerflags, OPT_GO_ON) && !chan->_softhangup) {
+ if (calldurationlimit)
+ chan->whentohangup = 0;
+ res = 0;
+ }
done:
ast_module_user_remove(u);
return res;
Modified: team/murf/cdr-debug-1.4/apps/app_queue.c
URL: http://svn.digium.com/svn-view/asterisk/team/murf/cdr-debug-1.4/apps/app_queue.c?view=diff&rev=168512&r1=168511&r2=168512
==============================================================================
--- team/murf/cdr-debug-1.4/apps/app_queue.c (original)
+++ team/murf/cdr-debug-1.4/apps/app_queue.c Mon Jan 12 15:16:01 2009
@@ -3155,7 +3155,7 @@
transfer_ds = setup_transfer_datastore(qe, member, callstart, callcompletedinsl);
bridge = ast_bridge_call(qe->chan,peer, &bridge_config);
- if (bridge != AST_PBX_KEEPALIVE && !attended_transfer_occurred(qe->chan)) {
+ if (!attended_transfer_occurred(qe->chan)) {
struct ast_datastore *tds;
if (strcasecmp(oldcontext, qe->chan->context) || strcasecmp(oldexten, qe->chan->exten)) {
ast_queue_log(queuename, qe->chan->uniqueid, member->membername, "TRANSFER", "%s|%s|%ld|%ld",
@@ -3164,7 +3164,7 @@
} else if (qe->chan->_softhangup) {
ast_queue_log(queuename, qe->chan->uniqueid, member->membername, "COMPLETECALLER", "%ld|%ld|%d",
(long) (callstart - qe->start), (long) (time(NULL) - callstart), qe->opos);
- if (bridge != AST_PBX_NO_HANGUP_PEER && bridge != AST_PBX_NO_HANGUP_PEER_PARKED && qe->parent->eventwhencalled)
+ if (qe->parent->eventwhencalled)
manager_event(EVENT_FLAG_AGENT, "AgentComplete",
"Queue: %s\r\n"
"Uniqueid: %s\r\n"
@@ -3181,7 +3181,7 @@
} else {
ast_queue_log(queuename, qe->chan->uniqueid, member->membername, "COMPLETEAGENT", "%ld|%ld|%d",
(long) (callstart - qe->start), (long) (time(NULL) - callstart), qe->opos);
- if (bridge != AST_PBX_NO_HANGUP_PEER && bridge != AST_PBX_NO_HANGUP_PEER_PARKED && qe->parent->eventwhencalled)
+ if (qe->parent->eventwhencalled)
manager_event(EVENT_FLAG_AGENT, "AgentComplete",
"Queue: %s\r\n"
"Uniqueid: %s\r\n"
@@ -3206,8 +3206,7 @@
if (transfer_ds) {
ast_channel_datastore_free(transfer_ds);
}
- if (bridge != AST_PBX_NO_HANGUP_PEER && bridge != AST_PBX_NO_HANGUP_PEER_PARKED)
- ast_hangup(peer);
+ ast_hangup(peer);
res = bridge ? bridge : 1;
ao2_ref(member, -1);
}
@@ -4079,7 +4078,7 @@
}
/* Don't allow return code > 0 */
- if (res >= 0 && res != AST_PBX_KEEPALIVE) {
+ if (res >= 0) {
res = 0;
if (ringing) {
ast_indicate(chan, -1);
Modified: team/murf/cdr-debug-1.4/channels/chan_agent.c
URL: http://svn.digium.com/svn-view/asterisk/team/murf/cdr-debug-1.4/channels/chan_agent.c?view=diff&rev=168512&r1=168511&r2=168512
==============================================================================
--- team/murf/cdr-debug-1.4/channels/chan_agent.c (original)
+++ team/murf/cdr-debug-1.4/channels/chan_agent.c Mon Jan 12 15:16:01 2009
@@ -195,7 +195,8 @@
char name[AST_MAX_AGENT];
int inherited_devicestate; /*!< Does the underlying channel have a devicestate to pass? */
ast_mutex_t app_lock; /**< Synchronization between owning applications */
- volatile pthread_t owning_app; /**< Owning application thread id */
+ int app_lock_flag;
+ ast_cond_t app_complete_cond;
volatile int app_sleep_cond; /**< Sleep condition for the login app */
struct ast_channel *owner; /**< Agent */
char loginchan[80]; /**< channel they logged in from */
@@ -380,7 +381,8 @@
ast_copy_string(p->agent, agt, sizeof(p->agent));
ast_mutex_init(&p->lock);
ast_mutex_init(&p->app_lock);
- p->owning_app = (pthread_t) -1;
+ ast_cond_init(&p->app_complete_cond, NULL);
+ p->app_lock_flag = 0;
p->app_sleep_cond = 1;
p->group = group;
p->pending = pending;
@@ -428,12 +430,14 @@
chan->tech_pvt = NULL;
p->app_sleep_cond = 1;
/* Release ownership of the agent to other threads (presumably running the login app). */
- ast_mutex_unlock(&p->app_lock);
+ p->app_lock_flag = 0;
+ ast_cond_signal(&p->app_complete_cond);
if (chan)
ast_channel_free(chan);
if (p->dead) {
ast_mutex_destroy(&p->lock);
ast_mutex_destroy(&p->app_lock);
+ ast_cond_destroy(&p->app_complete_cond);
free(p);
}
return 0;
@@ -930,6 +934,7 @@
} else if (p->dead) {
ast_mutex_destroy(&p->lock);
ast_mutex_destroy(&p->app_lock);
+ ast_cond_destroy(&p->app_complete_cond);
free(p);
} else {
if (p->chan) {
@@ -940,8 +945,10 @@
ast_mutex_unlock(&p->lock);
}
/* Release ownership of the agent to other threads (presumably running the login app). */
- if (ast_strlen_zero(p->loginchan))
- ast_mutex_unlock(&p->app_lock);
+ if (ast_strlen_zero(p->loginchan)) {
+ p->app_lock_flag = 0;
+ ast_cond_signal(&p->app_complete_cond);
+ }
}
return 0;
}
@@ -1029,6 +1036,7 @@
static struct ast_channel *agent_new(struct agent_pvt *p, int state)
{
struct ast_channel *tmp;
+ int alreadylocked;
#if 0
if (!p->chan) {
ast_log(LOG_WARNING, "No channel? :(\n");
@@ -1079,11 +1087,15 @@
* implemented in the kernel for this.
*/
p->app_sleep_cond = 0;
- if(ast_strlen_zero(p->loginchan) && ast_mutex_trylock(&p->app_lock)) {
+
+ alreadylocked = p->app_lock_flag;
+ p->app_lock_flag = 1;
+
+ if(ast_strlen_zero(p->loginchan) && alreadylocked) {
if (p->chan) {
ast_queue_frame(p->chan, &ast_null_frame);
ast_mutex_unlock(&p->lock); /* For other thread to read the condition. */
- ast_mutex_lock(&p->app_lock);
+ p->app_lock_flag = 1;
ast_mutex_lock(&p->lock);
} else {
ast_log(LOG_WARNING, "Agent disconnected while we were connecting the call\n");
@@ -1092,7 +1104,8 @@
p->app_sleep_cond = 1;
ast_channel_free( tmp );
ast_mutex_unlock(&p->lock); /* For other thread to read the condition. */
- ast_mutex_unlock(&p->app_lock);
+ p->app_lock_flag = 0;
+ ast_cond_signal(&p->app_complete_cond);
return NULL;
}
} else if (!ast_strlen_zero(p->loginchan)) {
@@ -1110,14 +1123,6 @@
}
if (p->chan)
ast_indicate(p->chan, AST_CONTROL_UNHOLD);
- p->owning_app = pthread_self();
- /* After the above step, there should not be any blockers. */
- if (p->chan) {
- if (ast_test_flag(p->chan, AST_FLAG_BLOCKING)) {
- ast_log( LOG_ERROR, "A blocker exists after agent channel ownership acquired\n" );
- ast_assert(ast_test_flag(p->chan, AST_FLAG_BLOCKING) == 0);
- }
- }
return tmp;
}
@@ -1262,6 +1267,7 @@
if (!p->chan) {
ast_mutex_destroy(&p->lock);
ast_mutex_destroy(&p->app_lock);
+ ast_cond_destroy(&p->app_complete_cond);
free(p);
} else {
/* Cause them to hang up */
@@ -2255,15 +2261,17 @@
ast_mutex_unlock(&p->lock);
AST_LIST_UNLOCK(&agents);
/* Synchronize channel ownership between call to agent and itself. */
- ast_mutex_lock( &p->app_lock );
+ ast_mutex_lock(&p->app_lock);
+ if (p->app_lock_flag == 1) {
+ ast_cond_wait(&p->app_complete_cond, &p->app_lock);
+ }
+ ast_mutex_unlock(&p->app_lock);
ast_mutex_lock(&p->lock);
- p->owning_app = pthread_self();
ast_mutex_unlock(&p->lock);
if (p->ackcall > 1)
res = agent_ack_sleep(p);
else
res = ast_safe_sleep_conditional( chan, 1000, agent_cont_sleep, p );
- ast_mutex_unlock( &p->app_lock );
if ((p->ackcall > 1) && (res == 1)) {
AST_LIST_LOCK(&agents);
ast_mutex_lock(&p->lock);
@@ -2299,6 +2307,7 @@
if (p->dead && !p->owner) {
ast_mutex_destroy(&p->lock);
ast_mutex_destroy(&p->app_lock);
+ ast_cond_destroy(&p->app_complete_cond);
free(p);
}
}
Modified: team/murf/cdr-debug-1.4/channels/chan_alsa.c
URL: http://svn.digium.com/svn-view/asterisk/team/murf/cdr-debug-1.4/channels/chan_alsa.c?view=diff&rev=168512&r1=168511&r2=168512
==============================================================================
--- team/murf/cdr-debug-1.4/channels/chan_alsa.c (original)
+++ team/murf/cdr-debug-1.4/channels/chan_alsa.c Mon Jan 12 15:16:01 2009
@@ -266,7 +266,9 @@
state = snd_pcm_state(alsa.ocard);
if (state == SND_PCM_STATE_XRUN)
snd_pcm_prepare(alsa.ocard);
- res = snd_pcm_writei(alsa.ocard, frame, res);
+ while ((res = snd_pcm_writei(alsa.ocard, frame, res)) == -EAGAIN) {
+ usleep(1);
+ }
if (res > 0)
return 0;
return 0;
@@ -629,13 +631,17 @@
state = snd_pcm_state(alsa.ocard);
if (state == SND_PCM_STATE_XRUN)
snd_pcm_prepare(alsa.ocard);
- res = snd_pcm_writei(alsa.ocard, sizbuf, len / 2);
+ while ((res = snd_pcm_writei(alsa.ocard, sizbuf, len / 2)) == -EAGAIN) {
+ usleep(1);
+ }
if (res == -EPIPE) {
#if DEBUG
ast_log(LOG_DEBUG, "XRUN write\n");
#endif
snd_pcm_prepare(alsa.ocard);
- res = snd_pcm_writei(alsa.ocard, sizbuf, len / 2);
+ while ((res = snd_pcm_writei(alsa.ocard, sizbuf, len / 2)) == -EAGAIN) {
+ usleep(1);
+ }
if (res != len / 2) {
ast_log(LOG_ERROR, "Write error: %s\n", snd_strerror(res));
res = -1;
Modified: team/murf/cdr-debug-1.4/channels/chan_dahdi.c
URL: http://svn.digium.com/svn-view/asterisk/team/murf/cdr-debug-1.4/channels/chan_dahdi.c?view=diff&rev=168512&r1=168511&r2=168512
==============================================================================
--- team/murf/cdr-debug-1.4/channels/chan_dahdi.c (original)
+++ team/murf/cdr-debug-1.4/channels/chan_dahdi.c Mon Jan 12 15:16:01 2009
@@ -3727,15 +3727,26 @@
if (strcmp(ast->exten, "fax")) {
const char *target_context = S_OR(ast->macrocontext, ast->context);
+ /* We need to unlock 'ast' here because ast_exists_extension has the
+ * potential to start autoservice on the channel. Such action is prone
+ * to deadlock.
+ */
+ ast_mutex_unlock(&p->lock);
+ ast_channel_unlock(ast);
if (ast_exists_extension(ast, target_context, "fax", 1, ast->cid.cid_num)) {
+ ast_channel_lock(ast);
+ ast_mutex_lock(&p->lock);
if (option_verbose > 2)
ast_verbose(VERBOSE_PREFIX_3 "Redirecting %s to fax extension\n", ast->name);
/* Save the DID/DNIS when we transfer the fax call to a "fax" extension */
pbx_builtin_setvar_helper(ast, "FAXEXTEN", ast->exten);
if (ast_async_goto(ast, target_context, "fax", 1))
ast_log(LOG_WARNING, "Failed to async goto '%s' into fax of '%s'\n", ast->name, target_context);
- } else
+ } else {
+ ast_channel_lock(ast);
+ ast_mutex_lock(&p->lock);
ast_log(LOG_NOTICE, "Fax detected, but no fax extension\n");
+ }
} else if (option_debug)
ast_log(LOG_DEBUG, "Already in a fax extension, not redirecting\n");
} else if (option_debug)
Modified: team/murf/cdr-debug-1.4/channels/chan_iax2.c
URL: http://svn.digium.com/svn-view/asterisk/team/murf/cdr-debug-1.4/channels/chan_iax2.c?view=diff&rev=168512&r1=168511&r2=168512
==============================================================================
--- team/murf/cdr-debug-1.4/channels/chan_iax2.c (original)
+++ team/murf/cdr-debug-1.4/channels/chan_iax2.c Mon Jan 12 15:16:01 2009
@@ -155,6 +155,7 @@
static int authdebug = 1;
static int autokill = 0;
static int iaxcompat = 0;
+static int last_authmethod = 0;
static int iaxdefaultdpcache=10 * 60; /* Cache dialplan entries for 10 minutes by default */
@@ -6376,23 +6377,34 @@
char challenge[10];
const char *peer_name;
int res = -1;
+ int sentauthmethod;
peer_name = ast_strdupa(iaxs[callno]->peer);
/* SLD: third call to find_peer in registration */
ast_mutex_unlock(&iaxsl[callno]);
- p = find_peer(peer_name, 1);
+ if ((p = find_peer(peer_name, 1))) {
+ last_authmethod = p->authmethods;
+ }
+
ast_mutex_lock(&iaxsl[callno]);
if (!iaxs[callno])
goto return_unref;
- if (!p) {
+ if (!p && !delayreject) {
ast_log(LOG_WARNING, "No such peer '%s'\n", peer_name);
goto return_unref;
}
memset(&ied, 0, sizeof(ied));
- iax_ie_append_short(&ied, IAX_IE_AUTHMETHODS, p->authmethods);
- if (p->authmethods & (IAX_AUTH_RSA | IAX_AUTH_MD5)) {
+ /* The selection of which delayed reject is sent may leak information,
+ * if it sets a static response. For example, if a host is known to only
+ * use MD5 authentication, then an RSA response would indicate that the
+ * peer does not exist, and vice-versa.
+ * Therefore, we use whatever the last peer used (which may vary over the
+ * course of a server, which should leak minimal information). */
+ sentauthmethod = p ? p->authmethods : last_authmethod ? last_authmethod : (IAX_AUTH_MD5 | IAX_AUTH_PLAINTEXT);
+ iax_ie_append_short(&ied, IAX_IE_AUTHMETHODS, sentauthmethod);
+ if (sentauthmethod & (IAX_AUTH_RSA | IAX_AUTH_MD5)) {
/* Build the challenge */
snprintf(challenge, sizeof(challenge), "%d", (int)ast_random());
ast_string_field_set(iaxs[callno], challenge, challenge);
@@ -11231,6 +11243,7 @@
iax_set_error(iax_error_output);
jb_setoutput(jb_error_output, jb_warning_output, NULL);
+#ifdef HAVE_DAHDI
#ifdef DAHDI_TIMERACK
timingfd = open(DAHDI_FILE_TIMER, O_RDWR);
if (timingfd < 0)
@@ -11238,6 +11251,7 @@
timingfd = open(DAHDI_FILE_PSEUDO, O_RDWR);
if (timingfd < 0)
ast_log(LOG_WARNING, "Unable to open IAX timing interface: %s\n", strerror(errno));
+#endif
memset(iaxs, 0, sizeof(iaxs));
Modified: team/murf/cdr-debug-1.4/channels/chan_local.c
URL: http://svn.digium.com/svn-view/asterisk/team/murf/cdr-debug-1.4/channels/chan_local.c?view=diff&rev=168512&r1=168511&r2=168512
==============================================================================
--- team/murf/cdr-debug-1.4/channels/chan_local.c (original)
+++ team/murf/cdr-debug-1.4/channels/chan_local.c Mon Jan 12 15:16:01 2009
@@ -490,6 +490,7 @@
p->chan->cid.cid_tns = p->owner->cid.cid_tns;
ast_string_field_set(p->chan, language, p->owner->language);
ast_string_field_set(p->chan, accountcode, p->owner->accountcode);
+ ast_string_field_set(p->chan, musicclass, p->owner->musicclass);
ast_cdr_update(p->chan);
p->chan->cdrflags = p->owner->cdrflags;
Modified: team/murf/cdr-debug-1.4/channels/chan_misdn.c
URL: http://svn.digium.com/svn-view/asterisk/team/murf/cdr-debug-1.4/channels/chan_misdn.c?view=diff&rev=168512&r1=168511&r2=168512
==============================================================================
--- team/murf/cdr-debug-1.4/channels/chan_misdn.c (original)
+++ team/murf/cdr-debug-1.4/channels/chan_misdn.c Mon Jan 12 15:16:01 2009
@@ -147,83 +147,272 @@
#define ORG_MISDN 2
struct hold_info {
+ /*!
+ * \brief Logical port the channel call record is HOLDED on
+ * because the B channel is no longer associated.
+ */
int port;
+
+ /*!
+ * \brief Original B channel number the HOLDED call was using.
+ * \note Used only for debug display messages.
+ */
int channel;
};
+/*!
+ * \brief Channel call record structure
+ */
struct chan_list {
-
+ /*!
+ * \brief The "allowed_bearers" string read in from /etc/asterisk/misdn.conf
+ */
char allowed_bearers[BUFFERSIZE + 1];
+ /*!
+ * \brief State of the channel
+ */
enum misdn_chan_state state;
+
+ /*!
+ * \brief TRUE if a hangup needs to be queued
+ * \note This is a debug flag only used to catch calls to hangup_chan() that are already hungup.
+ */
int need_queue_hangup;
+
+ /*!
+ * \brief TRUE if a channel can be hung up by calling asterisk directly when done.
+ */
int need_hangup;
+
+ /*!
+ * \brief TRUE if we could send an AST_CONTROL_BUSY if needed.
+ */
int need_busy;
+ /*!
+ * \brief Who originally created this channel. ORG_AST or ORG_MISDN
+ */
int originator;
+
+ /*!
+ * \brief TRUE of we are not to respond immediately to a SETUP message. Check the dialplan first.
+ * \note The "noautorespond_on_setup" boolean read in from /etc/asterisk/misdn.conf
+ */
int noautorespond_on_setup;
- int norxtone;
+ int norxtone; /* Boolean assigned values but the value is not used. */
+
+ /*!
+ * \brief TRUE if we are not to generate tones (Playtones)
+ */
int notxtone;
+ /*!
+ * \brief TRUE if echo canceller is enabled. Value is toggled.
+ */
int toggle_ec;
+ /*!
+ * \brief TRUE if you want to send Tone Indications to an incoming
+ * ISDN channel on a TE Port.
+ * \note The "incoming_early_audio" boolean read in from /etc/asterisk/misdn.conf
+ */
int incoming_early_audio;
+ /*!
+ * \brief TRUE if DTMF digits are to be passed inband only.
+ * \note It is settable by the misdn_set_opt() application.
+ */
int ignore_dtmf;
+ /*!
+ * \brief Pipe file descriptor handles array.
+ * Read from pipe[0], write to pipe[1]
+ */
int pipe[2];
+
+ /*!
+ * \brief Read buffer for inbound audio from pipe[0]
+ */
char ast_rd_buf[4096];
+
+ /*!
+ * \brief Inbound audio frame returned by misdn_read().
+ */
struct ast_frame frame;
- int faxdetect; /*!< 0:no 1:yes 2:yes+nojump */
+ /*!
+ * \brief Fax detection option. (0:no 1:yes 2:yes+nojump)
+ * \note The "faxdetect" option string read in from /etc/asterisk/misdn.conf
+ * \note It is settable by the misdn_set_opt() application.
+ */
+ int faxdetect;
+
+ /*!
+ * \brief Number of seconds to detect a Fax machine when detection enabled.
+ * \note 0 disables the timeout.
+ * \note The "faxdetect_timeout" value read in from /etc/asterisk/misdn.conf
+ */
int faxdetect_timeout;
+
+ /*!
+ * \brief Starting time of fax detection with timeout when nonzero.
+ */
struct timeval faxdetect_tv;
+
+ /*!
+ * \brief TRUE if a fax has been detected.
+ */
int faxhandled;
+ /*!
+ * \brief TRUE if we will use the Asterisk DSP to detect DTMF/Fax
+ * \note The "astdtmf" boolean read in from /etc/asterisk/misdn.conf
+ */
int ast_dsp;
+ /*!
+ * \brief Jitterbuffer length
+ * \note The "jitterbuffer" value read in from /etc/asterisk/misdn.conf
+ */
int jb_len;
+
+ /*!
+ * \brief Jitterbuffer upper threshold
+ * \note The "jitterbuffer_upper_threshold" value read in from /etc/asterisk/misdn.conf
+ */
int jb_upper_threshold;
+
+ /*!
+ * \brief Allocated jitterbuffer controller
+ * \note misdn_jb_init() creates the jitterbuffer.
+ * \note Must use misdn_jb_destroy() to clean up.
+ */
struct misdn_jb *jb;
+ /*!
+ * \brief Allocated DSP controller
+ * \note ast_dsp_new() creates the DSP controller.
+ * \note Must use ast_dsp_free() to clean up.
+ */
struct ast_dsp *dsp;
+
+ /*!
+ * \brief Allocated audio frame sample translator
+ * \note ast_translator_build_path() creates the translator path.
+ * \note Must use ast_translator_free_path() to clean up.
+ */
struct ast_trans_pvt *trans;
+ /*!
+ * \brief Associated Asterisk channel structure.
+ */
struct ast_channel * ast;
- int dummy;
+ //int dummy; /* Not used */
+ /*!
[... 2430 lines stripped ...]
More information about the asterisk-commits
mailing list