[asterisk-commits] twilson: branch group/manager_http_auth r166770 - in /team/group/manager_http...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Dec 24 13:40:07 CST 2008
Author: twilson
Date: Wed Dec 24 13:40:07 2008
New Revision: 166770
URL: http://svn.digium.com/view/asterisk?view=rev&rev=166770
Log:
Merged revisions 166258,166263,166267-166268,166273,166282,166317,166342,166377,166382,166436,166470,166533,166569,166601,166625,166665,166696,166731 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
................
r166258 | russell | 2008-12-22 08:16:54 -0600 (Mon, 22 Dec 2008) | 26 lines
Remove AST_PBX_KEEPALIVE usage from res_agi.
This patch removes the usage of AST_PBX_KEEPALIVE from res_agi. The only usage
was for the AGI command, "asyncagi break". This patch removes this feature.
Normally, a feature would not be removed like this. However, this code is
broken and usage of it will result in a memory leak.
Usage of this feature will make the AGI code return a result of
AST_PBX_KEEPALIVE. The PBX handler assumes that another thread has assumed
ownership of the channel. The channel thread will exit without destroying the
channel. Unfortunately, _no_ thread has ownership of the channel at this
point. There are a couple of serious problems here:
1) The only way to recover the caller is to issue a channel redirect. This
will work, but this will be done with a masquerade, and the old ast_channel
structure will be lost.
2) Until the channel redirect happens, there is no code servicing the channel.
That means nothing is reading audio or handling events coming from the
channel. This is very bad.
The recommended way to get this same "break" functionality is to issue the
redirect while the channel is still being handled by the AGI code. That way,
there will be no memory leak, and there will be no period of time that the
channel is not being serviced.
................
r166263 | russell | 2008-12-22 08:52:35 -0600 (Mon, 22 Dec 2008) | 14 lines
Blocked revisions 166262 via svnmerge
........
r166262 | russell | 2008-12-22 08:45:27 -0600 (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/
........
................
r166267 | mmichelson | 2008-12-22 10:07:59 -0600 (Mon, 22 Dec 2008) | 17 lines
Fix a file playback crash and explicitly initialize values in func_timeout.c
A crash was brought up on the bugtracker. The first run through valgrind
was full of legitimate complaints of uninitialized values in func_timeout when
setting a response timeout. These were fixed but the crash persisted.
A second run through showed the real problem. The reference counting used
for filestreams was incorrect because there were some missing increments
when a frame was read from a format module.
(closes issue #14118)
Reported by: blitzrage
Patches:
14118v2.patch uploaded by putnopvut (license 60)
Tested by: blitzrage
................
r166268 | file | 2008-12-22 10:08:13 -0600 (Mon, 22 Dec 2008) | 7 lines
Record the previous port in the temporary address structure so that the comparison does not treat the host as having changed even if it did not. This would have been uninitialized before and would have led to a baddddd port.
(closes issue #13628)
Reported by: pananix
Patches:
bug13628.patch uploaded by jpeeler (license 325)
Tested by: file, blitzrage
................
r166273 | russell | 2008-12-22 10:10:40 -0600 (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/
................
r166282 | russell | 2008-12-22 11:09:36 -0600 (Mon, 22 Dec 2008) | 12 lines
Introduce ast_careful_fwrite() and use in AMI to prevent partial writes.
This patch introduces a function to do careful writes on a file stream which
will handle timeouts and partial writes. It is currently used in AMI to
address the issue that has been reported. However, there are probably a few
other places where this could be used.
(closes issue #13546)
Reported by: srt
Tested by: russell
http://reviewboard.digium.com/r/104/
................
r166317 | russell | 2008-12-22 11:29:10 -0600 (Mon, 22 Dec 2008) | 10 lines
Merged revisions 166297 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r166297 | russell | 2008-12-22 11:22:56 -0600 (Mon, 22 Dec 2008) | 2 lines
Fix up timeout handling in ast_carefulwrite().
........
................
r166342 | russell | 2008-12-22 11:44:23 -0600 (Mon, 22 Dec 2008) | 2 lines
Remove some error messages. This is the default handler that is valid to use.
................
r166377 | russell | 2008-12-22 14:26:48 -0600 (Mon, 22 Dec 2008) | 2 lines
Fix a bad typo.
................
r166382 | mmichelson | 2008-12-22 15:08:03 -0600 (Mon, 22 Dec 2008) | 44 lines
Merged revisions 166380 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r166380 | mmichelson | 2008-12-22 14:56:29 -0600 (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/
........
................
r166436 | russell | 2008-12-22 15:45:28 -0600 (Mon, 22 Dec 2008) | 2 lines
Cosmetic change - don't mix struct initializer styles.
................
r166470 | mmichelson | 2008-12-22 17:25:34 -0600 (Mon, 22 Dec 2008) | 11 lines
Always use the value of the AGISIGHUP when running an AGI.
Prior to this patch, the value of AGISIGUP was not always
honored when set on a channel.
(closes issue #13711)
Reported by: fmueller
Patches:
13711.patch uploaded by putnopvut (license 60)
................
r166533 | tilghman | 2008-12-22 22:32:15 -0600 (Mon, 22 Dec 2008) | 11 lines
Merged revisions 166509 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r166509 | tilghman | 2008-12-22 22:05:25 -0600 (Mon, 22 Dec 2008) | 4 lines
Use the integer form of condition for integer comparisons.
(closes issue #14127)
Reported by: andrew
........
................
r166569 | mmichelson | 2008-12-23 09:17:54 -0600 (Tue, 23 Dec 2008) | 20 lines
Merged revisions 166568 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r166568 | mmichelson | 2008-12-23 09:16:26 -0600 (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
........
................
r166601 | tilghman | 2008-12-23 09:41:42 -0600 (Tue, 23 Dec 2008) | 9 lines
Blocked revisions 166592 via svnmerge
........
r166592 | tilghman | 2008-12-23 09:35:38 -0600 (Tue, 23 Dec 2008) | 3 lines
Compile, even if both DAHDI and Zaptel are not installed.
(Closes issue #14120)
........
................
r166625 | russell | 2008-12-23 10:04:54 -0600 (Tue, 23 Dec 2008) | 1 line
Fix spelling error.
................
r166665 | murf | 2008-12-23 12:13:49 -0600 (Tue, 23 Dec 2008) | 153 lines
Merged revisions 166093 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
In order to merge this 1.4 patch into trunk,
I had to resolve some conflicts and wait for
Russell to make some changes to res_agi.
I re-ran all the tests; 39 calls in all, and
made fairly careful notes and comparisons: I
don't want this to blow up some aspect of
asterisk; I completely removed the KEEPALIVE
from the pbx.h decls. The first 3 scenarios
involving feature park; feature xfer to 700;
hookflash park to Park() app call all behave
the same, don't appear to leave hung channels,
and no crashes.
........
r166093 | murf | 2008-12-19 15:30:32 -0700 (Fri, 19 Dec 2008) | 131 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/
........
................
r166696 | tilghman | 2008-12-23 14:47:08 -0600 (Tue, 23 Dec 2008) | 7 lines
Allow semicolons and extended characters in user-specified SIP headers.
(closes issue #14110)
Reported by: gork
Patches:
20081222__bug14110__2.diff.txt uploaded by Corydon76 (license 14)
Tested by: gork, putnopvut
................
r166731 | twilson | 2008-12-24 09:10:42 -0600 (Wed, 24 Dec 2008) | 10 lines
There is no section 22.2.2 in rfc 3261. I believe 26.2.2 is what was meant:
Note that in the SIPS URI scheme, transport is independent of TLS,
and thus "sips:alice at atlanta.com;transport=tcp" and
"sips:alice at atlanta.com;transport=sctp" are both valid (although
note that UDP is not a valid transport for SIPS). The use of
"transport=tls" has consequently been deprecated, partly because
it was specific to a single hop of the request. This is a change
since RFC 2543.
................
Modified:
team/group/manager_http_auth/ (props changed)
team/group/manager_http_auth/CHANGES
team/group/manager_http_auth/apps/app_dial.c
team/group/manager_http_auth/apps/app_macro.c
team/group/manager_http_auth/apps/app_queue.c
team/group/manager_http_auth/channels/chan_dahdi.c
team/group/manager_http_auth/channels/chan_sip.c
team/group/manager_http_auth/funcs/func_timeout.c
team/group/manager_http_auth/include/asterisk/features.h
team/group/manager_http_auth/include/asterisk/pbx.h
team/group/manager_http_auth/include/asterisk/utils.h
team/group/manager_http_auth/main/astobj2.c
team/group/manager_http_auth/main/channel.c
team/group/manager_http_auth/main/dnsmgr.c
team/group/manager_http_auth/main/features.c
team/group/manager_http_auth/main/file.c
team/group/manager_http_auth/main/manager.c
team/group/manager_http_auth/main/pbx.c
team/group/manager_http_auth/main/utils.c
team/group/manager_http_auth/res/res_agi.c
team/group/manager_http_auth/res/res_musiconhold.c
Propchange: team/group/manager_http_auth/
------------------------------------------------------------------------------
automerge = *
Propchange: team/group/manager_http_auth/
------------------------------------------------------------------------------
Binary property 'branch-1.4-blocked' - no diff available.
Propchange: team/group/manager_http_auth/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.
Propchange: team/group/manager_http_auth/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Wed Dec 24 13:40:07 2008
@@ -1,1 +1,1 @@
-/trunk:1-166227
+/trunk:1-166769
Modified: team/group/manager_http_auth/CHANGES
URL: http://svn.digium.com/view/asterisk/team/group/manager_http_auth/CHANGES?view=diff&rev=166770&r1=166769&r2=166770
==============================================================================
--- team/group/manager_http_auth/CHANGES (original)
+++ team/group/manager_http_auth/CHANGES Wed Dec 24 13:40:07 2008
@@ -44,7 +44,7 @@
Skinny Changes
--------------
- * The configuration file now holds seperate sections for devices and lines.
+ * The configuration file now holds separate sections for devices and lines.
Please have a look at configs/skinny.conf.sample and change your skinny.conf
accordingly.
Modified: team/group/manager_http_auth/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/team/group/manager_http_auth/apps/app_dial.c?view=diff&rev=166770&r1=166769&r2=166770
==============================================================================
--- team/group/manager_http_auth/apps/app_dial.c (original)
+++ team/group/manager_http_auth/apps/app_dial.c Wed Dec 24 13:40:07 2008
@@ -2215,14 +2215,9 @@
res = ast_bridge_call(chan, peer, &config);
}
- if (res != AST_PBX_NO_HANGUP_PEER_PARKED && ast_test_flag64(&opts, OPT_PEER_H)) {
- ast_log(LOG_NOTICE, "PEER context: %s; PEER exten: %s; PEER priority: %d\n",
- peer->context, peer->exten, peer->priority);
- }
- if (res != AST_PBX_NO_HANGUP_PEER_PARKED)
- strcpy(peer->context, chan->context);
-
- if (res != AST_PBX_NO_HANGUP_PEER_PARKED && ast_test_flag64(&opts, OPT_PEER_H) && ast_exists_extension(peer, peer->context, "h", 1, peer->cid.cid_num)) {
+ strcpy(peer->context, chan->context);
+
+ if (ast_test_flag64(&opts, OPT_PEER_H) && ast_exists_extension(peer, peer->context, "h", 1, peer->cid.cid_num)) {
int autoloopflag;
int found;
int res9;
@@ -2242,41 +2237,34 @@
}
ast_set2_flag(peer, autoloopflag, AST_FLAG_IN_AUTOLOOP); /* set it back the way it was */
}
- if (res != AST_PBX_NO_HANGUP_PEER && res != AST_PBX_NO_HANGUP_PEER_PARKED) {
- if (!ast_check_hangup(peer) && ast_test_flag64(&opts, OPT_CALLEE_GO_ON) && !ast_strlen_zero(opt_args[OPT_ARG_CALLEE_GO_ON])) {
- replace_macro_delimiter(opt_args[OPT_ARG_CALLEE_GO_ON]);
- ast_parseable_goto(peer, opt_args[OPT_ARG_CALLEE_GO_ON]);
- ast_pbx_start(peer);
- } else {
- if (!ast_check_hangup(chan))
- chan->hangupcause = peer->hangupcause;
- ast_hangup(peer);
- }
+ if (!ast_check_hangup(peer) && ast_test_flag64(&opts, OPT_CALLEE_GO_ON) && !ast_strlen_zero(opt_args[OPT_ARG_CALLEE_GO_ON])) {
+ replace_macro_delimiter(opt_args[OPT_ARG_CALLEE_GO_ON]);
+ ast_parseable_goto(peer, opt_args[OPT_ARG_CALLEE_GO_ON]);
+ ast_pbx_start(peer);
+ } else {
+ if (!ast_check_hangup(chan))
+ 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_channel_early_bridge(chan, NULL);
- hanguptree(outgoing, NULL, 0); /* In this case, there's no answer anywhere */
- pbx_builtin_setvar_helper(chan, "DIALSTATUS", pa.status);
- senddialendevent(chan, pa.status);
- ast_debug(1, "Exiting with DIALSTATUS=%s.\n", pa.status);
-
- if ((ast_test_flag64(peerflags, OPT_GO_ON)) && !ast_check_hangup(chan) && (res != AST_PBX_KEEPALIVE) && (res != AST_PBX_INCOMPLETE)) {
- if (!ast_tvzero(calldurationlimit))
- memset(&chan->whentohangup, 0, sizeof(chan->whentohangup));
- res = 0;
- }
+ if (moh) {
+ moh = 0;
+ ast_moh_stop(chan);
+ } else if (sentringing) {
+ sentringing = 0;
+ ast_indicate(chan, -1);
+ }
+ ast_channel_early_bridge(chan, NULL);
+ hanguptree(outgoing, NULL, 0); /* In this case, there's no answer anywhere */
+ pbx_builtin_setvar_helper(chan, "DIALSTATUS", pa.status);
+ senddialendevent(chan, pa.status);
+ ast_debug(1, "Exiting with DIALSTATUS=%s.\n", pa.status);
+
+ if ((ast_test_flag64(peerflags, OPT_GO_ON)) && !ast_check_hangup(chan) && (res != AST_PBX_INCOMPLETE)) {
+ if (!ast_tvzero(calldurationlimit))
+ memset(&chan->whentohangup, 0, sizeof(chan->whentohangup));
+ res = 0;
}
done:
Modified: team/group/manager_http_auth/apps/app_macro.c
URL: http://svn.digium.com/view/asterisk/team/group/manager_http_auth/apps/app_macro.c?view=diff&rev=166770&r1=166769&r2=166770
==============================================================================
--- team/group/manager_http_auth/apps/app_macro.c (original)
+++ team/group/manager_http_auth/apps/app_macro.c Wed Dec 24 13:40:07 2008
@@ -406,10 +406,6 @@
case MACRO_EXIT_RESULT:
res = 0;
goto out;
- case AST_PBX_KEEPALIVE:
- ast_debug(2, "Spawn extension (%s,%s,%d) exited KEEPALIVE in macro %s on '%s'\n", chan->context, chan->exten, chan->priority, macro, chan->name);
- ast_verb(2, "Spawn extension (%s, %s, %d) exited KEEPALIVE in macro '%s' on '%s'\n", chan->context, chan->exten, chan->priority, macro, chan->name);
- goto out;
default:
ast_debug(2, "Spawn extension (%s,%s,%d) exited non-zero on '%s' in macro '%s'\n", chan->context, chan->exten, chan->priority, chan->name, macro);
ast_verb(2, "Spawn extension (%s, %s, %d) exited non-zero on '%s' in macro '%s'\n", chan->context, chan->exten, chan->priority, chan->name, macro);
Modified: team/group/manager_http_auth/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/group/manager_http_auth/apps/app_queue.c?view=diff&rev=166770&r1=166769&r2=166770
==============================================================================
--- team/group/manager_http_auth/apps/app_queue.c (original)
+++ team/group/manager_http_auth/apps/app_queue.c Wed Dec 24 13:40:07 2008
@@ -4069,24 +4069,21 @@
/* If the queue member did an attended transfer, then the TRANSFER already was logged in the queue_log
* when the masquerade occurred. These other "ending" queue_log messages are unnecessary
*/
- 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|%d",
qe->chan->exten, qe->chan->context, (long) (callstart - qe->start),
(long) (time(NULL) - callstart), qe->opos);
- if (bridge != AST_PBX_NO_HANGUP_PEER && bridge != AST_PBX_NO_HANGUP_PEER_PARKED)
- send_agent_complete(qe, queuename, peer, member, callstart, vars, sizeof(vars), TRANSFER);
+ send_agent_complete(qe, queuename, peer, member, callstart, vars, sizeof(vars), TRANSFER);
} else if (ast_check_hangup(qe->chan)) {
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)
- send_agent_complete(qe, queuename, peer, member, callstart, vars, sizeof(vars), CALLER);
+ send_agent_complete(qe, queuename, peer, member, callstart, vars, sizeof(vars), CALLER);
} 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)
- send_agent_complete(qe, queuename, peer, member, callstart, vars, sizeof(vars), AGENT);
+ send_agent_complete(qe, queuename, peer, member, callstart, vars, sizeof(vars), AGENT);
}
ast_channel_lock(qe->chan);
if ((tds = ast_channel_datastore_find(qe->chan, &queue_transfer_info, NULL))) {
@@ -4099,8 +4096,7 @@
if (transfer_ds) {
ast_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);
}
@@ -5065,7 +5061,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/group/manager_http_auth/channels/chan_dahdi.c
URL: http://svn.digium.com/view/asterisk/team/group/manager_http_auth/channels/chan_dahdi.c?view=diff&rev=166770&r1=166769&r2=166770
==============================================================================
--- team/group/manager_http_auth/channels/chan_dahdi.c (original)
+++ team/group/manager_http_auth/channels/chan_dahdi.c Wed Dec 24 13:40:07 2008
@@ -4425,18 +4425,31 @@
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);
ast_verb(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
+ }
+ } else {
ast_debug(1, "Already in a fax extension, not redirecting\n");
- } else
+ }
+ } else {
ast_debug(1, "Fax already handled\n");
+ }
dahdi_confmute(p, 0);
p->subs[idx].f.frametype = AST_FRAME_NULL;
p->subs[idx].f.subclass = 0;
Modified: team/group/manager_http_auth/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/group/manager_http_auth/channels/chan_sip.c?view=diff&rev=166770&r1=166769&r2=166770
==============================================================================
--- team/group/manager_http_auth/channels/chan_sip.c (original)
+++ team/group/manager_http_auth/channels/chan_sip.c Wed Dec 24 13:40:07 2008
@@ -117,7 +117,7 @@
* specially to communication with other peers (proxies).
* \todo We need to test TCP sessions with SIP proxies and in regards
* to the SIP outbound specs.
- * \todo transport=tls was deprecated in RFC3261 and should not be used at all. See section 22.2.2.
+ * \todo ;transport=tls was deprecated in RFC3261 and should not be used at all. See section 26.2.2.
*
* \todo If the message is smaller than the given Content-length, the request should get a 400 Bad request
* message. If it's a response, it should be dropped. (RFC 3261, Section 18.3)
@@ -23616,7 +23616,7 @@
int no = 0;
int ok = FALSE;
char varbuf[30];
- char *inbuf = data;
+ char *inbuf = data, *subbuf;
if (ast_strlen_zero(inbuf)) {
ast_log(LOG_WARNING, "This application requires the argument: Header\n");
@@ -23630,13 +23630,18 @@
snprintf(varbuf, sizeof(varbuf), "__SIPADDHEADER%.2d", no);
/* Compare without the leading underscores */
- if( (pbx_builtin_getvar_helper(chan, (const char *) varbuf + 2) == (const char *) NULL) )
+ if ((pbx_builtin_getvar_helper(chan, (const char *) varbuf + 2) == (const char *) NULL)) {
ok = TRUE;
+ }
}
if (ok) {
- pbx_builtin_setvar_helper (chan, varbuf, inbuf);
- if (sipdebug)
+ size_t len = strlen(inbuf);
+ subbuf = alloca(len + 1);
+ ast_get_encoded_str(inbuf, subbuf, len + 1);
+ pbx_builtin_setvar_helper(chan, varbuf, subbuf);
+ if (sipdebug) {
ast_debug(1, "SIP Header added \"%s\" as %s\n", inbuf, varbuf);
+ }
} else {
ast_log(LOG_WARNING, "Too many SIP headers added, max 50\n");
}
Modified: team/group/manager_http_auth/funcs/func_timeout.c
URL: http://svn.digium.com/view/asterisk/team/group/manager_http_auth/funcs/func_timeout.c?view=diff&rev=166770&r1=166769&r2=166770
==============================================================================
--- team/group/manager_http_auth/funcs/func_timeout.c (original)
+++ team/group/manager_http_auth/funcs/func_timeout.c Wed Dec 24 13:40:07 2008
@@ -119,11 +119,12 @@
static int timeout_write(struct ast_channel *chan, const char *cmd, char *data,
const char *value)
{
- double x;
- long sec;
+ double x = 0.0;
+ long sec = 0L;
char timestr[64];
struct ast_tm myt;
- struct timeval when;
+ struct timeval when = {0,};
+ int res;
if (!chan)
return -1;
@@ -136,9 +137,13 @@
if (!value)
return -1;
- if ((sscanf(value, "%ld%lf", &sec, &x) == 0) || sec < 0)
+ res = sscanf(value, "%ld%lf", &sec, &x);
+ if (res == 0 || sec < 0) {
when.tv_sec = 0;
- else {
+ when.tv_usec = 0;
+ } else if (res == 1) {
+ when.tv_sec = sec;
+ } else if (res == 2) {
when.tv_sec = sec;
when.tv_usec = x * 1000000;
}
Modified: team/group/manager_http_auth/include/asterisk/features.h
URL: http://svn.digium.com/view/asterisk/team/group/manager_http_auth/include/asterisk/features.h?view=diff&rev=166770&r1=166769&r2=166770
==============================================================================
--- team/group/manager_http_auth/include/asterisk/features.h (original)
+++ team/group/manager_http_auth/include/asterisk/features.h Wed Dec 24 13:40:07 2008
@@ -61,17 +61,12 @@
AST_LIST_ENTRY(ast_call_feature) feature_entry;
};
-
#define AST_FEATURE_RETURN_HANGUP -1
#define AST_FEATURE_RETURN_SUCCESSBREAK 0
-#define AST_FEATURE_RETURN_PBX_KEEPALIVE AST_PBX_KEEPALIVE
-#define AST_FEATURE_RETURN_NO_HANGUP_PEER AST_PBX_NO_HANGUP_PEER
-#define AST_FEATURE_RETURN_NO_HANGUP_PEER_PARKED AST_PBX_NO_HANGUP_PEER_PARKED
#define AST_FEATURE_RETURN_PASSDIGITS 21
#define AST_FEATURE_RETURN_STOREDIGITS 22
#define AST_FEATURE_RETURN_SUCCESS 23
#define AST_FEATURE_RETURN_KEEPTRYING 24
-
/*!
* \brief Park a call and read back parked location
Modified: team/group/manager_http_auth/include/asterisk/pbx.h
URL: http://svn.digium.com/view/asterisk/team/group/manager_http_auth/include/asterisk/pbx.h?view=diff&rev=166770&r1=166769&r2=166770
==============================================================================
--- team/group/manager_http_auth/include/asterisk/pbx.h (original)
+++ team/group/manager_http_auth/include/asterisk/pbx.h Wed Dec 24 13:40:07 2008
@@ -41,10 +41,7 @@
#define AST_PBX_HANGUP -1 /*!< Jump to the 'h' exten */
#define AST_PBX_OK 0 /*!< No errors */
#define AST_PBX_ERROR 1 /*!< Jump to the 'e' exten */
-#define AST_PBX_KEEPALIVE 10 /*!< Destroy the thread, but don't hang up the channel */
-#define AST_PBX_NO_HANGUP_PEER 11 /*!< The peer has been involved in a transfer */
#define AST_PBX_INCOMPLETE 12 /*!< Return to PBX matching, allowing more digits for the extension */
-#define AST_PBX_NO_HANGUP_PEER_PARKED 13 /*!< Don't touch the peer channel - it was sent to the parking lot and might be gone by now */
/*! } */
#define PRIORITY_HINT -1 /*!< Special Priority for a hint */
Modified: team/group/manager_http_auth/include/asterisk/utils.h
URL: http://svn.digium.com/view/asterisk/team/group/manager_http_auth/include/asterisk/utils.h?view=diff&rev=166770&r1=166769&r2=166770
==============================================================================
--- team/group/manager_http_auth/include/asterisk/utils.h (original)
+++ team/group/manager_http_auth/include/asterisk/utils.h Wed Dec 24 13:40:07 2008
@@ -325,6 +325,25 @@
have a need to wait. This way, we get better performance.
*/
int ast_carefulwrite(int fd, char *s, int len, int timeoutms);
+
+/*!
+ * \brief Write data to a file stream with a timeout
+ *
+ * \param f the file stream to write to
+ * \param fd the file description to poll on to know when the file stream can
+ * be written to without blocking.
+ * \param s the buffer to write from
+ * \param len the number of bytes to write
+ * \param timeoutms The maximum amount of time to block in this function trying
+ * to write, specified in milliseconds.
+ *
+ * \note This function assumes that the associated file stream has been set up
+ * as non-blocking.
+ *
+ * \retval 0 success
+ * \retval -1 error
+ */
+int ast_careful_fwrite(FILE *f, int fd, const char *s, size_t len, int timeoutms);
/*
* Thread management support (should be moved to lock.h or a different header)
Modified: team/group/manager_http_auth/main/astobj2.c
URL: http://svn.digium.com/view/asterisk/team/group/manager_http_auth/main/astobj2.c?view=diff&rev=166770&r1=166769&r2=166770
==============================================================================
--- team/group/manager_http_auth/main/astobj2.c (original)
+++ team/group/manager_http_auth/main/astobj2.c Wed Dec 24 13:40:07 2008
@@ -567,7 +567,6 @@
*/
static int cb_true(void *user_data, void *arg, int flags)
{
- ast_log(LOG_ERROR, "Using default callback (cb_true). If you see this, something is strange!\n");
return CMP_MATCH;
}
@@ -576,7 +575,6 @@
*/
static int cb_true_data(void *user_data, void *arg, void *data, int flags)
{
- ast_log(LOG_ERROR, "Using default callback (cb_true_data). If you see this, something is strange!\n");
return CMP_MATCH;
}
Modified: team/group/manager_http_auth/main/channel.c
URL: http://svn.digium.com/view/asterisk/team/group/manager_http_auth/main/channel.c?view=diff&rev=166770&r1=166769&r2=166770
==============================================================================
--- team/group/manager_http_auth/main/channel.c (original)
+++ team/group/manager_http_auth/main/channel.c Wed Dec 24 13:40:07 2008
@@ -1427,7 +1427,7 @@
if (datastore->inheritance > 0) {
datastore2 = ast_datastore_alloc(datastore->info, datastore->uid);
if (datastore2) {
- datastore2->data = datastore->info->duplicate(datastore->data);
+ datastore2->data = datastore->info->duplicate ? datastore->info->duplicate(datastore->data) : NULL;
datastore2->inheritance = datastore->inheritance == DATASTORE_INHERIT_FOREVER ? DATASTORE_INHERIT_FOREVER : datastore->inheritance - 1;
AST_LIST_INSERT_TAIL(&to->datastores, datastore2, entry);
}
@@ -2923,7 +2923,10 @@
/* The channel driver does not support this indication, let's fake
* it by doing our own tone generation if applicable. */
- if (condition < 0) {
+ /*!\note If we compare the enumeration type, which does not have any
+ * negative constants, the compiler may optimize this code away.
+ * Therefore, we must perform an integer comparison here. */
+ if (_condition < 0) {
/* Stop any tones that are playing */
ast_playtones_stop(chan);
return 0;
Modified: team/group/manager_http_auth/main/dnsmgr.c
URL: http://svn.digium.com/view/asterisk/team/group/manager_http_auth/main/dnsmgr.c?view=diff&rev=166770&r1=166769&r2=166770
==============================================================================
--- team/group/manager_http_auth/main/dnsmgr.c (original)
+++ team/group/manager_http_auth/main/dnsmgr.c Wed Dec 24 13:40:07 2008
@@ -164,6 +164,8 @@
if (verbose)
ast_verb(3, "refreshing '%s'\n", entry->name);
+ tmp.sin_port = entry->last.sin_port;
+
if (!ast_get_ip_or_srv(&tmp, entry->name, entry->service) && inaddrcmp(&tmp, &entry->last)) {
ast_copy_string(iabuf, ast_inet_ntoa(entry->last.sin_addr), sizeof(iabuf));
ast_copy_string(iabuf2, ast_inet_ntoa(tmp.sin_addr), sizeof(iabuf2));
Modified: team/group/manager_http_auth/main/features.c
URL: http://svn.digium.com/view/asterisk/team/group/manager_http_auth/main/features.c?view=diff&rev=166770&r1=166769&r2=166770
==============================================================================
--- team/group/manager_http_auth/main/features.c (original)
+++ team/group/manager_http_auth/main/features.c Wed Dec 24 13:40:07 2008
@@ -832,29 +832,22 @@
int res = 0;
set_peers(&parker, &parkee, peer, chan, sense);
- /* Setup the exten/priority to be s/1 since we don't know
- where this call should return */
- strcpy(chan->exten, "s");
- chan->priority = 1;
+ /* we used to set chan's exten and priority to "s" and 1
+ here, but this generates (in some cases) an invalid
+ extension, and if "s" exists, could errantly
+ cause execution of extensions you don't expect. It
+ makes more sense to let nature take its course
+ when chan finishes, and let the pbx do its thing
+ and hang up when the park is over.
+ */
if (chan->_state != AST_STATE_UP)
res = ast_answer(chan);
if (!res)
res = ast_safe_sleep(chan, 1000);
- if (!res) {
- if (sense == FEATURE_SENSE_CHAN) {
- res = ast_park_call(parkee, parker, 0, NULL);
- if (!res) {
- if (sense == FEATURE_SENSE_CHAN) {
- res = AST_PBX_NO_HANGUP_PEER_PARKED;
- } else {
- res = AST_PBX_KEEPALIVE;
- }
- }
- } else if (sense == FEATURE_SENSE_PEER) {
- masq_park_call_announce(parkee, parker, 0, NULL);
- res = 0; /* PBX should hangup zombie channel */
- }
+ if (!res) { /* one direction used to call park_call.... */
+ masq_park_call_announce(parkee, parker, 0, NULL);
+ res = 0; /* PBX should hangup zombie channel */
}
return res;
@@ -1191,12 +1184,12 @@
res = finishup(transferee);
if (res)
res = -1;
- else if (!ast_park_call(transferee, transferer, 0, NULL)) { /* success */
+ else if (!masq_park_call_announce(transferee, transferer, 0, NULL)) { /* success */
/* We return non-zero, but tell the PBX not to hang the channel when
the thread dies -- We have to be careful now though. We are responsible for
hanging up the channel, else it will never be hung up! */
- return (transferer == peer) ? AST_PBX_KEEPALIVE : AST_PBX_NO_HANGUP_PEER_PARKED;
+ return 0;
} else {
ast_log(LOG_WARNING, "Unable to park call %s\n", transferee->name);
}
@@ -1747,7 +1740,7 @@
* \param chan,peer,config,code,sense,data
*
* Find a feature, determine which channel activated
- * \retval AST_FEATURE_RETURN_PBX_KEEPALIVE,AST_FEATURE_RETURN_NO_HANGUP_PEER
[... 1829 lines stripped ...]
More information about the asterisk-commits
mailing list