[asterisk-commits] tilghman: branch tilghman/malloc_hold r205278 - in /team/tilghman/malloc_hold...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Jul 8 12:46:52 CDT 2009
Author: tilghman
Date: Wed Jul 8 12:46:46 2009
New Revision: 205278
URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=205278
Log:
Merged revisions 203230,203311,203375,203380,203719,203785,203848,203908,204012,204067,204170,204243,204246,204300,204469,204474,204556,204681,204755,204834,205149,205188,205215 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r203230 | mmichelson | 2009-06-25 13:52:22 -0500 (Thu, 25 Jun 2009) | 3 lines
Prevent false positives when freeing a NULL pointer with MALLOC_DEBUG enabled.
........
r203311 | twilson | 2009-06-25 15:09:15 -0500 (Thu, 25 Jun 2009) | 2 lines
Don't try to free NULL
........
r203375 | russell | 2009-06-25 16:02:18 -0500 (Thu, 25 Jun 2009) | 9 lines
Fix a case where CDR answer time could be before the start time involving parking.
(closes issue #13794)
Reported by: davidw
Patches:
13794.patch uploaded by murf (license 17)
13794.patch.160 uploaded by murf (license 17)
Tested by: murf, dbrooks
........
r203380 | twilson | 2009-06-25 16:13:10 -0500 (Thu, 25 Jun 2009) | 4 lines
I didn't see that Mark already fixed the underlying issue!
Yay for removing useless code.
........
r203719 | dbrooks | 2009-06-26 15:03:42 -0500 (Fri, 26 Jun 2009) | 16 lines
Fixing voicemail's error in checking max silence vs min message length
Max silence was represented in milliseconds, yet vmminsecs (minmessage) was represented
as seconds.
Also, the inequality was reversed. The warning, if triggered, was "Max silence should
be less than minmessage or you may get empty messages", which should have been logged
if max silence was greater than minmessage, but the check was for less than.
Also, conforming if statement to coding guidelines.
closes issue #15331)
Reported by: markd
Review: https://reviewboard.asterisk.org/r/293/
........
r203785 | russell | 2009-06-26 16:16:39 -0500 (Fri, 26 Jun 2009) | 15 lines
Don't fast forward past the end of a message.
This is nice change for users of the voicemail application. If someone gets a
little carried away with fast forwarding through a message, they can easily
get to the end and accidentally exit the voicemail application by hitting the
fast forward key during the following prompt.
This adds some safety by not allowing a fast forward past the end of a message.
(closes issue #14554)
Reported by: lacoursj
Patches:
21761.patch uploaded by lacoursj (license 707)
Tested by: lacoursj
........
r203848 | jpeeler | 2009-06-26 17:09:19 -0500 (Fri, 26 Jun 2009) | 5 lines
Make sure to recreate the dahdi pseudo channel after dahdi restart
(closes issue #14477)
Reported by: timking
........
r203908 | rmudgett | 2009-06-26 19:55:12 -0500 (Fri, 26 Jun 2009) | 16 lines
The ISDN CPE side should not exclusively pick B channels normally.
Before this patch, Asterisk unconditionally picked B channels exclusively
on the CPE side and normally allowed alternative B channels on the network
side. Now Asterisk does the opposite.
Reasons for the CPE side to normally not pick B channels exclusively:
* For CPE point-to-multipoint mode (i.e. phone side), the CPE side does
not have enough information to exclusively pick B channels. (There may be
other devices on the line.)
* Q.931 gives preference to the network side picking B channels.
* Some telcos require the CPE side to not pick B channels exclusively.
(closes issue #14383)
Reported by: mbrancaleoni
........
r204012 | mmichelson | 2009-06-29 10:04:17 -0500 (Mon, 29 Jun 2009) | 6 lines
Place unlock of mutex in an else block so that it does not get unlocked twice.
(closes issue #15400)
Reported by: aragon
........
r204067 | dvossel | 2009-06-29 12:04:04 -0500 (Mon, 29 Jun 2009) | 14 lines
segfault after SPINLOCK schedule delete
Using the SPINLOCK schedule delete macro can result in the iax_pvt lock
being given up. This makes it possible for the iax_pvt to dissappear
when we thought we held the mutex the entire time. To resolve this, the
iax_pvt's ref count is incremented.
(closes issue #15377)
Reported by: aragon
Patches:
iax_spin_issue_1.4.diff uploaded by dvossel (license 671)
Tested by: aragon, dvossel
........
r204170 | tilghman | 2009-06-29 14:36:01 -0500 (Mon, 29 Jun 2009) | 3 lines
Revision 189537 was supposed to make 1.4 more correct. Instead, it broke func_odbc. Reverting.
(closes issue #15317, issue #14614)
........
r204243 | mmichelson | 2009-06-29 16:23:43 -0500 (Mon, 29 Jun 2009) | 23 lines
Fix a problem where chan_sip would ignore "old" but valid responses.
chan_sip has had a problem for quite a long time that would manifest when
Asterisk would send multiple SIP responses on the same dialog before receiving
a response. The problem occurred because chan_sip only kept track of the highest
outgoing sequence number used on the dialog. If Asterisk sent two requests out,
and a response arrived for the first request sent, then Asterisk would ignore
the response. The result was that Asterisk would continue retransmitting the
requests and ignoring the responses until the maximum number of retransmissions
had been reached.
The fix here is to rearrange the code a bit so that instead of simply comparing
the sequence number of the response to our latest outgoing sequence number, we
walk our list of outstanding packets and determine if there is a match. If there is,
we continue. If not, then we ignore the response.
In doing this, I found a few completely useless variables that I have now removed.
(closes issue #11231)
Reported by: flefoll
Review: https://reviewboard.asterisk.org/r/298
........
r204246 | mmichelson | 2009-06-29 16:37:05 -0500 (Mon, 29 Jun 2009) | 3 lines
Fix build oops.
........
r204300 | mmichelson | 2009-06-29 17:45:34 -0500 (Mon, 29 Jun 2009) | 9 lines
Add error message so that it is clear why a SIP peer was not processed when
a DNS lookup fails on a host or outboundproxy.
(closes issue #13432)
Reported by: p_lindheimer
Patches:
outboundproxy.patch uploaded by p (license 558)
........
r204469 | tilghman | 2009-06-30 13:23:35 -0500 (Tue, 30 Jun 2009) | 11 lines
"tw" is the language specification for Twi (from Ghana) not Taiwanese.
(closes issue #15346)
Reported by: volivier
Patches:
20090617__issue15346__1.4.diff.txt uploaded by tilghman (license 14)
20090617__issue15346__trunk.diff.txt uploaded by tilghman (license 14)
20090617__issue15346__1.6.0.diff.txt uploaded by tilghman (license 14)
20090617__issue15346__1.6.1.diff.txt uploaded by tilghman (license 14)
20090617__issue15346__1.6.2.diff.txt uploaded by tilghman (license 14)
Tested by: volivier
........
r204474 | qwell | 2009-06-30 13:47:06 -0500 (Tue, 30 Jun 2009) | 1 line
Fix ast_say_counted_noun to correctly handle Polish. Fix a comment typo in passing.
........
r204556 | tilghman | 2009-06-30 15:23:51 -0500 (Tue, 30 Jun 2009) | 6 lines
More incorrect language codes, plus ensuring that regionalizations use the specified language, and not English for grammar.
(closes issue #15022)
Reported by: greenfieldtech
Patches:
20090519__issue15022.diff.txt uploaded by tilghman (license 14)
........
r204681 | dvossel | 2009-07-02 10:05:57 -0500 (Thu, 02 Jul 2009) | 14 lines
Improved mapping of extension states from combined device states.
This fixes a few issues with incorrect extension states and adds
a cli command, core show device2extenstate, to display all possible
state mappings.
(closes issue #15413)
Reported by: legart
Patches:
exten_helper.diff uploaded by dvossel (license 671)
Tested by: dvossel, legart, amilcar
Review: https://reviewboard.asterisk.org/r/301/
........
r204755 | dvossel | 2009-07-02 13:15:39 -0500 (Thu, 02 Jul 2009) | 2 lines
moving device state functions from pbx.h to devicestate.h to sync with other branches
........
r204834 | rmudgett | 2009-07-02 16:59:43 -0500 (Thu, 02 Jul 2009) | 10 lines
Removed confusing warning message "Got Busy in Connected State"
If an incoming mISDN call is answered with the Answer application and a
subsequent Dial gets a busy endpoint then it is valid for that already
connected channel to get the busy indication. Asterisk will play the busy
tones until the dialplan plays something else or hangs up the call.
(closes issue #11974)
Reported by: fvdb
........
r205149 | russell | 2009-07-08 10:54:21 -0500 (Wed, 08 Jul 2009) | 8 lines
Make OpenSSL usage thread-safe.
OpenSSL is not thread-safe by default. However, making it thread safe is
very easy. We just have to provide a couple of callbacks. One callback
returns a thread ID. The other handles locking. For more information,
start with the "Is OpenSSL thread-safe?" question on the FAQ page of
openssl.org.
........
r205188 | tilghman | 2009-07-08 11:26:15 -0500 (Wed, 08 Jul 2009) | 2 lines
Add redirection warnings for the invalid language codes previously removed.
........
r205215 | dvossel | 2009-07-08 11:53:40 -0500 (Wed, 08 Jul 2009) | 10 lines
ast_samp2tv needs floating point for 16khz audio
In ast_samp2tv(), (1000000 / _rate) = 62.5 when _rate is 16000.
The .5 is currently stripped off because we don't calculate
using floating points. This causes madness with 16khz audio.
(issue ABE-1899)
Review: https://reviewboard.asterisk.org/r/305/
........
Modified:
team/tilghman/malloc_hold/ (props changed)
team/tilghman/malloc_hold/UPGRADE.txt
team/tilghman/malloc_hold/apps/app_mixmonitor.c
team/tilghman/malloc_hold/apps/app_voicemail.c
team/tilghman/malloc_hold/channels/chan_dahdi.c
team/tilghman/malloc_hold/channels/chan_iax2.c
team/tilghman/malloc_hold/channels/chan_misdn.c
team/tilghman/malloc_hold/channels/chan_sip.c
team/tilghman/malloc_hold/funcs/func_odbc.c
team/tilghman/malloc_hold/funcs/func_strings.c
team/tilghman/malloc_hold/include/asterisk/devicestate.h
team/tilghman/malloc_hold/include/asterisk/pbx.h
team/tilghman/malloc_hold/include/asterisk/time.h
team/tilghman/malloc_hold/main/astmm.c
team/tilghman/malloc_hold/main/cli.c
team/tilghman/malloc_hold/main/devicestate.c
team/tilghman/malloc_hold/main/file.c
team/tilghman/malloc_hold/main/pbx.c
team/tilghman/malloc_hold/main/say.c
team/tilghman/malloc_hold/res/res_crypto.c
team/tilghman/malloc_hold/res/res_features.c
Propchange: team/tilghman/malloc_hold/
------------------------------------------------------------------------------
automerge = *
Propchange: team/tilghman/malloc_hold/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Wed Jul 8 12:46:46 2009
@@ -1,1 +1,1 @@
-/branches/1.4:1-203179
+/branches/1.4:1-205219
Modified: team/tilghman/malloc_hold/UPGRADE.txt
URL: http://svn.asterisk.org/svn-view/asterisk/team/tilghman/malloc_hold/UPGRADE.txt?view=diff&rev=205278&r1=205277&r2=205278
==============================================================================
--- team/tilghman/malloc_hold/UPGRADE.txt (original)
+++ team/tilghman/malloc_hold/UPGRADE.txt Wed Jul 8 12:46:46 2009
@@ -106,6 +106,16 @@
if your dialplan relies on the ability to 'run off the end' of an extension
and wait for a new extension without using WaitExten() to accomplish that,
you will need set autofallthrough to 'no' in your extensions.conf file.
+
+Language Support:
+
+* Support for Taiwanese was incorrectly supported with the "tw" language code.
+ In reality, the "tw" language code is reserved for the Twi language, native
+ to Ghana. If you were previously using the "tw" language code, you should
+ switch to using either "zh" (for Mandarin Chinese) or "zh_TW" for Taiwan
+ specific localizations. Additionally, "mx" should be changed to "es_MX",
+ Georgian was incorrectly specified as "ge" but should be "ka", and Czech is
+ "cs", not "cz".
Command Line Interface:
Modified: team/tilghman/malloc_hold/apps/app_mixmonitor.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/tilghman/malloc_hold/apps/app_mixmonitor.c?view=diff&rev=205278&r1=205277&r2=205278
==============================================================================
--- team/tilghman/malloc_hold/apps/app_mixmonitor.c (original)
+++ team/tilghman/malloc_hold/apps/app_mixmonitor.c Wed Jul 8 12:46:46 2009
@@ -273,8 +273,9 @@
ast_writestream(*fs, cur);
}
}
+ } else {
+ ast_mutex_unlock(&mixmonitor->mixmonitor_ds->lock);
}
- ast_mutex_unlock(&mixmonitor->mixmonitor_ds->lock);
/* All done! free it. */
ast_frame_free(fr, 0);
Modified: team/tilghman/malloc_hold/apps/app_voicemail.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/tilghman/malloc_hold/apps/app_voicemail.c?view=diff&rev=205278&r1=205277&r2=205278
==============================================================================
--- team/tilghman/malloc_hold/apps/app_voicemail.c (original)
+++ team/tilghman/malloc_hold/apps/app_voicemail.c Wed Jul 8 12:46:46 2009
@@ -8510,7 +8510,7 @@
if ((s = ast_variable_retrieve(cfg, "general", "minmessage"))) {
if (sscanf(s, "%d", &x) == 1) {
vmminmessage = x;
- if (maxsilence <= vmminmessage)
+ if (maxsilence / 1000 >= vmminmessage)
ast_log(LOG_WARNING, "maxsilence should be less than minmessage or you may get empty messages\n");
} else {
ast_log(LOG_WARNING, "Invalid min message time length\n");
Modified: team/tilghman/malloc_hold/channels/chan_dahdi.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/tilghman/malloc_hold/channels/chan_dahdi.c?view=diff&rev=205278&r1=205277&r2=205278
==============================================================================
--- team/tilghman/malloc_hold/channels/chan_dahdi.c (original)
+++ team/tilghman/malloc_hold/channels/chan_dahdi.c Wed Jul 8 12:46:46 2009
@@ -2463,15 +2463,12 @@
pri_set_crv(p->pri->pri, p->call, p->channel, 0);
}
p->digital = IS_DIGITAL(ast->transfercapability);
- /* Add support for exclusive override */
- if (p->priexclusive)
+
+ /* Should the picked channel be used exclusively? */
+ if (p->priexclusive || p->pri->nodetype == PRI_NETWORK) {
exclusive = 1;
- else {
- /* otherwise, traditional behavior */
- if (p->pri->nodetype == PRI_NETWORK)
- exclusive = 0;
- else
- exclusive = 1;
+ } else {
+ exclusive = 0;
}
pri_sr_set_channel(sr, p->bearer ? PVT_TO_CHANNEL(p->bearer) : PVT_TO_CHANNEL(p), exclusive, 1);
@@ -11996,7 +11993,7 @@
}
/*< \todo why check for the pseudo in the per-channel section.
* Any actual use for manual setup of the pseudo channel? */
- if (!found_pseudo && reload == 0) {
+ if (!found_pseudo && reload != 1) {
/* use the default configuration for a channel, so
that any settings from real configured channels
don't "leak" into the pseudo channel config
Modified: team/tilghman/malloc_hold/channels/chan_iax2.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/tilghman/malloc_hold/channels/chan_iax2.c?view=diff&rev=205278&r1=205277&r2=205278
==============================================================================
--- team/tilghman/malloc_hold/channels/chan_iax2.c (original)
+++ team/tilghman/malloc_hold/channels/chan_iax2.c Wed Jul 8 12:46:46 2009
@@ -1358,10 +1358,20 @@
goto retry;
}
}
- if (!owner && iaxs[callno]) {
- AST_SCHED_DEL_SPINLOCK(sched, iaxs[callno]->lagid, &iaxsl[callno]);
- AST_SCHED_DEL_SPINLOCK(sched, iaxs[callno]->pingid, &iaxsl[callno]);
- iaxs[callno] = NULL;
+
+ /* SPINLOCK gives up the pvt lock so the scheduler and iax2_pvt don't deadlock. Since we
+ * give up the pvt lock, the pvt could be destroyed from underneath us. To guarantee
+ * the pvt stays around, a ref count is added to it. */
+ if (!owner && pvt) {
+ ao2_ref(pvt, +1);
+ AST_SCHED_DEL_SPINLOCK(sched, pvt->lagid, &iaxsl[pvt->callno]);
+ AST_SCHED_DEL_SPINLOCK(sched, pvt->pingid, &iaxsl[pvt->callno]);
+ ao2_ref(pvt, -1);
+ if (iaxs[callno]) {
+ iaxs[callno] = NULL;
+ } else {
+ pvt = NULL;
+ }
}
if (pvt) {
Modified: team/tilghman/malloc_hold/channels/chan_misdn.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/tilghman/malloc_hold/channels/chan_misdn.c?view=diff&rev=205278&r1=205277&r2=205278
==============================================================================
--- team/tilghman/malloc_hold/channels/chan_misdn.c (original)
+++ team/tilghman/malloc_hold/channels/chan_misdn.c Wed Jul 8 12:46:46 2009
@@ -2431,8 +2431,6 @@
if (p->state != MISDN_CONNECTED) {
start_bc_tones(p);
misdn_lib_send_event( p->bc, EVENT_DISCONNECT);
- } else {
- chan_misdn_log(-1, p->bc->port, " --> !! Got Busy in Connected State !?! ast:%s\n", ast->name);
}
return -1;
case AST_CONTROL_RING:
Modified: team/tilghman/malloc_hold/channels/chan_sip.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/tilghman/malloc_hold/channels/chan_sip.c?view=diff&rev=205278&r1=205277&r2=205278
==============================================================================
--- team/tilghman/malloc_hold/channels/chan_sip.c (original)
+++ team/tilghman/malloc_hold/channels/chan_sip.c Wed Jul 8 12:46:46 2009
@@ -813,7 +813,6 @@
#define SIP_PKT_DEBUG (1 << 0) /*!< Debug this packet */
#define SIP_PKT_WITH_TOTAG (1 << 1) /*!< This packet has a to-tag */
#define SIP_PKT_IGNORE (1 << 2) /*!< This is a re-transmit, ignore it */
-#define SIP_PKT_IGNORE_RESP (1 << 3) /*!< Resp ignore - ??? */
#define SIP_PKT_IGNORE_REQ (1 << 4) /*!< Req ignore - ??? */
/* T.38 set of flags */
@@ -960,7 +959,6 @@
ast_group_t callgroup; /*!< Call group */
ast_group_t pickupgroup; /*!< Pickup group */
int lastinvite; /*!< Last Cseq of invite */
- int lastnoninvite; /*!< Last Cseq of non-invite */
struct ast_flags flags[2]; /*!< SIP_ flags */
int timer_t1; /*!< SIP timer T1, ms rtt */
unsigned int sipoptions; /*!< Supported SIP options on the other end */
@@ -1300,7 +1298,7 @@
static int sip_cancel_destroy(struct sip_pvt *p);
static void sip_destroy(struct sip_pvt *p);
static int __sip_destroy(struct sip_pvt *p, int lockowner);
-static void __sip_ack(struct sip_pvt *p, int seqno, int resp, int sipmethod);
+static int __sip_ack(struct sip_pvt *p, int seqno, int resp, int sipmethod);
static void __sip_pretend_ack(struct sip_pvt *p);
static int __sip_semi_ack(struct sip_pvt *p, int seqno, int resp, int sipmethod);
static int auto_congest(const void *nothing);
@@ -1557,8 +1555,8 @@
/*------Response handling functions */
static void handle_response_invite(struct sip_pvt *p, int resp, char *rest, struct sip_request *req, int seqno);
static void handle_response_refer(struct sip_pvt *p, int resp, char *rest, struct sip_request *req, int seqno);
-static int handle_response_register(struct sip_pvt *p, int resp, char *rest, struct sip_request *req, int ignore, int seqno);
-static void handle_response(struct sip_pvt *p, int resp, char *rest, struct sip_request *req, int ignore, int seqno);
+static int handle_response_register(struct sip_pvt *p, int resp, char *rest, struct sip_request *req, int seqno);
+static void handle_response(struct sip_pvt *p, int resp, char *rest, struct sip_request *req, int seqno);
/*----- RTP interface functions */
static int sip_set_rtp_peer(struct ast_channel *chan, struct ast_rtp *rtp, struct ast_rtp *vrtp, int codecs, int nat_active);
@@ -2185,7 +2183,7 @@
/*! \brief Acknowledges receipt of a packet and stops retransmission
* called with p locked*/
-static void __sip_ack(struct sip_pvt *p, int seqno, int resp, int sipmethod)
+static int __sip_ack(struct sip_pvt *p, int seqno, int resp, int sipmethod)
{
struct sip_pkt *cur, *prev = NULL;
@@ -2234,6 +2232,7 @@
}
if (option_debug)
ast_log(LOG_DEBUG, "Stopping retransmission on '%s' of %s %d: Match %s\n", p->callid, resp ? "Response" : "Request", seqno, res == FALSE ? "Not Found" : "Found");
+ return res;
}
/*! \brief Pretend to ack all packets
@@ -2258,7 +2257,7 @@
static int __sip_semi_ack(struct sip_pvt *p, int seqno, int resp, int sipmethod)
{
struct sip_pkt *cur;
- int res = -1;
+ int res = FALSE;
for (cur = p->packets; cur; cur = cur->next) {
if (cur->seqno == seqno && ast_test_flag(cur, FLAG_RESPONSE) == resp &&
@@ -2269,7 +2268,7 @@
ast_log(LOG_DEBUG, "*** SIP TIMER: Cancelling retransmission #%d - %s (got response)\n", cur->retransid, sip_methods[sipmethod].text);
}
AST_SCHED_DEL(sched, cur->retransid);
- res = 0;
+ res = TRUE;
break;
}
}
@@ -7698,8 +7697,6 @@
if (!p->initreq.headers)
initialize_initreq(p, &req);
- p->lastnoninvite = p->ocseq;
-
return send_request(p, &req, XMIT_RELIABLE, p->ocseq);
}
@@ -12922,7 +12919,7 @@
}
/*! \brief Handle responses on REGISTER to services */
-static int handle_response_register(struct sip_pvt *p, int resp, char *rest, struct sip_request *req, int ignore, int seqno)
+static int handle_response_register(struct sip_pvt *p, int resp, char *rest, struct sip_request *req, int seqno)
{
int expires, expires_ms;
struct sip_registry *r;
@@ -13122,11 +13119,12 @@
/*! \brief Handle SIP response in dialogue */
/* XXX only called by handle_request */
-static void handle_response(struct sip_pvt *p, int resp, char *rest, struct sip_request *req, int ignore, int seqno)
+static void handle_response(struct sip_pvt *p, int resp, char *rest, struct sip_request *req, int seqno)
{
struct ast_channel *owner;
int sipmethod;
int res = 1;
+ int ack_res;
const char *c = get_header(req, "Cseq");
/* GCC 4.2 complains if I try to cast c as a char * when passing it to ast_skip_nonblanks, so make a copy of it */
char *c_copy = ast_strdupa(c);
@@ -13143,10 +13141,16 @@
owner->hangupcause = hangup_sip2cause(resp);
/* Acknowledge whatever it is destined for */
- if ((resp >= 100) && (resp <= 199))
- __sip_semi_ack(p, seqno, 0, sipmethod);
- else
- __sip_ack(p, seqno, 0, sipmethod);
+ if ((resp >= 100) && (resp <= 199)) {
+ ack_res = __sip_semi_ack(p, seqno, 0, sipmethod);
+ } else {
+ ack_res = __sip_ack(p, seqno, 0, sipmethod);
+ }
+
+ if (ack_res == FALSE) {
+ append_history(p, "Ignore", "Ignoring this retransmit\n");
+ return;
+ }
/* If this is a NOTIFY for a subscription clear the flag that indicates that we have a NOTIFY pending */
if (!p->owner && sipmethod == SIP_NOTIFY && p->pendinginvite)
@@ -13223,7 +13227,7 @@
}
}
} else if (sipmethod == SIP_REGISTER)
- res = handle_response_register(p, resp, rest, req, ignore, seqno);
+ res = handle_response_register(p, resp, rest, req, seqno);
else if (sipmethod == SIP_BYE) { /* Ok, we're ready to go */
ast_set_flag(&p->flags[0], SIP_NEEDDESTROY);
ast_clear_flag(&p->flags[1], SIP_PAGE2_DIALOG_ESTABLISHED);
@@ -13240,7 +13244,7 @@
else if (sipmethod == SIP_REFER)
handle_response_refer(p, resp, rest, req, seqno);
else if (p->registry && sipmethod == SIP_REGISTER)
- res = handle_response_register(p, resp, rest, req, ignore, seqno);
+ res = handle_response_register(p, resp, rest, req, seqno);
else if (sipmethod == SIP_BYE) {
if (ast_strlen_zero(p->authname)) {
ast_log(LOG_WARNING, "Asked to authenticate %s, to %s:%d but we have no matching peer!\n",
@@ -13261,7 +13265,7 @@
if (sipmethod == SIP_INVITE)
handle_response_invite(p, resp, rest, req, seqno);
else if (p->registry && sipmethod == SIP_REGISTER)
- res = handle_response_register(p, resp, rest, req, ignore, seqno);
+ res = handle_response_register(p, resp, rest, req, seqno);
else {
ast_log(LOG_WARNING, "Forbidden - maybe wrong password on authentication for %s\n", msg);
ast_set_flag(&p->flags[0], SIP_NEEDDESTROY);
@@ -13269,7 +13273,7 @@
break;
case 404: /* Not found */
if (p->registry && sipmethod == SIP_REGISTER)
- res = handle_response_register(p, resp, rest, req, ignore, seqno);
+ res = handle_response_register(p, resp, rest, req, seqno);
else if (sipmethod == SIP_INVITE)
handle_response_invite(p, resp, rest, req, seqno);
else if (owner)
@@ -13281,7 +13285,7 @@
else if (sipmethod == SIP_REFER)
handle_response_refer(p, resp, rest, req, seqno);
else if (p->registry && sipmethod == SIP_REGISTER)
- res = handle_response_register(p, resp, rest, req, ignore, seqno);
+ res = handle_response_register(p, resp, rest, req, seqno);
else if (sipmethod == SIP_BYE) {
if (ast_strlen_zero(p->authname)) {
ast_log(LOG_WARNING, "Asked to authenticate %s, to %s:%d but we have no matching peer!\n",
@@ -13299,7 +13303,7 @@
if (sipmethod == SIP_INVITE)
handle_response_invite(p, resp, rest, req, seqno);
else if (sipmethod == SIP_REGISTER)
- res = handle_response_register(p, resp, rest, req, ignore, seqno);
+ res = handle_response_register(p, resp, rest, req, seqno);
else if (sipmethod == SIP_BYE) {
ast_set_flag(&p->flags[0], SIP_NEEDDESTROY);
if (option_debug)
@@ -16098,7 +16102,7 @@
/* Get the command XXX */
cmd = req->rlPart1;
- e = req->rlPart2;
+ e = ast_skip_blanks(req->rlPart2);
/* Save useragent of the client */
useragent = get_header(req, "User-Agent");
@@ -16108,36 +16112,32 @@
/* Find out SIP method for incoming request */
if (req->method == SIP_RESPONSE) { /* Response to our request */
/* Response to our request -- Do some sanity checks */
+ if (ast_strlen_zero(e)) {
+ return 0;
+ }
+ if (sscanf(e, "%d %n", &respid, &len) != 1) {
+ ast_log(LOG_WARNING, "Invalid response: '%s'\n", e);
+ return 0;
+ }
+ if (respid <= 0) {
+ ast_log(LOG_WARNING, "Invalid SIP response code: '%d'\n", respid);
+ return 0;
+ }
if (!p->initreq.headers) {
if (option_debug)
ast_log(LOG_DEBUG, "That's odd... Got a response on a call we dont know about. Cseq %d Cmd %s\n", seqno, cmd);
ast_set_flag(&p->flags[0], SIP_NEEDDESTROY);
return 0;
- } else if (p->ocseq && (p->ocseq < seqno) && (seqno != p->lastnoninvite)) {
+ }
+ if (p->ocseq && (p->ocseq < seqno)) {
if (option_debug)
ast_log(LOG_DEBUG, "Ignoring out of order response %d (expecting %d)\n", seqno, p->ocseq);
return -1;
- } else if (p->ocseq && (p->ocseq != seqno) && (seqno != p->lastnoninvite)) {
- /* ignore means "don't do anything with it" but still have to
- respond appropriately */
- ignore = TRUE;
- ast_set_flag(req, SIP_PKT_IGNORE);
- ast_set_flag(req, SIP_PKT_IGNORE_RESP);
- append_history(p, "Ignore", "Ignoring this retransmit\n");
- } else if (e) {
- e = ast_skip_blanks(e);
- if (sscanf(e, "%d %n", &respid, &len) != 1) {
- ast_log(LOG_WARNING, "Invalid response: '%s'\n", e);
- } else {
- if (respid <= 0) {
- ast_log(LOG_WARNING, "Invalid SIP response code: '%d'\n", respid);
- return 0;
- }
- /* More SIP ridiculousness, we have to ignore bogus contacts in 100 etc responses */
- if ((respid == 200) || ((respid >= 300) && (respid <= 399)))
- extract_uri(p, req);
- handle_response(p, respid, e + len, req, ignore, seqno);
+ } else {
+ if ((respid == 200) || ((respid >= 300) && (respid <= 399))) {
+ extract_uri(p, req);
}
+ handle_response(p, respid, e + len, req, seqno);
}
return 0;
}
@@ -17703,6 +17703,7 @@
ast_clear_flag(&peer->flags[1], SIP_PAGE2_DYNAMIC);
if (!obproxyfound || !strcasecmp(v->name, "outboundproxy")) {
if (ast_get_ip_or_srv(&peer->addr, v->value, srvlookup ? "_sip._udp" : NULL)) {
+ ast_log(LOG_ERROR, "srvlookup failed for outboundproxy: %s, on peer %s, removing peer\n", v->value, peer->name);
ASTOBJ_UNREF(peer, sip_destroy_peer);
return NULL;
}
Modified: team/tilghman/malloc_hold/funcs/func_odbc.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/tilghman/malloc_hold/funcs/func_odbc.c?view=diff&rev=205278&r1=205277&r2=205278
==============================================================================
--- team/tilghman/malloc_hold/funcs/func_odbc.c (original)
+++ team/tilghman/malloc_hold/funcs/func_odbc.c Wed Jul 8 12:46:46 2009
@@ -227,9 +227,6 @@
SQLSMALLINT colcount=0;
SQLLEN indicator;
- /* Reset, in case of an error */
- pbx_builtin_setvar_helper(chan, "~ODBCVALUES~", "");
-
AST_LIST_LOCK(&queries);
AST_LIST_TRAVERSE(&queries, query, list) {
if (!strcmp(query->acf->name, cmd)) {
@@ -348,9 +345,9 @@
return -1;
}
- /* Copy data, encoding '\', ',', '"', and '|' for the argument parser */
+ /* Copy data, encoding '\' and ',' for the argument parser */
for (i = 0; i < sizeof(coldata); i++) {
- if (escapecommas && strchr("\\,|\"", coldata[i])) {
+ if (escapecommas && (coldata[i] == '\\' || coldata[i] == ',')) {
buf[buflen++] = '\\';
}
buf[buflen++] = coldata[i];
@@ -371,10 +368,6 @@
SQLCloseCursor(stmt);
SQLFreeHandle(SQL_HANDLE_STMT, stmt);
ast_odbc_release_obj(obj);
-
- /* Pass an unadulterated string to ARRAY, if needed. This is only needed
- * in 1.4, because of the misfeature in Set. */
- pbx_builtin_setvar_helper(chan, "~ODBCVALUES~", buf);
if (chan)
ast_autoservice_stop(chan);
if (bogus_chan)
Modified: team/tilghman/malloc_hold/funcs/func_strings.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/tilghman/malloc_hold/funcs/func_strings.c?view=diff&rev=205278&r1=205277&r2=205278
==============================================================================
--- team/tilghman/malloc_hold/funcs/func_strings.c (original)
+++ team/tilghman/malloc_hold/funcs/func_strings.c Wed Jul 8 12:46:46 2009
@@ -162,23 +162,6 @@
.read = regex,
};
-static int strecmp(const char *pre, const char *post)
-{
- int res;
- for (; *pre && *post; pre++, post++) {
- if (*pre == '"') {
- post--;
- continue;
- } else if (*pre == '\\') {
- pre++;
- }
- if ((res = strncmp(pre, post, 1))) {
- return res;
- }
- }
- return strncmp(pre, post, 1);
-}
-
static int array(struct ast_channel *chan, char *cmd, char *var,
const char *value)
{
@@ -190,15 +173,6 @@
);
char *value2;
int i;
-
- if (chan) {
- const char *value3;
- ast_mutex_lock(&chan->lock);
- if ((value3 = pbx_builtin_getvar_helper(chan, "~ODBCVALUES~")) && strecmp(value3, value) == 0) {
- value = ast_strdupa(value3);
- }
- ast_mutex_unlock(&chan->lock);
- }
value2 = ast_strdupa(value);
if (!var || !value2)
Modified: team/tilghman/malloc_hold/include/asterisk/devicestate.h
URL: http://svn.asterisk.org/svn-view/asterisk/team/tilghman/malloc_hold/include/asterisk/devicestate.h?view=diff&rev=205278&r1=205277&r2=205278
==============================================================================
--- team/tilghman/malloc_hold/include/asterisk/devicestate.h (original)
+++ team/tilghman/malloc_hold/include/asterisk/devicestate.h Wed Jul 8 12:46:46 2009
@@ -27,24 +27,18 @@
extern "C" {
#endif
-/*! Device is valid but channel didn't know state */
-#define AST_DEVICE_UNKNOWN 0
-/*! Device is not used */
-#define AST_DEVICE_NOT_INUSE 1
-/*! Device is in use */
-#define AST_DEVICE_INUSE 2
-/*! Device is busy */
-#define AST_DEVICE_BUSY 3
-/*! Device is invalid */
-#define AST_DEVICE_INVALID 4
-/*! Device is unavailable */
-#define AST_DEVICE_UNAVAILABLE 5
-/*! Device is ringing */
-#define AST_DEVICE_RINGING 6
-/*! Device is ringing *and* in use */
-#define AST_DEVICE_RINGINUSE 7
-/*! Device is on hold */
-#define AST_DEVICE_ONHOLD 8
+enum ast_device_state {
+ AST_DEVICE_UNKNOWN, /*!< Device is valid but channel didn't know state */
+ AST_DEVICE_NOT_INUSE, /*!< Device is not used */
+ AST_DEVICE_INUSE, /*!< Device is in use */
+ AST_DEVICE_BUSY, /*!< Device is busy */
+ AST_DEVICE_INVALID, /*!< Device is invalid */
+ AST_DEVICE_UNAVAILABLE, /*!< Device is unavailable */
+ AST_DEVICE_RINGING, /*!< Device is ringing */
+ AST_DEVICE_RINGINUSE, /*!< Device is ringing *and* in use */
+ AST_DEVICE_ONHOLD, /*!< Device is on hold */
+ AST_DEVICE_TOTAL, /*!< Total num of device states, used for testing */
+};
/*! \brief Devicestate watcher call back */
typedef int (*ast_devstate_cb_type)(const char *dev, int state, void *data);
@@ -55,7 +49,7 @@
/*! \brief Convert device state to text string for output
* \param devstate Current device state
*/
-const char *devstate2str(int devstate);
+const char *devstate2str(enum ast_device_state devstate);
/*! \brief Search the Channels by Name
* \param device like a dialstring
@@ -124,6 +118,64 @@
*/
void ast_devstate_prov_del(const char *label);
+/*!
+ * \brief An object to hold state when calculating aggregate device state
+ */
+struct ast_devstate_aggregate;
+
+/*!
+ * \brief Initialize aggregate device state
+ *
+ * \param[in] agg the state object
+ *
+ * \return nothing
+ */
+void ast_devstate_aggregate_init(struct ast_devstate_aggregate *agg);
+
+/*!
+ * \brief Add a device state to the aggregate device state
+ *
+ * \param[in] agg the state object
+ * \param[in] state the state to add
+ *
+ * \return nothing
+ */
+void ast_devstate_aggregate_add(struct ast_devstate_aggregate *agg, enum ast_device_state state);
+
+/*!
+ * \brief Get the aggregate device state result
+ *
+ * \param[in] agg the state object
+ *
+ * \return the aggregate device state after adding some number of device states.
+ */
+enum ast_device_state ast_devstate_aggregate_result(struct ast_devstate_aggregate *agg);
+
+/*!
+ * \brief Map devstate to an extension state.
+ *
+ * \param[in] device state
+ *
+ * \return the extension state mapping.
+ */
+enum ast_extension_states ast_devstate_to_extenstate(enum ast_device_state devstate);
+
+/*!
+ * \brief You shouldn't care about the contents of this struct
+ *
+ * This struct is only here so that it can be easily declared on the stack.
+ */
+struct ast_devstate_aggregate {
+ unsigned int all_unavail:1;
+ unsigned int all_busy:1;
+ unsigned int all_free:1;
+ unsigned int all_unknown:1;
+ unsigned int on_hold:1;
+ unsigned int busy:1;
+ unsigned int in_use:1;
+ unsigned int ring:1;
+};
+
int ast_device_state_engine_init(void);
#if defined(__cplusplus) || defined(c_plusplus)
Modified: team/tilghman/malloc_hold/include/asterisk/pbx.h
URL: http://svn.asterisk.org/svn-view/asterisk/team/tilghman/malloc_hold/include/asterisk/pbx.h?view=diff&rev=205278&r1=205277&r2=205278
==============================================================================
--- team/tilghman/malloc_hold/include/asterisk/pbx.h (original)
+++ team/tilghman/malloc_hold/include/asterisk/pbx.h Wed Jul 8 12:46:46 2009
@@ -26,6 +26,7 @@
#include "asterisk/sched.h"
#include "asterisk/channel.h"
#include "asterisk/linkedlists.h"
+#include "asterisk/devicestate.h"
#if defined(__cplusplus) || defined(c_plusplus)
extern "C" {
Modified: team/tilghman/malloc_hold/include/asterisk/time.h
URL: http://svn.asterisk.org/svn-view/asterisk/team/tilghman/malloc_hold/include/asterisk/time.h?view=diff&rev=205278&r1=205277&r2=205278
==============================================================================
--- team/tilghman/malloc_hold/include/asterisk/time.h (original)
+++ team/tilghman/malloc_hold/include/asterisk/time.h Wed Jul 8 12:46:46 2009
@@ -137,7 +137,7 @@
AST_INLINE_API(
struct timeval ast_samp2tv(unsigned int _nsamp, unsigned int _rate),
{
- return ast_tv(_nsamp / _rate, (_nsamp % _rate) * (1000000 / _rate));
+ return ast_tv(_nsamp / _rate, (_nsamp % _rate) * (1000000 / (float) _rate));
}
)
Modified: team/tilghman/malloc_hold/main/astmm.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/tilghman/malloc_hold/main/astmm.c?view=diff&rev=205278&r1=205277&r2=205278
==============================================================================
--- team/tilghman/malloc_hold/main/astmm.c (original)
+++ team/tilghman/malloc_hold/main/astmm.c Wed Jul 8 12:46:46 2009
@@ -164,16 +164,18 @@
static void __ast_free_region(void *ptr, const char *file, int lineno, const char *func)
{
- int hash = HASH(ptr);
+ int hash;
struct ast_region *reg, *prev = NULL;
unsigned int *fence;
#ifdef MALLOC_HOLD
time_t now;
#endif
- if (ptr == NULL) {
+ if (!ptr) {
return;
}
+
+ hash = HASH(ptr);
#ifdef MALLOC_HOLD
now = time(NULL);
@@ -219,9 +221,9 @@
char **strings;
int i;
#endif
- astmm_log("WARNING: memory written to after being freed "
- "at %p, (originally in %s of %s, line %d)\n",
- tbf->data, tbf->func, tbf->file, tbf->lineno);
+ astmm_log("WARNING: memory (%p) written to after being freed "
+ "at %p (+%d/%d), (originally in %s of %s, line %d)\n",
+ tbf->data, ptr, ptr - tbf->data, tbf->len, tbf->func, tbf->file, tbf->lineno);
#if defined(linux) && defined(AST_DEVMODE) && defined(NOT)
if ((strings = backtrace_symbols(tbf->freebt, tbf->btcount))) {
astmm_log("%d backtrace records\n", tbf->btcount);
Modified: team/tilghman/malloc_hold/main/cli.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/tilghman/malloc_hold/main/cli.c?view=diff&rev=205278&r1=205277&r2=205278
==============================================================================
--- team/tilghman/malloc_hold/main/cli.c (original)
+++ team/tilghman/malloc_hold/main/cli.c Wed Jul 8 12:46:46 2009
@@ -1289,6 +1289,7 @@
c += (strlen(ast_config_AST_MODULE_DIR) + 1);
if (c)
c = strdup(c);
+
free(d);
return c;
Modified: team/tilghman/malloc_hold/main/devicestate.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/tilghman/malloc_hold/main/devicestate.c?view=diff&rev=205278&r1=205277&r2=205278
==============================================================================
--- team/tilghman/malloc_hold/main/devicestate.c (original)
+++ team/tilghman/malloc_hold/main/devicestate.c Wed Jul 8 12:46:46 2009
@@ -45,15 +45,15 @@
/*! \brief Device state strings for printing */
static const char *devstatestring[] = {
- /* 0 AST_DEVICE_UNKNOWN */ "Unknown", /*!< Valid, but unknown state */
- /* 1 AST_DEVICE_NOT_INUSE */ "Not in use", /*!< Not used */
- /* 2 AST_DEVICE IN USE */ "In use", /*!< In use */
- /* 3 AST_DEVICE_BUSY */ "Busy", /*!< Busy */
- /* 4 AST_DEVICE_INVALID */ "Invalid", /*!< Invalid - not known to Asterisk */
- /* 5 AST_DEVICE_UNAVAILABLE */ "Unavailable", /*!< Unavailable (not registered) */
- /* 6 AST_DEVICE_RINGING */ "Ringing", /*!< Ring, ring, ring */
- /* 7 AST_DEVICE_RINGINUSE */ "Ring+Inuse", /*!< Ring and in use */
- /* 8 AST_DEVICE_ONHOLD */ "On Hold" /*!< On Hold */
+ /* 0 AST_DEVICE_UNKNOWN */ "Unknown", /*!< Valid, but unknown state */
+ /* 1 AST_DEVICE_NOT_INUSE */ "Not in use", /*!< Not used */
+ /* 2 AST_DEVICE IN USE */ "In use", /*!< In use */
+ /* 3 AST_DEVICE_BUSY */ "Busy", /*!< Busy */
+ /* 4 AST_DEVICE_INVALID */ "Invalid", /*!< Invalid - not known to Asterisk */
+ /* 5 AST_DEVICE_UNAVAILABLE */"Unavailable",/*!< Unavailable (not registered) */
+ /* 6 AST_DEVICE_RINGING */ "Ringing", /*!< Ring, ring, ring */
+ /* 7 AST_DEVICE_RINGINUSE */ "Ring+Inuse", /*!< Ring and in use */
+ /* 8 AST_DEVICE_ONHOLD */ "On Hold" /*!< On Hold */
};
/*! \brief A device state provider (not a channel) */
@@ -95,7 +95,7 @@
static int getproviderstate(const char *provider, const char *address);
/*! \brief Find devicestate as text message for output */
-const char *devstate2str(int devstate)
+const char *devstate2str(enum ast_device_state devstate)
{
return devstatestring[devstate];
}
@@ -367,3 +367,116 @@
return 0;
}
+
+void ast_devstate_aggregate_init(struct ast_devstate_aggregate *agg)
+{
+ memset(agg, 0, sizeof(*agg));
+ agg->all_unknown = 1;
+ agg->all_unavail = 1;
+ agg->all_busy = 1;
+ agg->all_free = 1;
+}
+
[... 1299 lines stripped ...]
More information about the asterisk-commits
mailing list