[asterisk-commits] murf: branch murf/AEL2-1.2 r47909 - in
/team/murf/AEL2-1.2: ./ apps/ cdr/ cha...
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Tue Nov 21 18:59:21 MST 2006
Author: murf
Date: Tue Nov 21 19:59:20 2006
New Revision: 47909
URL: http://svn.digium.com/view/asterisk?view=rev&rev=47909
Log:
Merged revisions 47238,47248,47274,47307-47308,47359,47379,47452,47458,47470,47496,47522,47525,47549,47571,47580,47583,47596,47631,47648,47655,47666,47677,47682,47686,47688-47689,47696,47705,47711,47743,47750,47761,47776,47780,47802,47842,47855,47859,47862 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2
........
r47238 | russell | 2006-11-06 18:22:58 -0700 (Mon, 06 Nov 2006) | 5 lines
If random order is enabled for files mode music on hold, set a random initial
position, instead of always starting at the first file, and doing the random
operation only when switching to the next file.
(bug reported by John Lange on the asterisk-dev mailing list)
........
r47248 | oej | 2006-11-07 06:02:30 -0700 (Tue, 07 Nov 2006) | 2 lines
Don't ever reply to an ACK. (Issue 8265)
........
r47274 | murf | 2006-11-07 11:22:01 -0700 (Tue, 07 Nov 2006) | 1 line
This mod for bug_7506, to make the manager code output the proper event
........
r47307 | oej | 2006-11-08 00:31:34 -0700 (Wed, 08 Nov 2006) | 2 lines
Remove dialog properly at unload of module (rizzo)
........
r47308 | oej | 2006-11-08 00:40:38 -0700 (Wed, 08 Nov 2006) | 2 lines
Destroy the proper dialog...
........
r47359 | crichter | 2006-11-09 06:09:10 -0700 (Thu, 09 Nov 2006) | 1 line
Fixed segfault when no misdn.conf exists, reported by Igor Neves, thanks.
........
r47379 | file | 2006-11-09 09:48:05 -0700 (Thu, 09 Nov 2006) | 2 lines
Don't include compiler.h on kernels 2.6.18 and higher as, well, it's apparently going to be removed. This should make all you FC6 fans happy as your Asterisk will now build without any mods.
........
r47452 | oej | 2006-11-10 11:50:08 -0700 (Fri, 10 Nov 2006) | 2 lines
Fix multipart/mixed SDP support (issue 8010, alphaque)
........
r47458 | oej | 2006-11-10 12:37:41 -0700 (Fri, 10 Nov 2006) | 3 lines
- Don't check for ignore in blocks that isn't reached if ignore is on...
- return properly after sending reply in handle_request_invite
........
r47470 | oej | 2006-11-10 13:46:25 -0700 (Fri, 10 Nov 2006) | 2 lines
Clear dialog on loop (backport from 1.4 by mistake)
........
r47496 | russell | 2006-11-11 23:09:03 -0700 (Sat, 11 Nov 2006) | 4 lines
Only do the check to determine whether the channel calling this function is an
IAX2 channel when getting the IP address using the special argument,
CURRENTCHANNEL. (issue #8341, jcovert)
........
r47522 | tilghman | 2006-11-12 17:34:44 -0700 (Sun, 12 Nov 2006) | 2 lines
Don't play dialtone if the seizing the channel fails (Bug 7754)
........
r47525 | tilghman | 2006-11-12 22:45:11 -0700 (Sun, 12 Nov 2006) | 2 lines
If the execute fails a second time, make sure that we don't pass back a stale handle
........
r47549 | file | 2006-11-13 10:05:32 -0700 (Mon, 13 Nov 2006) | 2 lines
When sending an SMS with a user data header properly set the UDH flag in the first byte. (issue #8347 reported by hoffmeis)
........
r47571 | oej | 2006-11-13 12:04:39 -0700 (Mon, 13 Nov 2006) | 3 lines
Don't send 487 if we've already sent 200 OK on invite at time of receiving a BYE in the same transaction.
(SIPP testing)
........
r47580 | tilghman | 2006-11-13 13:18:30 -0700 (Mon, 13 Nov 2006) | 2 lines
Having more than 255 old messages caused corruption in the new/old count
........
r47583 | file | 2006-11-13 14:26:36 -0700 (Mon, 13 Nov 2006) | 2 lines
Initialize global pointers for connection and result to NULL. (issue #8356 reported by james)
........
r47596 | oej | 2006-11-14 04:06:31 -0700 (Tue, 14 Nov 2006) | 4 lines
Avoid collissions between the peerpoke system and the retransmits. Issue #8272.
In some cases, changed timers caused the retransmit system to destroy the dialog before peerpoke_expire
got a chance.
........
r47631 | file | 2006-11-14 15:15:10 -0700 (Tue, 14 Nov 2006) | 2 lines
Update copyright information in the ADSI logo blob.
........
r47648 | oej | 2006-11-15 06:08:34 -0700 (Wed, 15 Nov 2006) | 2 lines
Sending 200 OK and not getting ACK is considered critical for the call.
........
r47655 | oej | 2006-11-15 08:17:10 -0700 (Wed, 15 Nov 2006) | 5 lines
Send error message if we fail to allocate sip socket, possibly caused by too few
file handles (wasn't possible before, but with the new way of sending temp messages, it is).
Found this bug under heavy load testing with SIPP.
........
r47666 | kpfleming | 2006-11-15 10:07:53 -0700 (Wed, 15 Nov 2006) | 2 lines
ignore this generated file
........
r47677 | kpfleming | 2006-11-15 10:56:42 -0700 (Wed, 15 Nov 2006) | 4 lines
ensure that message duration is included in email notifications for forwarded messages (BE-96, fix by me after corydon used his clue-bat on me)
ensure that duration in the message metadata is updated if prepending is done during forwarding (related to BE-96)
remove prototype for API call that does not exist
........
r47682 | kpfleming | 2006-11-15 11:39:47 -0700 (Wed, 15 Nov 2006) | 2 lines
ouch... don't use printf, use ast_log/ast_verbose
........
r47686 | kpfleming | 2006-11-15 12:42:05 -0700 (Wed, 15 Nov 2006) | 2 lines
clear the category's variable tail pointer as well when variables are detached from it
........
r47688 | kpfleming | 2006-11-15 12:47:43 -0700 (Wed, 15 Nov 2006) | 2 lines
when appending a list of variable to a category, ensure the tail pointer points to the last variable in the list
........
r47689 | kpfleming | 2006-11-15 12:58:46 -0700 (Wed, 15 Nov 2006) | 2 lines
when re-writing the config file, don't repeat the path if it hasn't changed
........
r47696 | kpfleming | 2006-11-15 13:30:29 -0700 (Wed, 15 Nov 2006) | 2 lines
correct argument name typo that caused global variable to be used instead of the one for the specified voicemail user
........
r47705 | oej | 2006-11-15 14:18:47 -0700 (Wed, 15 Nov 2006) | 2 lines
CANCEL requests are never authenticated (according to RFC 3261)
........
r47711 | file | 2006-11-15 15:29:30 -0700 (Wed, 15 Nov 2006) | 2 lines
Make sure that the pvt structure exists before trying to do fixup on Local channels. (issue #7937 reported by mada123, fix by alamantia with mods by me)
........
r47743 | oej | 2006-11-16 09:44:56 -0700 (Thu, 16 Nov 2006) | 5 lines
Don't fixup if we haven't got PVT. Suggestion from Martin Vit on -dev mailing list inspired
by file's commit to chan_local.
"This shouldn't happen" ;-)
........
r47750 | file | 2006-11-16 11:26:50 -0700 (Thu, 16 Nov 2006) | 2 lines
Because of the way chan_local is written we should be extra careful and make sure our callback functions have a tech_pvt. (issue #8275 reported by mflorell)
........
r47761 | file | 2006-11-16 13:29:28 -0700 (Thu, 16 Nov 2006) | 2 lines
Look for the header file specifically in all cases, not just the existence of the directory. (issue #8358 reported by mrness)
........
r47776 | kpfleming | 2006-11-16 15:57:31 -0700 (Thu, 16 Nov 2006) | 2 lines
update clearly wrong documentation regarding cdr_custom
........
r47780 | qwell | 2006-11-16 16:16:35 -0700 (Thu, 16 Nov 2006) | 2 lines
Fix a couple of typos in applications.. Initially spotted by mrobinson.
........
r47802 | kpfleming | 2006-11-17 12:02:09 -0700 (Fri, 17 Nov 2006) | 2 lines
backport proper channel_find_locked behavior from 1.4 branch (noted by Steve Davies on asterisk-dev list)
........
r47842 | oej | 2006-11-20 03:17:36 -0700 (Mon, 20 Nov 2006) | 2 lines
Just to be safe, disable all the scheduled items after deleting a scheduler entry (rizzo)
........
r47855 | file | 2006-11-20 09:16:22 -0700 (Mon, 20 Nov 2006) | 2 lines
Free history items at the end of use of the temporary SIP pvt structure. (issue #8383 reported by benh)
........
r47859 | file | 2006-11-20 12:50:21 -0700 (Mon, 20 Nov 2006) | 2 lines
Don't forget to byte swap if we are exiting the smoother feed early. (issue #8287 reported by arturs)
........
r47862 | tilghman | 2006-11-20 12:59:07 -0700 (Mon, 20 Nov 2006) | 2 lines
Failing to trap -1 error from mmap causes segfault (Issue 8385)
........
Modified:
team/murf/AEL2-1.2/ (props changed)
team/murf/AEL2-1.2/apps/app_cut.c
team/murf/AEL2-1.2/apps/app_db.c
team/murf/AEL2-1.2/apps/app_dial.c
team/murf/AEL2-1.2/apps/app_directory.c
team/murf/AEL2-1.2/apps/app_sms.c
team/murf/AEL2-1.2/apps/app_voicemail.c
team/murf/AEL2-1.2/cdr/Makefile
team/murf/AEL2-1.2/cdr/cdr_pgsql.c
team/murf/AEL2-1.2/channel.c
team/murf/AEL2-1.2/channels/chan_iax2.c
team/murf/AEL2-1.2/channels/chan_local.c
team/murf/AEL2-1.2/channels/chan_misdn.c
team/murf/AEL2-1.2/channels/chan_phone.c
team/murf/AEL2-1.2/channels/chan_sip.c
team/murf/AEL2-1.2/channels/chan_zap.c
team/murf/AEL2-1.2/channels/misdn/ (props changed)
team/murf/AEL2-1.2/channels/misdn/chan_misdn_config.h
team/murf/AEL2-1.2/channels/misdn_config.c
team/murf/AEL2-1.2/config.c
team/murf/AEL2-1.2/doc/README.cdr
team/murf/AEL2-1.2/frame.c
team/murf/AEL2-1.2/include/asterisk/channel.h
team/murf/AEL2-1.2/include/asterisk/config.h
team/murf/AEL2-1.2/res/res_musiconhold.c
team/murf/AEL2-1.2/res/res_odbc.c
Propchange: team/murf/AEL2-1.2/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Tue Nov 21 19:59:20 2006
@@ -1,1 +1,1 @@
-/branches/1.2:1-46972
+/branches/1.2:1-47908
Modified: team/murf/AEL2-1.2/apps/app_cut.c
URL: http://svn.digium.com/view/asterisk/team/murf/AEL2-1.2/apps/app_cut.c?view=diff&rev=47909&r1=47908&r2=47909
==============================================================================
--- team/murf/AEL2-1.2/apps/app_cut.c (original)
+++ team/murf/AEL2-1.2/apps/app_cut.c Tue Nov 21 19:59:20 2006
@@ -48,7 +48,7 @@
static char *cut_synopsis = "Splits a variable's contents using the specified delimiter";
static char *cut_descrip =
-" Cut(newvar=varname,delimiter,fieldspec): This applicaiton will split the\n"
+" Cut(newvar=varname,delimiter,fieldspec): This application will split the\n"
"contents of a variable based on the given delimeter and store the result in\n"
"a new variable.\n"
"Parameters:\n"
@@ -66,7 +66,7 @@
" Sort(newvar=key1:val1[,key2:val2[[...],keyN:valN]]): This application will\n"
"sort the list provided in ascending order. The result will be stored in the\n"
"specified variable name.\n"
-" This applicaiton has been deprecated in favor of the SORT function.\n";
+" This application has been deprecated in favor of the SORT function.\n";
STANDARD_LOCAL_USER;
Modified: team/murf/AEL2-1.2/apps/app_db.c
URL: http://svn.digium.com/view/asterisk/team/murf/AEL2-1.2/apps/app_db.c?view=diff&rev=47909&r1=47908&r2=47909
==============================================================================
--- team/murf/AEL2-1.2/apps/app_db.c (original)
+++ team/murf/AEL2-1.2/apps/app_db.c Tue Nov 21 19:59:20 2006
@@ -63,7 +63,7 @@
" This application has been deprecated in favor of the DB function.\n";
static char *d_descrip =
-" DBdel(family/key): This applicaiton will delete a key from the Asterisk\n"
+" DBdel(family/key): This application will delete a key from the Asterisk\n"
"database.\n";
static char *dt_descrip =
Modified: team/murf/AEL2-1.2/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/team/murf/AEL2-1.2/apps/app_dial.c?view=diff&rev=47909&r1=47908&r2=47909
==============================================================================
--- team/murf/AEL2-1.2/apps/app_dial.c (original)
+++ team/murf/AEL2-1.2/apps/app_dial.c Tue Nov 21 19:59:20 2006
@@ -65,7 +65,7 @@
static char *descrip =
" Dial(Technology/resource[&Tech2/resource2...][|timeout][|options][|URL]):\n"
-"This applicaiton will place calls to one or more specified channels. As soon\n"
+"This application will place calls to one or more specified channels. As soon\n"
"as one of the requested channels answers, the originating channel will be\n"
"answered, if it has not already been answered. These two channels will then\n"
"be active in a bridged call. All other channels that were requested will then\n"
Modified: team/murf/AEL2-1.2/apps/app_directory.c
URL: http://svn.digium.com/view/asterisk/team/murf/AEL2-1.2/apps/app_directory.c?view=diff&rev=47909&r1=47908&r2=47909
==============================================================================
--- team/murf/AEL2-1.2/apps/app_directory.c (original)
+++ team/murf/AEL2-1.2/apps/app_directory.c Tue Nov 21 19:59:20 2006
@@ -61,7 +61,7 @@
"the calling channel with a directory of extensions from which they can search\n"
"by name. The list of names and corresponding extensions is retrieved from the\n"
"voicemail configuration file, voicemail.conf.\n"
-" This applicaiton will immediate exit if one of the following DTMF digits are\n"
+" This application will immediately exit if one of the following DTMF digits are\n"
"received and the extension to jump to exists:\n"
" 0 - Jump to the 'o' extension, if it exists.\n"
" * - Jump to the 'a' extension, if it exists.\n\n"
Modified: team/murf/AEL2-1.2/apps/app_sms.c
URL: http://svn.digium.com/view/asterisk/team/murf/AEL2-1.2/apps/app_sms.c?view=diff&rev=47909&r1=47908&r2=47909
==============================================================================
--- team/murf/AEL2-1.2/apps/app_sms.c (original)
+++ team/murf/AEL2-1.2/apps/app_sms.c Tue Nov 21 19:59:20 2006
@@ -1050,7 +1050,7 @@
unsigned char p = 2;
h->omsg[0] = 0x91; /* SMS_DATA */
if (h->smsc) { /* deliver */
- h->omsg[p++] = (more ? 4 : 0);
+ h->omsg[p++] = (more ? 4 : 0) + ((h->udhl > 0) ? 0x40 : 0);
p += packaddress (h->omsg + p, h->oa);
h->omsg[p++] = h->pid;
h->omsg[p++] = h->dcs;
Modified: team/murf/AEL2-1.2/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/murf/AEL2-1.2/apps/app_voicemail.c?view=diff&rev=47909&r1=47908&r2=47909
==============================================================================
--- team/murf/AEL2-1.2/apps/app_voicemail.c (original)
+++ team/murf/AEL2-1.2/apps/app_voicemail.c Tue Nov 21 19:59:20 2006
@@ -935,8 +935,13 @@
fd = -1;
continue;
}
- if (fd > -1)
- fdm = mmap(NULL, fdlen, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
+ if (fd > -1) {
+ if ((fdm = mmap(NULL, fdlen, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0)) == -1) {
+ ast_log(LOG_WARNING, "Could not mmap the output file: %s (%d)\n", strerror(errno), errno);
+ SQLFreeHandle(SQL_HANDLE_STMT, stmt);
+ goto yuck;
+ }
+ }
}
if (fdm) {
memset(fdm, 0, fdlen);
@@ -2749,7 +2754,7 @@
{
int bytes = 0;
bytes += adsi_display(buf + bytes, ADSI_COMM_PAGE, 1, ADSI_JUST_CENT, 0, "Comedian Mail", "");
- bytes += adsi_display(buf + bytes, ADSI_COMM_PAGE, 2, ADSI_JUST_CENT, 0, "(C)2002 LSS, Inc.", "");
+ bytes += adsi_display(buf + bytes, ADSI_COMM_PAGE, 2, ADSI_JUST_CENT, 0, "(C)2002-2006 Digium, Inc.", "");
return bytes;
}
@@ -3277,12 +3282,11 @@
return res;
}
-static int vm_forwardoptions(struct ast_channel *chan, struct ast_vm_user *vmu, char *curdir, int curmsg, char *vmfts,
- char *context, signed char record_gain)
+static int vm_forwardoptions(struct ast_channel *chan, struct ast_vm_user *vmu, char *curdir, int curmsg, char *vmfmts,
+ char *context, signed char record_gain, long *duration)
{
int cmd = 0;
int retries = 0;
- int duration = 0;
signed char zero_gain = 0;
while ((cmd >= 0) && (cmd != 't') && (cmd != '*')) {
@@ -3290,15 +3294,66 @@
retries = 0;
switch (cmd) {
case '1':
- /* prepend a message to the current message and return */
+ /* prepend a message to the current message, update the metadata and return */
{
- char file[200];
- snprintf(file, sizeof(file), "%s/msg%04d", curdir, curmsg);
+ char msgfile[PATH_MAX];
+ char textfile[PATH_MAX];
+ int prepend_duration = 0;
+ struct ast_config *msg_cfg;
+ char *duration_str;
+
+ make_file(msgfile, sizeof(msgfile), curdir, curmsg);
+ strcpy(textfile, msgfile);
+ strncat(textfile, ".txt", sizeof(textfile) - 1);
+ *duration = 0;
+
+ /* if we can't read the message metadata, stop now */
+ if (!(msg_cfg = ast_config_load(textfile))) {
+ cmd = 0;
+ break;
+ }
+
if (record_gain)
ast_channel_setoption(chan, AST_OPTION_RXGAIN, &record_gain, sizeof(record_gain), 0);
- cmd = ast_play_and_prepend(chan, NULL, file, 0, vmfmts, &duration, 1, silencethreshold, maxsilence);
+
+ cmd = ast_play_and_prepend(chan, NULL, msgfile, 0, vmfmts, &prepend_duration, 1, silencethreshold, maxsilence);
if (record_gain)
ast_channel_setoption(chan, AST_OPTION_RXGAIN, &zero_gain, sizeof(zero_gain), 0);
+
+
+ if ((duration_str = ast_variable_retrieve(msg_cfg, "message", "duration")))
+ *duration = atoi(duration_str);
+
+ if (prepend_duration) {
+ struct ast_variable *var, *prev = NULL, *varlist;
+ struct ast_category *msg_cat;
+
+ *duration += prepend_duration;
+ msg_cat = ast_category_get(msg_cfg, "message");
+ varlist = ast_category_detach_variables(msg_cat);
+ for (var = varlist; var; prev = var, var = var->next) {
+ if (!strcmp(var->name, "duration")) {
+ if (!prev)
+ varlist = var->next;
+ else
+ prev->next = var->next;
+ free(var);
+ break;
+ }
+ }
+ /* need enough space for a maximum-length message duration */
+ duration_str = alloca(12);
+ snprintf(duration_str, 11, "%ld", *duration);
+ if ((var = ast_variable_new("duration", duration_str))) {
+ ast_variable_append(msg_cat, varlist);
+ ast_variable_append(msg_cat, var);
+ config_text_file_save(textfile, msg_cfg, "app_voicemail");
+ STORE(curdir, vmu->mailbox, context, curmsg);
+ }
+ }
+
+ ast_config_destroy(msg_cfg);
+
break;
}
case '2':
@@ -3509,11 +3564,13 @@
cmd = leave_voicemail(chan, mailbox, &leave_options);
} else {
/* Forward VoiceMail */
+ long duration = 0;
+
RETRIEVE(dir, curmsg);
- cmd = vm_forwardoptions(chan, sender, dir, curmsg, vmfmts, context, record_gain);
+ cmd = vm_forwardoptions(chan, sender, dir, curmsg, vmfmts, context, record_gain, &duration);
if (!cmd) {
while (!res && vmtmp) {
- copy_message(chan, sender, 0, curmsg, 0, vmtmp, fmt);
+ copy_message(chan, sender, 0, curmsg, duration, vmtmp, fmt);
saved_messages++;
vmfree = vmtmp;
Modified: team/murf/AEL2-1.2/cdr/Makefile
URL: http://svn.digium.com/view/asterisk/team/murf/AEL2-1.2/cdr/Makefile?view=diff&rev=47909&r1=47908&r2=47909
==============================================================================
--- team/murf/AEL2-1.2/cdr/Makefile (original)
+++ team/murf/AEL2-1.2/cdr/Makefile Tue Nov 21 19:59:20 2006
@@ -65,7 +65,7 @@
#
# PGSQL stuff... Autoconf anyone??
#
-ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/postgresql)$(wildcard $(CROSS_COMPILE_TARGET)/usr/local/pgsql/include)$(wildcard $(CROSS_COMPILE_TARGET)/usr/include/pgsql)$(wildcard $(CROSS_COMPILE_TARGET)/usr/local/include/pgsql)$(wildcard $(CROSS_COMPILE_TARGET)/opt/pgsql/include)$(wildcard $(CROSS_COMPILE_TARGET)/usr/include/libpq-fe.h),)
+ifneq ($(wildcard $(CROSS_COMPILE_TARGET)/usr/include/postgresql/libpq-fe.h)$(wildcard $(CROSS_COMPILE_TARGET)/usr/local/pgsql/include/libpq-fe.h)$(wildcard $(CROSS_COMPILE_TARGET)/usr/include/pgsql/libpq-fe.h)$(wildcard $(CROSS_COMPILE_TARGET)/usr/local/include/pgsql/libpq-fe.h)$(wildcard $(CROSS_COMPILE_TARGET)/opt/pgsql/include/libpq-fe.h)$(wildcard $(CROSS_COMPILE_TARGET)/usr/include/libpq-fe.h),)
MODS+=cdr_pgsql.so
endif
Modified: team/murf/AEL2-1.2/cdr/cdr_pgsql.c
URL: http://svn.digium.com/view/asterisk/team/murf/AEL2-1.2/cdr/cdr_pgsql.c?view=diff&rev=47909&r1=47908&r2=47909
==============================================================================
--- team/murf/AEL2-1.2/cdr/cdr_pgsql.c (original)
+++ team/murf/AEL2-1.2/cdr/cdr_pgsql.c Tue Nov 21 19:59:20 2006
@@ -64,8 +64,8 @@
AST_MUTEX_DEFINE_STATIC(pgsql_lock);
-PGconn *conn;
-PGresult *result;
+PGconn *conn = NULL;
+PGresult *result = NULL;
static int pgsql_log(struct ast_cdr *cdr)
{
Modified: team/murf/AEL2-1.2/channel.c
URL: http://svn.digium.com/view/asterisk/team/murf/AEL2-1.2/channel.c?view=diff&rev=47909&r1=47908&r2=47909
==============================================================================
--- team/murf/AEL2-1.2/channel.c (original)
+++ team/murf/AEL2-1.2/channel.c Tue Nov 21 19:59:20 2006
@@ -732,43 +732,34 @@
const char *context, const char *exten)
{
const char *msg = prev ? "deadlock" : "initial deadlock";
- int retries, done;
+ int retries;
struct ast_channel *c;
for (retries = 0; retries < 10; retries++) {
+ int done;
+
ast_mutex_lock(&chlock);
for (c = channels; c; c = c->next) {
- if (!prev) {
- /* want head of list */
- if (!name && !exten)
- break;
- if (name) {
- /* want match by full name */
- if (!namelen) {
- if (!strcasecmp(c->name, name))
- break;
- else
- continue;
- }
- /* want match by name prefix */
- if (!strncasecmp(c->name, name, namelen))
- break;
- } else if (exten) {
- /* want match by context and exten */
- if (context && (strcasecmp(c->context, context) &&
- strcasecmp(c->macrocontext, context)))
- continue;
- /* match by exten */
- if (strcasecmp(c->exten, exten) &&
- strcasecmp(c->macroexten, exten))
- continue;
- else
- break;
- }
- } else if (c == prev) { /* found, return c->next */
+ if (prev) { /* look for next item */
+ if (c != prev) /* not this one */
+ continue;
+ /* found, prepare to return c->next */
c = c->next;
- break;
}
+ if (name) { /* want match by name */
+ if ((!namelen && strcasecmp(c->name, name)) ||
+ (namelen && strncasecmp(c->name, name, namelen)))
+ continue; /* name match failed */
+ } else if (exten) {
+ if (context && strcasecmp(c->context, context) &&
+ strcasecmp(c->macrocontext, context))
+ continue; /* context match failed */
+ if (strcasecmp(c->exten, exten) &&
+ strcasecmp(c->macroexten, exten))
+ continue; /* exten match failed */
+ }
+ /* if we get here, c points to the desired record */
+ break;
}
/* exit if chan not found or mutex acquired successfully */
done = (c == NULL) || (ast_mutex_trylock(&c->lock) == 0);
@@ -2590,6 +2581,7 @@
c->cid.cid_num ? c->cid.cid_num : "<unknown>",
c->cid.cid_name ? c->cid.cid_name : "<unknown>",
c->uniqueid);
+ ast_set_flag(c, AST_FLAG_NOTNEW);
}
return c;
}
@@ -3253,7 +3245,7 @@
chan->_state = state;
ast_device_state_changed_literal(chan->name);
manager_event(EVENT_FLAG_CALL,
- (oldstate == AST_STATE_DOWN) ? "Newchannel" : "Newstate",
+ (oldstate == AST_STATE_DOWN && !ast_test_flag(chan, AST_FLAG_NOTNEW)) ? "Newchannel" : "Newstate",
"Channel: %s\r\n"
"State: %s\r\n"
"CallerID: %s\r\n"
Modified: team/murf/AEL2-1.2/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/murf/AEL2-1.2/channels/chan_iax2.c?view=diff&rev=47909&r1=47908&r2=47909
==============================================================================
--- team/murf/AEL2-1.2/channels/chan_iax2.c (original)
+++ team/murf/AEL2-1.2/channels/chan_iax2.c Tue Nov 21 19:59:20 2006
@@ -9347,9 +9347,6 @@
buf[0] = '\0';
- if (chan->tech != &iax2_tech)
- return buf;
-
if (!(peername = ast_strdupa(data))) {
ast_log(LOG_ERROR, "Memory Error!\n");
return ret;
@@ -9357,7 +9354,10 @@
/* if our channel, return the IP address of the endpoint of current channel */
if (!strcmp(peername,"CURRENTCHANNEL")) {
- unsigned short callno = PTR_TO_CALLNO(chan->tech_pvt);
+ unsigned short callno;
+ if (chan->tech != &iax2_tech)
+ return buf;
+ callno = PTR_TO_CALLNO(chan->tech_pvt);
ast_copy_string(buf, iaxs[callno]->addr.sin_addr.s_addr ? ast_inet_ntoa(iabuf, sizeof(iabuf), iaxs[callno]->addr.sin_addr) : "", len);
return buf;
}
Modified: team/murf/AEL2-1.2/channels/chan_local.c
URL: http://svn.digium.com/view/asterisk/team/murf/AEL2-1.2/channels/chan_local.c?view=diff&rev=47909&r1=47908&r2=47909
==============================================================================
--- team/murf/AEL2-1.2/channels/chan_local.c (original)
+++ team/murf/AEL2-1.2/channels/chan_local.c Tue Nov 21 19:59:20 2006
@@ -167,6 +167,9 @@
struct local_pvt *p = ast->tech_pvt;
int isoutbound;
int res = -1;
+
+ if (!p)
+ return -1;
ast_mutex_lock(&p->lock);
isoutbound = IS_OUTBOUND(ast, p);
@@ -245,6 +248,9 @@
int res = -1;
int isoutbound;
+ if (!p)
+ return -1;
+
/* Just queue for delivery to the other side */
ast_mutex_lock(&p->lock);
isoutbound = IS_OUTBOUND(ast, p);
@@ -263,6 +269,10 @@
static int local_fixup(struct ast_channel *oldchan, struct ast_channel *newchan)
{
struct local_pvt *p = newchan->tech_pvt;
+
+ if (!p)
+ return -1;
+
ast_mutex_lock(&p->lock);
if ((p->owner != oldchan) && (p->chan != oldchan)) {
@@ -285,6 +295,9 @@
struct ast_frame f = { AST_FRAME_CONTROL, };
int isoutbound;
+ if (!p)
+ return -1;
+
/* Queue up a frame representing the indication as a control frame */
ast_mutex_lock(&p->lock);
isoutbound = IS_OUTBOUND(ast, p);
@@ -301,6 +314,9 @@
struct ast_frame f = { AST_FRAME_DTMF, };
int isoutbound;
+ if (!p)
+ return -1;
+
ast_mutex_lock(&p->lock);
isoutbound = IS_OUTBOUND(ast, p);
f.subclass = digit;
@@ -316,6 +332,9 @@
struct ast_frame f = { AST_FRAME_HTML, };
int isoutbound;
+ if (!p)
+ return -1;
+
ast_mutex_lock(&p->lock);
isoutbound = IS_OUTBOUND(ast, p);
f.subclass = subclass;
@@ -334,6 +353,9 @@
int res;
struct ast_var_t *varptr = NULL, *new;
size_t len, namelen;
+
+ if (!p)
+ return -1;
ast_mutex_lock(&p->lock);
@@ -409,6 +431,9 @@
struct local_pvt *cur, *prev=NULL;
struct ast_channel *ochan = NULL;
int glaredetect;
+
+ if (!p)
+ return -1;
ast_mutex_lock(&p->lock);
isoutbound = IS_OUTBOUND(ast, p);
Modified: team/murf/AEL2-1.2/channels/chan_misdn.c
URL: http://svn.digium.com/view/asterisk/team/murf/AEL2-1.2/channels/chan_misdn.c?view=diff&rev=47909&r1=47908&r2=47909
==============================================================================
--- team/murf/AEL2-1.2/channels/chan_misdn.c (original)
+++ team/murf/AEL2-1.2/channels/chan_misdn.c Tue Nov 21 19:59:20 2006
@@ -4121,8 +4121,11 @@
return 0;
}
-
- misdn_cfg_init(max_ports);
+ if (misdn_cfg_init(max_ports)<0) {
+ ast_log(LOG_ERROR, "Unable to initialize mISDN Config System\n");
+ return 0;
+ }
+
g_config_initialized=1;
misdn_debug = (int *)malloc(sizeof(int) * (max_ports+1));
Modified: team/murf/AEL2-1.2/channels/chan_phone.c
URL: http://svn.digium.com/view/asterisk/team/murf/AEL2-1.2/channels/chan_phone.c?view=diff&rev=47909&r1=47908&r2=47909
==============================================================================
--- team/murf/AEL2-1.2/channels/chan_phone.c (original)
+++ team/murf/AEL2-1.2/channels/chan_phone.c Tue Nov 21 19:59:20 2006
@@ -38,7 +38,9 @@
/* Still use some IXJ specific stuff */
#include <linux/version.h>
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)
# include <linux/compiler.h>
+#endif
#endif
#include <linux/ixjuser.h>
Modified: team/murf/AEL2-1.2/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/murf/AEL2-1.2/channels/chan_sip.c?view=diff&rev=47909&r1=47908&r2=47909
==============================================================================
--- team/murf/AEL2-1.2/channels/chan_sip.c (original)
+++ team/murf/AEL2-1.2/channels/chan_sip.c Tue Nov 21 19:59:20 2006
@@ -1246,7 +1246,9 @@
ast_mutex_unlock(&pkt->owner->owner->lock);
} else {
/* If no channel owner, destroy now */
- ast_set_flag(pkt->owner, SIP_NEEDDESTROY);
+ /* Let the peerpoke system expire packets when the timer expires for poke_noanswer */
+ if (pkt->method != SIP_OPTIONS)
+ ast_set_flag(pkt->owner, SIP_NEEDDESTROY);
}
}
/* In any case, go ahead and remove the packet */
@@ -1399,6 +1401,7 @@
if (sipdebug && option_debug > 3)
ast_log(LOG_DEBUG, "** SIP TIMER: Cancelling retransmit of packet (reply received) Retransid #%d\n", cur->retransid);
ast_sched_del(sched, cur->retransid);
+ cur->retransid = -1;
}
free(cur);
res = 0;
@@ -1454,8 +1457,8 @@
if (option_debug > 3 && sipdebug)
ast_log(LOG_DEBUG, "*** SIP TIMER: Cancelling retransmission #%d - %s (got response)\n", cur->retransid, msg);
ast_sched_del(sched, cur->retransid);
+ cur->retransid = -1;
}
- cur->retransid = -1;
res = 0;
break;
}
@@ -1654,6 +1657,7 @@
}
if (peer->expire > -1)
ast_sched_del(sched, peer->expire);
+
if (peer->pokeexpire > -1)
ast_sched_del(sched, peer->pokeexpire);
register_peer_exten(peer, 0);
@@ -2480,7 +2484,7 @@
/* Do we need a timer here if we don't hear from them at all? */
} else {
/* Send a new request: CANCEL */
- transmit_request_with_auth(p, SIP_CANCEL, p->ocseq, 1, 0);
+ transmit_request(p, SIP_CANCEL, p->ocseq, 1, 0);
/* Actually don't destroy us yet, wait for the 487 on our original
INVITE, but do set an autodestruct just in case we never get it. */
}
@@ -2554,7 +2558,7 @@
ast_setstate(ast, AST_STATE_UP);
if (option_debug)
ast_log(LOG_DEBUG, "sip_answer(%s)\n", ast->name);
- res = transmit_response_with_sdp(p, "200 OK", &p->initreq, 1);
+ res = transmit_response_with_sdp(p, "200 OK", &p->initreq, 2);
}
ast_mutex_unlock(&p->lock);
return res;
@@ -2617,6 +2621,11 @@
static int sip_fixup(struct ast_channel *oldchan, struct ast_channel *newchan)
{
struct sip_pvt *p = newchan->tech_pvt;
+ if (!p) {
+ ast_log(LOG_WARNING, "No pvt after masquerade. Strange things may happen\n");
+ return -1;
+ }
+
ast_mutex_lock(&p->lock);
if (p->owner != oldchan) {
ast_log(LOG_WARNING, "old channel wasn't %p but was %p\n", oldchan, p->owner);
@@ -3240,9 +3249,10 @@
ast_mutex_unlock(&iflock);
/* If this is a response and we have ignoring of out of dialog responses turned on, then drop it */
+ /* ...and never respond to a SIP ACK message */
if (!sip_methods[intended_method].can_create) {
/* Can't create dialog */
- if (intended_method != SIP_RESPONSE)
+ if (intended_method != SIP_RESPONSE && intended_method != SIP_ACK)
transmit_response_using_temp(callid, sin, 1, intended_method, req, "481 Call leg/transaction does not exist");
} else if (sip_methods[intended_method].can_create == 2) {
char *response = "481 Call leg/transaction does not exist";
@@ -3260,6 +3270,19 @@
p = sip_alloc(callid, sin, 1, intended_method);
if (p)
ast_mutex_lock(&p->lock);
+ else {
+ /* We have a memory or file/socket error (can't allocate RTP sockets or something) so we're not
+ getting a dialog from sip_alloc.
+
+ Without a dialog we can't retransmit and handle ACKs and all that, but at least
+ send an error message.
+
+ Sorry, we apologize for the inconvienience
+ */
+ transmit_response_using_temp(callid, sin, 1, intended_method, req, "500 Server internal error");
+ if (option_debug > 3)
+ ast_log(LOG_DEBUG, "Failed allocating SIP dialog, sending 500 Server internal error and giving up\n");
+ }
}
return p;
@@ -3503,7 +3526,9 @@
for (x = 0; x < (req->lines - 2); x++) {
if (!strncasecmp(req->line[x], boundary, strlen(boundary)) &&
!strcasecmp(req->line[x + 1], "Content-Type: application/sdp")) {
- req->sdp_start = x + 2;
+ x += 2;
+ req->sdp_start = x;
+
/* search for the end of the body part */
for ( ; x < req->lines; x++) {
if (!strncasecmp(req->line[x], boundary, strlen(boundary)))
@@ -4272,6 +4297,7 @@
static int transmit_response_using_temp(char *callid, struct sockaddr_in *sin, int useglobal_nat, const int intended_method, struct sip_request *req, char *msg)
{
struct sip_pvt *p = alloca(sizeof(*p));
+ struct sip_history *hist = NULL;
memset(p, 0, sizeof(*p));
@@ -4296,6 +4322,11 @@
ast_copy_string(p->callid, callid, sizeof(p->callid));
__transmit_response(p, msg, req, 0);
+
+ while ((hist = p->history)) {
+ p->history = p->history->next;
+ free(hist);
+ }
return 0;
}
@@ -6078,8 +6109,10 @@
else
p->username[0] = '\0';
- if (p->expire > -1)
+ if (p->expire > -1) {
ast_sched_del(sched, p->expire);
+ p->expire = -1;
+ }
if ((expiry < 1) || (expiry > max_expiry))
expiry = max_expiry;
if (!ast_test_flag(p, SIP_REALTIME))
@@ -8130,7 +8163,7 @@
print_group(fd, peer->pickupgroup, 0);
ast_cli(fd, " Mailbox : %s\n", peer->mailbox);
ast_cli(fd, " VM Extension : %s\n", peer->vmexten);
- ast_cli(fd, " LastMsgsSent : %d\n", peer->lastmsgssent);
+ ast_cli(fd, " LastMsgsSent : %d/%d\n", (peer->lastmsgssent & 0x7fff0000) >> 16, peer->lastmsgssent & 0xffff);
ast_cli(fd, " Call limit : %d\n", peer->call_limit);
ast_cli(fd, " Dynamic : %s\n", (ast_test_flag(&peer->flags_page2, SIP_PAGE2_DYNAMIC)?"Yes":"No"));
ast_cli(fd, " Callerid : %s\n", ast_callerid_merge(cbuf, sizeof(cbuf), peer->cid_name, peer->cid_num, "<unspecified>"));
@@ -9631,7 +9664,7 @@
if (ast_test_flag(p, SIP_PENDINGBYE)) {
/* if we can't BYE, then this is really a pending CANCEL */
if (!ast_test_flag(p, SIP_CAN_BYE))
- transmit_request_with_auth(p, SIP_CANCEL, p->ocseq, 1, 0);
+ transmit_request(p, SIP_CANCEL, p->ocseq, 1, 0);
/* Actually don't destroy us yet, wait for the 487 on our original
INVITE, but do set an autodestruct just in case we never get it. */
else
@@ -9823,6 +9856,7 @@
if (global_regattempts_max)
p->registry->regattempts = global_regattempts_max+1;
ast_sched_del(sched, r->timeout);
+ r->timeout = -1;
ast_set_flag(p, SIP_NEEDDESTROY);
break;
case 404: /* Not found */
@@ -9832,6 +9866,7 @@
ast_set_flag(p, SIP_NEEDDESTROY);
r->call = NULL;
ast_sched_del(sched, r->timeout);
+ r->timeout = -1;
break;
case 407: /* Proxy auth */
if ((p->authtries == MAX_AUTHTRIES) || do_register_auth(p, req, "Proxy-Authenticate", "Proxy-Authorization")) {
@@ -9846,6 +9881,7 @@
ast_set_flag(p, SIP_NEEDDESTROY);
r->call = NULL;
ast_sched_del(sched, r->timeout);
+ r->timeout = -1;
break;
case 200: /* 200 OK */
if (!r) {
@@ -9965,7 +10001,7 @@
ast_sched_del(sched, peer->pokeexpire);
if (sipmethod == SIP_INVITE) /* Does this really happen? */
transmit_request(p, SIP_ACK, seqno, 0, 0);
- ast_set_flag(p, SIP_NEEDDESTROY);
+ ast_set_flag(p, SIP_NEEDDESTROY);
/* Try again eventually */
if ((peer->lastms < 0) || (peer->lastms > peer->maxms))
@@ -10515,8 +10551,9 @@
/* This is a call to ourself. Send ourselves an error code and stop
processing immediately, as SIP really has no good mechanism for
being able to call yourself */
- transmit_response(p, "482 Loop Detected", req);
- /* We do NOT destroy p here, so that our response will be accepted */
+ transmit_response_reliable(p, "482 Loop Detected", req, 1);
+ if (!p->lastinvite)
+ ast_set_flag(p, SIP_NEEDDESTROY);
return 0;
}
if (!ignore) {
@@ -10558,10 +10595,7 @@
transmit_fake_auth_response(p, req, p->randdata, sizeof(p->randdata), 1);
} else {
ast_log(LOG_NOTICE, "Failed to authenticate user %s\n", get_header(req, "From"));
- if (ignore)
- transmit_response(p, "403 Forbidden", req);
- else
- transmit_response_reliable(p, "403 Forbidden", req, 1);
+ transmit_response_reliable(p, "403 Forbidden", req, 1);
}
ast_set_flag(p, SIP_NEEDDESTROY);
p->theirtag[0] = '\0'; /* Forget their to-tag, we'll get a new one */
@@ -10590,10 +10624,7 @@
if (res) {
if (res < 0) {
ast_log(LOG_NOTICE, "Failed to place call for user %s, too many calls\n", p->username);
- if (ignore)
- transmit_response(p, "480 Temporarily Unavailable (Call limit)", req);
- else
- transmit_response_reliable(p, "480 Temporarily Unavailable (Call limit) ", req, 1);
+ transmit_response_reliable(p, "480 Temporarily Unavailable (Call limit) ", req, 1);
ast_set_flag(p, SIP_NEEDDESTROY);
}
return 0;
@@ -10606,20 +10637,13 @@
build_contact(p);
if (gotdest) {
- if (gotdest < 0) {
- if (ignore)
- transmit_response(p, "404 Not Found", req);
- else
- transmit_response_reliable(p, "404 Not Found", req, 1);
- update_call_counter(p, DEC_CALL_LIMIT);
- } else {
- if (ignore)
- transmit_response(p, "484 Address Incomplete", req);
- else
- transmit_response_reliable(p, "484 Address Incomplete", req, 1);
- update_call_counter(p, DEC_CALL_LIMIT);
- }
+ if (gotdest < 0)
+ transmit_response_reliable(p, "404 Not Found", req, 1);
+ else
+ transmit_response_reliable(p, "484 Address Incomplete", req, 1);
+ update_call_counter(p, DEC_CALL_LIMIT);
ast_set_flag(p, SIP_NEEDDESTROY);
+ return 0;
} else {
/* If no extension was specified, use the s one */
if (ast_strlen_zero(p->exten))
@@ -10725,19 +10749,12 @@
} else {
if (p && !ast_test_flag(p, SIP_NEEDDESTROY) && !ignore) {
if (!p->jointcapability) {
- if (ignore)
- transmit_response(p, "488 Not Acceptable Here (codec error)", req);
- else
- transmit_response_reliable(p, "488 Not Acceptable Here (codec error)", req, 1);
- ast_set_flag(p, SIP_NEEDDESTROY);
+ transmit_response_reliable(p, "488 Not Acceptable Here (codec error)", req, 1);
} else {
ast_log(LOG_NOTICE, "Unable to create/find channel\n");
- if (ignore)
- transmit_response(p, "503 Unavailable", req);
- else
- transmit_response_reliable(p, "503 Unavailable", req, 1);
- ast_set_flag(p, SIP_NEEDDESTROY);
+ transmit_response_reliable(p, "503 Unavailable", req, 1);
}
+ ast_set_flag(p, SIP_NEEDDESTROY);
}
}
return res;
@@ -10851,7 +10868,8 @@
struct ast_channel *bridged_to;
char iabuf[INET_ADDRSTRLEN];
- if (p->pendinginvite && !ast_test_flag(p, SIP_OUTGOING) && !ignore)
+ /* If we have an INCOMING invite that we haven't answered, terminate that transaction */
+ if (p->pendinginvite && !ast_test_flag(p, SIP_OUTGOING) && !ignore && !p->owner)
transmit_response_reliable(p, "487 Request Terminated", &p->initreq, 1);
copy_request(&p->initreq, req);
@@ -11466,7 +11484,7 @@
time(&peer->lastmsgcheck);
/* Return now if it's the same thing we told them last time */
- if (((newmsgs << 8) | (oldmsgs)) == peer->lastmsgssent) {
+ if (((newmsgs > 0x7fff ? 0x7fff0000 : (newmsgs << 16)) | (oldmsgs > 0xffff ? 0xffff : oldmsgs)) == peer->lastmsgssent) {
return 0;
}
@@ -11475,7 +11493,7 @@
ast_log(LOG_WARNING, "Unable to build sip pvt data for MWI\n");
return -1;
}
- peer->lastmsgssent = ((newmsgs << 8) | (oldmsgs));
+ peer->lastmsgssent = ((newmsgs > 0x7fff ? 0x7fff0000 : (newmsgs << 16)) | (oldmsgs > 0xffff ? 0xffff : oldmsgs));
if (create_addr_from_peer(p, peer)) {
/* Maybe they're not registered, etc. */
sip_destroy(p);
@@ -11706,7 +11724,7 @@
peer->call = NULL;
return 0;
}
- if (peer->call > 0) {
+ if (peer->call) {
if (sipdebug)
ast_log(LOG_NOTICE, "Still have a QUALIFY dialog active, deleting\n");
sip_destroy(peer->call);
@@ -13553,13 +13571,7 @@
while (p) {
pl = p;
p = p->next;
- /* Free associated memory */
- ast_mutex_destroy(&pl->lock);
- if (pl->chanvars) {
- ast_variables_destroy(pl->chanvars);
- pl->chanvars = NULL;
- }
- free(pl);
+ __sip_destroy(pl, 1);
}
iflist = NULL;
ast_mutex_unlock(&iflock);
Modified: team/murf/AEL2-1.2/channels/chan_zap.c
URL: http://svn.digium.com/view/asterisk/team/murf/AEL2-1.2/channels/chan_zap.c?view=diff&rev=47909&r1=47908&r2=47909
==============================================================================
[... 231 lines stripped ...]
More information about the asterisk-commits
mailing list