[asterisk-commits] russell: branch russell/iax2_osp r61701 - in /team/russell/iax2_osp: ./ apps/...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Fri Apr 20 14:01:35 MST 2007


Author: russell
Date: Fri Apr 20 16:01:34 2007
New Revision: 61701

URL: http://svn.digium.com/view/asterisk?view=rev&rev=61701
Log:
Merged revisions 61642,61646-61647,61649,61652,61657,61659-61661,61667,61671,61675,61677,61679,61682,61684,61689,61691,61695,61698 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

................
r61642 | file | 2007-04-13 11:35:33 -0500 (Fri, 13 Apr 2007) | 10 lines

Merged revisions 61641 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r61641 | file | 2007-04-13 12:32:03 -0400 (Fri, 13 Apr 2007) | 2 lines

Don't assume the callid of a dialog will be set, as in some circumstances it may not. (issue #9534 reported by tecnoxarxa)

........

................
r61646 | murf | 2007-04-13 12:11:53 -0500 (Fri, 13 Apr 2007) | 9 lines

Merged revisions 61644 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r61644 | murf | 2007-04-13 11:01:02 -0600 (Fri, 13 Apr 2007) | 1 line

A fix for chan_oss that resulted from the CDR changes; it helps to use the right info.
........

................
r61647 | russell | 2007-04-13 12:15:45 -0500 (Fri, 13 Apr 2007) | 11 lines

Merged revisions 61645 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r61645 | russell | 2007-04-13 12:10:19 -0500 (Fri, 13 Apr 2007) | 3 lines

Eliminate a compiler warning with ODBC_STORAGE enabled so that it will build
under dev-mode.

........

................
r61649 | file | 2007-04-13 12:21:53 -0500 (Fri, 13 Apr 2007) | 10 lines

Merged revisions 61648 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r61648 | file | 2007-04-13 13:19:53 -0400 (Fri, 13 Apr 2007) | 2 lines

For those very verbose SIP implementations that attach tons of info to the Contact header... let's increase our variable sizes. (issue #9535 reported by jeffg)

........

................
r61652 | file | 2007-04-13 13:09:29 -0500 (Fri, 13 Apr 2007) | 10 lines

Merged revisions 61651 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r61651 | file | 2007-04-13 14:08:02 -0400 (Fri, 13 Apr 2007) | 2 lines

Do not bother looking for a result if none are present.

........

................
r61657 | file | 2007-04-13 14:18:46 -0500 (Fri, 13 Apr 2007) | 18 lines

Merged revisions 61656 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

................
r61656 | file | 2007-04-13 15:17:08 -0400 (Fri, 13 Apr 2007) | 10 lines

Merged revisions 61655 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r61655 | file | 2007-04-13 15:15:12 -0400 (Fri, 13 Apr 2007) | 2 lines

Add OUTBOUND_GROUP_ONCE variable to app_dial. This behaves the same as OUTBOUND_GROUP except it will get unset after use so it won't get accidentally inherited. (issue #BE-140)

........

................

................
r61659 | murf | 2007-04-13 16:22:01 -0500 (Fri, 13 Apr 2007) | 9 lines

Merged revisions 61658 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r61658 | murf | 2007-04-13 15:17:20 -0600 (Fri, 13 Apr 2007) | 1 line

This is a fix to the way CDR merge handles the data that results from ForkCDR.
........

................
r61660 | dhubbard | 2007-04-13 16:23:10 -0500 (Fri, 13 Apr 2007) | 1 line

added CLI 'sip unregister <peer>' for issue 9326.  thanks eliel
................
r61661 | junky | 2007-04-14 13:22:39 -0500 (Sat, 14 Apr 2007) | 3 lines

test my new trunk access ;)


................
r61667 | oej | 2007-04-16 10:40:32 -0500 (Mon, 16 Apr 2007) | 2 lines

Doxygen changes

................
r61671 | oej | 2007-04-18 02:57:18 -0500 (Wed, 18 Apr 2007) | 7 lines

Mini-voicemail - an embryo for a new voicemail system based on building
blocks instead of one large monolithic app. Supports multiple templates
and is designed mostly for voicemail delivery over e-mail.

There's a todo with a list of ideas in the source code if you want
to contribute. Feedback is appreciated!

................
r61675 | oej | 2007-04-18 15:39:31 -0500 (Wed, 18 Apr 2007) | 10 lines

Merged revisions 61674 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r61674 | oej | 2007-04-18 22:28:53 +0200 (Wed, 18 Apr 2007) | 2 lines

Issue #9554 - Improve RTCP (Dave Troy)

........

................
r61677 | oej | 2007-04-18 15:48:13 -0500 (Wed, 18 Apr 2007) | 10 lines

Merged revisions 61676 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r61676 | oej | 2007-04-18 22:46:23 +0200 (Wed, 18 Apr 2007) | 2 lines

Clean upp formatting, add some doxygen stuff while we're in cleaning mode... Thanks Kevin!

........

................
r61679 | kpfleming | 2007-04-18 17:11:02 -0500 (Wed, 18 Apr 2007) | 10 lines

Merged revisions 61678 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r61678 | kpfleming | 2007-04-18 17:10:23 -0500 (Wed, 18 Apr 2007) | 2 lines

allow external build systems to extract the required sound file versions

........

................
r61682 | tilghman | 2007-04-18 21:51:21 -0500 (Wed, 18 Apr 2007) | 21 lines

Merged revisions 61681 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

................
r61681 | tilghman | 2007-04-18 21:45:05 -0500 (Wed, 18 Apr 2007) | 13 lines

Merged revisions 61680 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r61680 | tilghman | 2007-04-18 21:30:18 -0500 (Wed, 18 Apr 2007) | 5 lines

Bug 9557 - Specifying the GetVar AMI action without a Channel parameter can
cause Asterisk to crash.  The reason this needs to be fixed in the functions
instead of in AMI is because Channel can legitimately be NULL, such as when
retrieving global variables.

........

................

................
r61684 | tilghman | 2007-04-18 23:37:29 -0500 (Wed, 18 Apr 2007) | 10 lines

Merged revisions 61683 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r61683 | tilghman | 2007-04-18 23:36:20 -0500 (Wed, 18 Apr 2007) | 2 lines

Bug 9557 - simple reason why reading a function always returned NULL

........

................
r61689 | oej | 2007-04-20 03:41:24 -0500 (Fri, 20 Apr 2007) | 4 lines

Use the last line in the SDP, even if it has no CRLF. Remember Jon Postel :-)

This code exists in 1.2 and 1.4 but was removed from trunk for some unknown reason.

................
r61691 | russell | 2007-04-20 13:23:24 -0500 (Fri, 20 Apr 2007) | 12 lines

Merged revisions 61690 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r61690 | russell | 2007-04-20 13:19:18 -0500 (Fri, 20 Apr 2007) | 4 lines

Fix the UpdateConfig manager action to properly treat "variables" and "objects"
differently (a=b versus a=>b).
(issue #9568, reported by pari, patch by me)

........

................
r61695 | qwell | 2007-04-20 14:54:54 -0500 (Fri, 20 Apr 2007) | 21 lines

Merged revisions 61694 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

................
r61694 | qwell | 2007-04-20 14:51:49 -0500 (Fri, 20 Apr 2007) | 13 lines

Merged revisions 61692 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.2

........
r61692 | qwell | 2007-04-20 14:49:54 -0500 (Fri, 20 Apr 2007) | 5 lines

If the '* to hangup' option is not enabled, we don't need to disable * as a valid exit key.
  If it was enabled, this statement would've never been checked in the first place.

Issue #9552

........

................

................
r61698 | russell | 2007-04-20 15:43:05 -0500 (Fri, 20 Apr 2007) | 10 lines

Merged revisions 61697 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r61697 | russell | 2007-04-20 15:42:02 -0500 (Fri, 20 Apr 2007) | 2 lines

Remove a stray debug message introduced by a recent commit.

........

................

Added:
    team/russell/iax2_osp/apps/app_minivm.c
      - copied unchanged from r61698, trunk/apps/app_minivm.c
    team/russell/iax2_osp/configs/extensions_minivm.conf.sample
      - copied unchanged from r61698, trunk/configs/extensions_minivm.conf.sample
    team/russell/iax2_osp/configs/minivm.conf.sample
      - copied unchanged from r61698, trunk/configs/minivm.conf.sample
Modified:
    team/russell/iax2_osp/   (props changed)
    team/russell/iax2_osp/apps/app_dial.c
    team/russell/iax2_osp/apps/app_queue.c
    team/russell/iax2_osp/apps/app_speech_utils.c
    team/russell/iax2_osp/apps/app_voicemail.c
    team/russell/iax2_osp/channels/chan_oss.c
    team/russell/iax2_osp/channels/chan_sip.c
    team/russell/iax2_osp/funcs/func_callerid.c
    team/russell/iax2_osp/funcs/func_cdr.c
    team/russell/iax2_osp/funcs/func_groupcount.c
    team/russell/iax2_osp/funcs/func_timeout.c
    team/russell/iax2_osp/include/asterisk/config.h
    team/russell/iax2_osp/include/asterisk/rtp.h
    team/russell/iax2_osp/main/cdr.c
    team/russell/iax2_osp/main/config.c
    team/russell/iax2_osp/main/manager.c
    team/russell/iax2_osp/main/rtp.c
    team/russell/iax2_osp/main/say.c
    team/russell/iax2_osp/sounds/Makefile

Propchange: team/russell/iax2_osp/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.

Propchange: team/russell/iax2_osp/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Fri Apr 20 16:01:34 2007
@@ -1,1 +1,1 @@
-/trunk:1-61630
+/trunk:1-61700

Modified: team/russell/iax2_osp/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/team/russell/iax2_osp/apps/app_dial.c?view=diff&rev=61701&r1=61700&r2=61701
==============================================================================
--- team/russell/iax2_osp/apps/app_dial.c (original)
+++ team/russell/iax2_osp/apps/app_dial.c Fri Apr 20 16:01:34 2007
@@ -92,7 +92,10 @@
 "ends the call.\n"
 "  The optional URL will be sent to the called party if the channel supports it.\n"
 "  If the OUTBOUND_GROUP variable is set, all peer channels created by this\n"
-"application will be put into that group (as in Set(GROUP()=...).\n\n"
+"application will be put into that group (as in Set(GROUP()=...).\n"
+"  If the OUTBOUND_GROUP_ONCE variable is set, all peer channels created by this\n"
+"application will be put into that group (as in Set(GROUP()=...). Unlike OUTBOUND_GROUP,\n"
+"however, the variable will be unset after use.\n\n"
 "  Options:\n"
 "    A(x) - Play an announcement to the called party, using 'x' as the file.\n"
 "    C    - Reset the CDR for this call.\n"
@@ -1274,10 +1277,15 @@
 
 	if (continue_exec)
 		*continue_exec = 0;
-
+	
 	/* If a channel group has been specified, get it for use when we create peer channels */
-	outbound_group = pbx_builtin_getvar_helper(chan, "OUTBOUND_GROUP");
-
+	if ((outbound_group = pbx_builtin_getvar_helper(chan, "OUTBOUND_GROUP_ONCE"))) {
+		outbound_group = ast_strdupa(outbound_group);
+		pbx_builtin_setvar_helper(chan, "OUTBOUND_GROUP_ONCE", NULL);
+	} else {
+		outbound_group = pbx_builtin_getvar_helper(chan, "OUTBOUND_GROUP");
+	}
+	    
 	ast_copy_flags(peerflags, &opts, OPT_DTMF_EXIT | OPT_GO_ON | OPT_ORIGINAL_CLID | OPT_CALLER_HANGUP | OPT_IGNORE_FORWARDING);
 	/* loop through the list of dial destinations */
 	rest = args.peers;

Modified: team/russell/iax2_osp/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/russell/iax2_osp/apps/app_queue.c?view=diff&rev=61701&r1=61700&r2=61701
==============================================================================
--- team/russell/iax2_osp/apps/app_queue.c (original)
+++ team/russell/iax2_osp/apps/app_queue.c Fri Apr 20 16:01:34 2007
@@ -2122,7 +2122,7 @@
 				ast_frfree(f);
 				return NULL;
 			}
-			if ((f->frametype == AST_FRAME_DTMF) && (f->subclass != '*') && valid_exit(qe, f->subclass)) {
+			if ((f->frametype == AST_FRAME_DTMF) && valid_exit(qe, f->subclass)) {
 				if (option_verbose > 3)
 					ast_verbose(VERBOSE_PREFIX_3 "User pressed digit: %c\n", f->subclass);
 				*to = 0;

Modified: team/russell/iax2_osp/apps/app_speech_utils.c
URL: http://svn.digium.com/view/asterisk/team/russell/iax2_osp/apps/app_speech_utils.c?view=diff&rev=61701&r1=61700&r2=61701
==============================================================================
--- team/russell/iax2_osp/apps/app_speech_utils.c (original)
+++ team/russell/iax2_osp/apps/app_speech_utils.c Fri Apr 20 16:01:34 2007
@@ -132,6 +132,9 @@
 	struct ast_speech_result *result = results;
 	char *tmp = NULL;
 	int nbest_num = 0, wanted_num = 0, i = 0;
+
+	if (!result)
+		return NULL;
 
 	if ((tmp = strchr(result_num, '/'))) {
 		*tmp++ = '\0';

Modified: team/russell/iax2_osp/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/russell/iax2_osp/apps/app_voicemail.c?view=diff&rev=61701&r1=61700&r2=61701
==============================================================================
--- team/russell/iax2_osp/apps/app_voicemail.c (original)
+++ team/russell/iax2_osp/apps/app_voicemail.c Fri Apr 20 16:01:34 2007
@@ -839,7 +839,7 @@
 					ast_log(LOG_WARNING, "Failed to get category structure.\n");
 					break;
 				}
-				ast_variable_update(cat, vmu->mailbox, new, NULL);
+				ast_variable_update(cat, vmu->mailbox, new, NULL, 0);
 			}
 		}
 		/* save the results */
@@ -871,7 +871,7 @@
 					break;
 				}
 				if (!var)		
-					ast_variable_update(cat, "vmsecret", new, NULL);
+					ast_variable_update(cat, "vmsecret", new, NULL, 0);
 				else
 					ast_variable_append(cat, var);
 			}
@@ -1392,7 +1392,7 @@
 	void *fdm = MAP_FAILED;
 	size_t fdlen = -1;
 	SQLHSTMT stmt;
-	SQLINTEGER len;
+	SQLLEN len;
 	char sql[PATH_MAX];
 	char msgnums[20];
 	char fn[PATH_MAX];
@@ -3967,7 +3967,7 @@
 				*duration += prepend_duration;
 				msg_cat = ast_category_get(msg_cfg, "message");
 				snprintf(duration_str, 11, "%ld", *duration);
-				if (!ast_variable_update(msg_cat, "duration", duration_str, NULL)) {
+				if (!ast_variable_update(msg_cat, "duration", duration_str, NULL, 0)) {
 					config_text_file_save(textfile, msg_cfg, "app_voicemail");
 					STORE(curdir, vmu->mailbox, context, curmsg, chan, vmu, vmfmts, *duration, vms);
 				}

Modified: team/russell/iax2_osp/channels/chan_oss.c
URL: http://svn.digium.com/view/asterisk/team/russell/iax2_osp/channels/chan_oss.c?view=diff&rev=61701&r1=61700&r2=61701
==============================================================================
--- team/russell/iax2_osp/channels/chan_oss.c (original)
+++ team/russell/iax2_osp/channels/chan_oss.c Fri Apr 20 16:01:34 2007
@@ -1021,7 +1021,7 @@
 {
 	struct ast_channel *c;
 
-	c = ast_channel_alloc(1, state, o->cid_num, o->cid_name, "", o->ext, o->ctx, 0, "OSS/%s", o->device + 5);
+	c = ast_channel_alloc(1, state, o->cid_num, o->cid_name, "", ext, ctx, 0, "OSS/%s", o->device + 5);
 	if (c == NULL)
 		return NULL;
 	c->tech = &oss_tech;

Modified: team/russell/iax2_osp/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/russell/iax2_osp/channels/chan_sip.c?view=diff&rev=61701&r1=61700&r2=61701
==============================================================================
--- team/russell/iax2_osp/channels/chan_sip.c (original)
+++ team/russell/iax2_osp/channels/chan_sip.c Fri Apr 20 16:01:34 2007
@@ -1399,6 +1399,7 @@
 static int sip_show_peer(int fd, int argc, char *argv[]);
 static int sip_show_user(int fd, int argc, char *argv[]);
 static int sip_show_registry(int fd, int argc, char *argv[]);
+static int sip_unregister(int fd, int argc, char *argv[]);
 static int sip_show_settings(int fd, int argc, char *argv[]);
 static const char *subscription_type2str(enum subscriptiontype subtype) attribute_pure;
 static const struct cfsubscription_types *find_subscription_type(enum subscriptiontype subtype);
@@ -4721,6 +4722,8 @@
 	for (p = dialoglist; p; p = p->next) {
 		/* In pedantic, we do not want packets with bad syntax to be connected to a PVT */
 		int found = FALSE;
+		if (ast_strlen_zero(p->callid))
+			continue;
 		if (req->method == SIP_REGISTER)
 			found = (!strcmp(p->callid, callid));
 		else 
@@ -4957,6 +4960,16 @@
 			dst[i] = c + 1; /* record start of next line */
 		}
         }
+	/* Check for last header without CRLF. The RFC for SDP requires CRLF,
+	   but since some devices send without, we'll be generous in what we accept.
+	*/
+	if (!ast_strlen_zero(dst[i])) {
+		if (sipdebug && option_debug > 3)
+			ast_log(LOG_DEBUG, "%7s %2d [%3d]: %s\n",
+				req->headers < 0 ? "Header" : "Body",
+				i, (int)strlen(dst[i]), dst[i]);
+		i++;
+	}
 	/* update count of header or body lines */
 	if (req->headers >= 0)	/* we are in the body */
 		req->lines = i;
@@ -6014,7 +6027,7 @@
 		snprintf(tmp, sizeof(tmp), "%d", p->expiry);
 		add_header(resp, "Expires", tmp);
 		if (p->expiry) {	/* Only add contact if we have an expiry time */
-			char contact[256];
+			char contact[BUFSIZ];
 			snprintf(contact, sizeof(contact), "%s;expires=%d", p->our_contact, p->expiry);
 			add_header(resp, "Contact", contact);	/* Not when we unregister */
 		}
@@ -7046,7 +7059,7 @@
 /*! \brief Check Contact: URI of SIP message */
 static void extract_uri(struct sip_pvt *p, struct sip_request *req)
 {
-	char stripped[256];
+	char stripped[BUFSIZ];
 	char *c;
 
 	ast_copy_string(stripped, get_header(req, "Contact"), sizeof(stripped));
@@ -8208,7 +8221,7 @@
 /*! \brief Save contact header for 200 OK on INVITE */
 static int parse_ok_contact(struct sip_pvt *pvt, struct sip_request *req)
 {
-	char contact[250]; 
+	char contact[BUFSIZ]; 
 	char *c;
 
 	/* Look for brackets */
@@ -10938,6 +10951,25 @@
 	return RESULT_SUCCESS;
 #undef FORMAT
 #undef FORMAT2
+}
+
+/*! \brief Unregister (force expiration) a SIP peer in the registry via CLI */
+static int sip_unregister(int fd, int argc, char *argv[])
+{
+	struct sip_peer *peer;
+	int load_realtime = 0;
+
+	if (argc != 3)
+		return RESULT_SHOWUSAGE;
+	
+	if ((peer = find_peer(argv[2], NULL, load_realtime))) {
+		expire_register(peer);
+		ast_cli(fd, "Unregistered peer \'%s\'\n\n", argv[2]);
+	} else {
+		ast_cli(fd, "Attempted to unregister an unknown peer \'%s\' via CLI\n", argv[2]);
+	}
+	
+	return 0;
 }
 
 /*! \brief List global settings for the SIP channel */
@@ -11940,6 +11972,10 @@
 "Usage: sip show registry\n"
 "       Lists all registration requests and status.\n";
 
+static const char sip_unregister_usage[] =
+"Usage: sip unregister <peer>\n"
+"       Unregister (force expiration) a SIP peer from the registry\n";
+
 static const char debug_usage[] = 
 "Usage: sip debug\n"
 "       Enables dumping of SIP packets for debugging purposes\n\n"
@@ -12238,7 +12274,7 @@
 /*! \brief Parse 302 Moved temporalily response */
 static void parse_moved_contact(struct sip_pvt *p, struct sip_request *req)
 {
-	char tmp[256];
+	char tmp[BUFSIZ];
 	char *s, *e;
 	char *domain;
 
@@ -15072,6 +15108,9 @@
 	else if (ast_strlen_zero(p->context))
 		ast_string_field_set(p, context, default_context);
 
+	/* Get full contact header - this needs to be used as a request URI in NOTIFY's */
+	parse_ok_contact(p, req);
+
 	build_contact(p);
 	if (gotdest) {
 		transmit_response(p, "404 Not Found", req);
@@ -18063,6 +18102,10 @@
 	sip_show_registry, "List SIP registration status",
 	show_reg_usage },
 
+	{ { "sip", "unregister", NULL },
+	sip_unregister, "Unregister (force expiration) a SIP peer from the registery\n",
+	sip_unregister_usage },
+
 	{ { "sip", "show", "settings", NULL },
 	sip_show_settings, "Show SIP global settings",
 	show_settings_usage },

Modified: team/russell/iax2_osp/funcs/func_callerid.c
URL: http://svn.digium.com/view/asterisk/team/russell/iax2_osp/funcs/func_callerid.c?view=diff&rev=61701&r1=61700&r2=61701
==============================================================================
--- team/russell/iax2_osp/funcs/func_callerid.c (original)
+++ team/russell/iax2_osp/funcs/func_callerid.c Fri Apr 20 16:01:34 2007
@@ -60,7 +60,9 @@
 {
 	char *opt = data;
 
-	/* XXX we are not always clearing the buffer. Is this correct ? */
+	if (!chan)
+		return -1;
+
 	if (strchr(opt, '|')) {
 		char name[80], num[80];
 
@@ -116,7 +118,7 @@
 static int callerid_write(struct ast_channel *chan, const char *cmd, char *data,
 			  const char *value)
 {
-	if (!value)
+	if (!value || !chan)
 		return -1;
 
 	if (!strncasecmp("all", data, 3)) {

Modified: team/russell/iax2_osp/funcs/func_cdr.c
URL: http://svn.digium.com/view/asterisk/team/russell/iax2_osp/funcs/func_cdr.c?view=diff&rev=61701&r1=61700&r2=61701
==============================================================================
--- team/russell/iax2_osp/funcs/func_cdr.c (original)
+++ team/russell/iax2_osp/funcs/func_cdr.c Fri Apr 20 16:01:34 2007
@@ -59,7 +59,7 @@
 {
 	char *ret;
 	struct ast_flags flags = { 0 };
-	struct ast_cdr *cdr = chan->cdr;
+	struct ast_cdr *cdr = chan ? chan->cdr : NULL;
 	AST_DECLARE_APP_ARGS(args,
 			     AST_APP_ARG(variable);
 			     AST_APP_ARG(options);
@@ -96,7 +96,7 @@
 			     AST_APP_ARG(options);
 	);
 
-	if (ast_strlen_zero(parse) || !value)
+	if (ast_strlen_zero(parse) || !value || !chan)
 		return -1;
 
 	AST_STANDARD_APP_ARGS(args, parse);

Modified: team/russell/iax2_osp/funcs/func_groupcount.c
URL: http://svn.digium.com/view/asterisk/team/russell/iax2_osp/funcs/func_groupcount.c?view=diff&rev=61701&r1=61700&r2=61701
==============================================================================
--- team/russell/iax2_osp/funcs/func_groupcount.c (original)
+++ team/russell/iax2_osp/funcs/func_groupcount.c Fri Apr 20 16:01:34 2007
@@ -157,6 +157,9 @@
 	struct varshead *headp;
 	char tmp1[1024] = "";
 	char tmp2[1024] = "";
+
+	if (!chan)
+		return -1;
 
 	headp = &chan->varshead;
 	AST_LIST_TRAVERSE(headp, current, entries) {

Modified: team/russell/iax2_osp/funcs/func_timeout.c
URL: http://svn.digium.com/view/asterisk/team/russell/iax2_osp/funcs/func_timeout.c?view=diff&rev=61701&r1=61700&r2=61701
==============================================================================
--- team/russell/iax2_osp/funcs/func_timeout.c (original)
+++ team/russell/iax2_osp/funcs/func_timeout.c Fri Apr 20 16:01:34 2007
@@ -46,6 +46,9 @@
 {
 	time_t myt;
 
+	if (!chan)
+		return -1;
+
 	if (!data) {
 		ast_log(LOG_ERROR, "Must specify type of timeout to get.\n");
 		return -1;
@@ -90,6 +93,9 @@
 	int x;
 	char timestr[64];
 	struct tm myt;
+
+	if (!chan)
+		return -1;
 
 	if (!data) {
 		ast_log(LOG_ERROR, "Must specify type of timeout to set.\n");

Modified: team/russell/iax2_osp/include/asterisk/config.h
URL: http://svn.digium.com/view/asterisk/team/russell/iax2_osp/include/asterisk/config.h?view=diff&rev=61701&r1=61700&r2=61701
==============================================================================
--- team/russell/iax2_osp/include/asterisk/config.h (original)
+++ team/russell/iax2_osp/include/asterisk/config.h Fri Apr 20 16:01:34 2007
@@ -212,7 +212,8 @@
 struct ast_variable *ast_variable_new(const char *name, const char *value);
 void ast_variable_append(struct ast_category *category, struct ast_variable *variable);
 int ast_variable_delete(struct ast_category *category, const char *variable, const char *match);
-int ast_variable_update(struct ast_category *category, const char *variable, const char *value, const char *match);
+int ast_variable_update(struct ast_category *category, const char *variable, 
+	const char *value, const char *match, unsigned int object);
 
 int config_text_file_save(const char *filename, const struct ast_config *cfg, const char *generator);
 

Modified: team/russell/iax2_osp/include/asterisk/rtp.h
URL: http://svn.digium.com/view/asterisk/team/russell/iax2_osp/include/asterisk/rtp.h?view=diff&rev=61701&r1=61700&r2=61701
==============================================================================
--- team/russell/iax2_osp/include/asterisk/rtp.h (original)
+++ team/russell/iax2_osp/include/asterisk/rtp.h Fri Apr 20 16:01:34 2007
@@ -84,16 +84,17 @@
 	AST_LIST_ENTRY(ast_rtp_protocol) list;
 };
 
+/*! \brief RTCP quality report storage */
 struct ast_rtp_quality {
-	unsigned int local_ssrc;          /* Our SSRC */
-	unsigned int local_lostpackets;   /* Our lost packets */
-	double       local_jitter;        /* Our calculated jitter */
-	unsigned int local_count;         /* Number of received packets */
-	unsigned int remote_ssrc;         /* Their SSRC */
-	unsigned int remote_lostpackets;  /* Their lost packets */
-	double       remote_jitter;       /* Their reported jitter */
-	unsigned int remote_count;        /* Number of transmitted packets */
-	double       rtt;                 /* Round trip time */
+	unsigned int local_ssrc;          /*!< Our SSRC */
+	unsigned int local_lostpackets;   /*!< Our lost packets */
+	double       local_jitter;        /*!< Our calculated jitter */
+	unsigned int local_count;         /*!< Number of received packets */
+	unsigned int remote_ssrc;         /*!< Their SSRC */
+	unsigned int remote_lostpackets;  /*!< Their lost packets */
+	double       remote_jitter;       /*!< Their reported jitter */
+	unsigned int remote_count;        /*!< Number of transmitted packets */
+	double       rtt;                 /*!< Round trip time */
 };
 
 /*! RTP callback structure */

Modified: team/russell/iax2_osp/main/cdr.c
URL: http://svn.digium.com/view/asterisk/team/russell/iax2_osp/main/cdr.c?view=diff&rev=61701&r1=61700&r2=61701
==============================================================================
--- team/russell/iax2_osp/main/cdr.c (original)
+++ team/russell/iax2_osp/main/cdr.c Fri Apr 20 16:01:34 2007
@@ -512,6 +512,8 @@
 
 void ast_cdr_merge(struct ast_cdr *to, struct ast_cdr *from)
 {
+	struct ast_cdr *tcdr;
+	
 	if (!to || !from)
 		return;
 	
@@ -587,15 +589,15 @@
 		ast_copy_string(to->dst, from->dst, sizeof(to->dst));
 		from->dst[0] = 0; /* theft */
 	}
-	if (!to->amaflags && from->amaflags) {
+	if (ast_test_flag(from, AST_CDR_FLAG_LOCKED) || (!to->amaflags && from->amaflags)) {
 		to->amaflags = from->amaflags;
 		from->amaflags = 0; /* theft */
 	}
-	if (ast_strlen_zero(to->accountcode) && !ast_strlen_zero(from->accountcode)) {
+	if (ast_test_flag(from, AST_CDR_FLAG_LOCKED) || (ast_strlen_zero(to->accountcode) && !ast_strlen_zero(from->accountcode))) {
 		ast_copy_string(to->accountcode, from->accountcode, sizeof(to->accountcode));
 		from->accountcode[0] = 0; /* theft */
 	}
-	if (ast_strlen_zero(to->userfield) && !ast_strlen_zero(from->userfield)) {
+	if (ast_test_flag(from, AST_CDR_FLAG_LOCKED) || (ast_strlen_zero(to->userfield) && !ast_strlen_zero(from->userfield))) {
 		ast_copy_string(to->userfield, from->userfield, sizeof(to->userfield));
 		from->userfield[0] = 0; /* theft */
 	}
@@ -612,6 +614,16 @@
 		ast_set_flag(to, AST_CDR_FLAG_CHILD);
 	if (ast_test_flag(from, AST_CDR_FLAG_POST_DISABLED))
 		ast_set_flag(to, AST_CDR_FLAG_POST_DISABLED);
+
+	/* last, but not least, we need to merge any forked CDRs to the 'to' cdr */
+	while (from->next) {
+		/* just rip 'em off the 'from' and insert them on the 'to' */
+		tcdr = from->next;
+		from->next = tcdr->next;
+		tcdr->next = NULL;
+		/* tcdr is now ripped from the current list; */
+		ast_cdr_append(to, tcdr);
+	}
 }
 
 void ast_cdr_start(struct ast_cdr *cdr)
@@ -817,8 +829,9 @@
 
 	ast_string_field_set(chan, accountcode, account);
 	for ( ; cdr ; cdr = cdr->next) {
-		if (!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED))
+		if (!ast_test_flag(cdr, AST_CDR_FLAG_LOCKED)) {
 			ast_copy_string(cdr->accountcode, chan->accountcode, sizeof(cdr->accountcode));
+		}
 	}
 	return 0;
 }

Modified: team/russell/iax2_osp/main/config.c
URL: http://svn.digium.com/view/asterisk/team/russell/iax2_osp/main/config.c?view=diff&rev=61701&r1=61700&r2=61701
==============================================================================
--- team/russell/iax2_osp/main/config.c (original)
+++ team/russell/iax2_osp/main/config.c Fri Apr 20 16:01:34 2007
@@ -468,54 +468,41 @@
 	return res;
 }
 
-int ast_variable_update(struct ast_category *category, const char *variable, const char *value, const char *match)
+int ast_variable_update(struct ast_category *category, const char *variable, 
+	const char *value, const char *match, unsigned int object)
 {
 	struct ast_variable *cur, *prev=NULL, *newer;
-	newer = ast_variable_new(variable, value);
-	if (!newer)
+
+	if (!(newer = ast_variable_new(variable, value)))
 		return -1;
-	cur = category->root;
-	while (cur) {
-		if (cur->name == variable) {
-			newer->next = cur->next;
-			newer->object = cur->object;
-			if (prev)
-				prev->next = newer;
-			else
-				category->root = newer;
-			if (category->last == cur)
-				category->last = newer;
-			cur->next = NULL;
-			ast_variables_destroy(cur);
-			return 0;
-		}
-		prev = cur;
-		cur = cur->next;
-	}
-
-	prev = NULL;
-	cur = category->root;
-	while (cur) {
-		if (!strcasecmp(cur->name, variable) && (ast_strlen_zero(match) || !strcasecmp(cur->value, match))) {
-			newer->next = cur->next;
-			newer->object = cur->object;
-			if (prev)
-				prev->next = newer;
-			else
-				category->root = newer;
-			if (category->last == cur)
-				category->last = newer;
-			cur->next = NULL;
-			ast_variables_destroy(cur);
-			return 0;
-		}
-		prev = cur;
-		cur = cur->next;
-	}
+	
+	newer->object = object;
+
+	for (cur = category->root; cur; prev = cur, cur = cur->next) {
+		if (strcasecmp(cur->name, variable) ||
+			(!ast_strlen_zero(match) && strcasecmp(cur->value, match)))
+			continue;
+
+		newer->next = cur->next;
+		newer->object = cur->object || object;
+		if (prev)
+			prev->next = newer;
+		else
+			category->root = newer;
+		if (category->last == cur)
+			category->last = newer;
+
+		cur->next = NULL;
+		ast_variables_destroy(cur);
+
+		return 0;
+	}
+
 	if (prev)
 		prev->next = newer;
 	else
 		category->root = newer;
+
 	return 0;
 }
 

Modified: team/russell/iax2_osp/main/manager.c
URL: http://svn.digium.com/view/asterisk/team/russell/iax2_osp/main/manager.c?view=diff&rev=61701&r1=61700&r2=61701
==============================================================================
--- team/russell/iax2_osp/main/manager.c (original)
+++ team/russell/iax2_osp/main/manager.c Fri Apr 20 16:01:34 2007
@@ -1121,6 +1121,8 @@
 	struct ast_variable *v;
 
 	for (x=0;x<100000;x++) {
+		unsigned int object = 0;
+
 		snprintf(hdr, sizeof(hdr), "Action-%06d", x);
 		action = astman_get_header(m, hdr);
 		if (ast_strlen_zero(action))
@@ -1131,6 +1133,10 @@
 		var = astman_get_header(m, hdr);
 		snprintf(hdr, sizeof(hdr), "Value-%06d", x);
 		value = astman_get_header(m, hdr);
+		if (!ast_strlen_zero(value) && *value == '>') {
+			object = 1;
+			value++;
+		}
 		snprintf(hdr, sizeof(hdr), "Match-%06d", x);
 		match = astman_get_header(m, hdr);
 		if (!strcasecmp(action, "newcat")) {
@@ -1151,7 +1157,7 @@
 				ast_category_delete(cfg, cat);
 		} else if (!strcasecmp(action, "update")) {
 			if (!ast_strlen_zero(cat) && !ast_strlen_zero(var) && (category = ast_category_get(cfg, cat)))
-				ast_variable_update(category, var, value, match);
+				ast_variable_update(category, var, value, match, object);
 		} else if (!strcasecmp(action, "delete")) {
 			if (!ast_strlen_zero(cat) && !ast_strlen_zero(var) && (category = ast_category_get(cfg, cat)))
 				ast_variable_delete(category, var, match);
@@ -1159,7 +1165,7 @@
 			if (!ast_strlen_zero(cat) && !ast_strlen_zero(var) &&
 				(category = ast_category_get(cfg, cat)) &&
 				(v = ast_variable_new(var, value))){
-				if (match && !strcasecmp(match, "object"))
+				if (object || (match && !strcasecmp(match, "object")))
 					v->object = 1;
 				ast_variable_append(category, v);
 			}
@@ -1483,7 +1489,7 @@
 	const char *name = astman_get_header(m, "Channel");
 	const char *varname = astman_get_header(m, "Variable");
 	char *varval;
-	char workspace[1024];
+	char workspace[1024] = "";
 
 	if (ast_strlen_zero(varname)) {
 		astman_send_error(s, m, "No variable specified");
@@ -1500,6 +1506,7 @@
 
 	if (varname[strlen(varname) - 1] == ')') {
 		ast_func_read(c, (char *) varname, workspace, sizeof(workspace));
+		varval = workspace;
 	} else {
 		pbx_retrieve_variable(c, varname, &varval, workspace, sizeof(workspace), NULL);
 	}

Modified: team/russell/iax2_osp/main/rtp.c
URL: http://svn.digium.com/view/asterisk/team/russell/iax2_osp/main/rtp.c?view=diff&rev=61701&r1=61700&r2=61701
==============================================================================
--- team/russell/iax2_osp/main/rtp.c (original)
+++ team/russell/iax2_osp/main/rtp.c Fri Apr 20 16:01:34 2007
@@ -145,8 +145,8 @@
 	unsigned int dtmfsamples;
 	/* DTMF Transmission Variables */
 	unsigned int lastdigitts;
-	char sending_digit;	/* boolean - are we sending digits */
-	char send_digit;	/* digit we are sending */
+	char sending_digit;	/*!< boolean - are we sending digits */
+	char send_digit;	/*!< digit we are sending */
 	int send_payload;
 	int send_duration;
 	int nat;
@@ -995,25 +995,27 @@
 				lsr = (double)((ntohl(rtcpheader[i + 4]) & 0xffff0000) >> 16) + (double)((double)(ntohl(rtcpheader[i + 4]) & 0xffff) / 1000000.);
 				dlsr = (double)(ntohl(rtcpheader[i + 5])/65536.);
 				rtt = a - dlsr - lsr;
-				rtp->rtcp->accumulated_transit += rtt;
-				rtp->rtcp->rtt = rtt;
-				if (rtp->rtcp->maxrtt<rtt)
-					rtp->rtcp->maxrtt = rtt;
-				if (rtp->rtcp->minrtt>rtt)
-				rtp->rtcp->minrtt = rtt;
+				if (rtt >= 0) {
+					rtp->rtcp->accumulated_transit += rtt;
+					rtp->rtcp->rtt = rtt;
+					if (rtp->rtcp->maxrtt < rtt)
+						rtp->rtcp->maxrtt = rtt;
+					if (rtp->rtcp->minrtt > rtt)
+						rtp->rtcp->minrtt = rtt;
+				}
 			}
 			rtp->rtcp->reported_jitter = ntohl(rtcpheader[i + 3]);
 			rtp->rtcp->reported_lost = ntohl(rtcpheader[i + 1]) & 0xffffff;
 			if (rtcp_debug_test_addr(&sin)) {
-				ast_verbose("Fraction lost: %ld\n", (((long) ntohl(rtcpheader[i + 1]) & 0xff000000) >> 24));
-				ast_verbose("Packets lost so far: %d\n", rtp->rtcp->reported_lost);
-				ast_verbose("Highest sequence number: %ld\n", (long) (ntohl(rtcpheader[i + 2]) & 0xffff));
-				ast_verbose("Sequence number cycles: %ld\n", (long) (ntohl(rtcpheader[i + 2]) & 0xffff) >> 16);
-				ast_verbose("Interarrival jitter: %u\n", rtp->rtcp->reported_jitter);
-				ast_verbose("Last SR(our NTP): %lu.%010lu\n",(unsigned long) ntohl(rtcpheader[i + 4]) >> 16,((unsigned long) ntohl(rtcpheader[i + 4]) << 16) * 4096);
-				ast_verbose("DLSR: %4.4f (sec)\n",ntohl(rtcpheader[i + 5])/65536.0);
+				ast_verbose("  Fraction lost: %ld\n", (((long) ntohl(rtcpheader[i + 1]) & 0xff000000) >> 24));
+				ast_verbose("  Packets lost so far: %d\n", rtp->rtcp->reported_lost);
+				ast_verbose("  Highest sequence number: %ld\n", (long) (ntohl(rtcpheader[i + 2]) & 0xffff));
+				ast_verbose("  Sequence number cycles: %ld\n", (long) (ntohl(rtcpheader[i + 2]) & 0xffff) >> 16);
+				ast_verbose("  Interarrival jitter: %u\n", rtp->rtcp->reported_jitter);
+				ast_verbose("  Last SR(our NTP): %lu.%010lu\n",(unsigned long) ntohl(rtcpheader[i + 4]) >> 16,((unsigned long) ntohl(rtcpheader[i + 4]) << 16) * 4096);
+				ast_verbose("  DLSR: %4.4f (sec)\n",ntohl(rtcpheader[i + 5])/65536.0);
 				if (rtt)
-					ast_verbose("RTT: %f(sec)\n", rtt);
+					ast_verbose("  RTT: %f(sec)\n", rtt);
 			}
 			break;
 		case RTCP_PT_FUR:
@@ -1155,7 +1157,6 @@
 	unsigned int seqno;
 	int version;
 	int payloadtype;
-	int tseqno;
 	int hdrlen = 12;
 	int padding;
 	int mark;
@@ -1276,8 +1277,6 @@
 
 	rtp->rxcount++; /* Only count reasonably valid packets, this'll make the rtcp stats more accurate */
 
-	tseqno = rtp->lastrxseqno +1;
-
 	if (rtp->rxcount==1) {
 		/* This is the first RTP packet successfully received from source */
 		rtp->seedrxseqno = seqno;
@@ -1288,11 +1287,8 @@
 		/* Schedule transmission of Receiver Report */
 		rtp->rtcp->schedid = ast_sched_add(rtp->sched, ast_rtcp_calc_interval(rtp), ast_rtcp_write, rtp);
 	}
-
-	if (tseqno > RTP_SEQ_MOD) { /* if tseqno is greater than RTP_SEQ_MOD it would indicate that the sender cycled */
+	if ( rtp->lastrxseqno - seqno  > 100) /* if so it would indicate that the sender cycled; allow for misordering */
 		rtp->cycles += RTP_SEQ_MOD;
-		ast_verbose("SEQNO cycled: %u\t%d\n", rtp->cycles, seqno);
-	}
 
 	rtp->lastrxseqno = seqno;
 	
@@ -2452,7 +2448,7 @@
 	rtcpheader[7] = htonl(rtp->themssrc);
 	rtcpheader[8] = htonl(((fraction & 0xff) << 24) | (lost & 0xffffff));
 	rtcpheader[9] = htonl((rtp->cycles) | ((rtp->lastrxseqno & 0xffff)));
-	rtcpheader[10] = htonl((unsigned int)rtp->rxjitter);
+	rtcpheader[10] = htonl((unsigned int)(rtp->rxjitter * 65536.));
 	rtcpheader[11] = htonl(rtp->rtcp->themrxlsr);
 	rtcpheader[12] = htonl((((dlsr.tv_sec * 1000) + (dlsr.tv_usec / 1000)) * 65536) / 1000);
 	len += 24;
@@ -2554,7 +2550,7 @@
 	rtcpheader[2] = htonl(rtp->themssrc);
 	rtcpheader[3] = htonl(((fraction & 0xff) << 24) | (lost & 0xffffff));
 	rtcpheader[4] = htonl((rtp->cycles) | ((rtp->lastrxseqno & 0xffff)));
-	rtcpheader[5] = htonl((unsigned int)rtp->rxjitter);
+	rtcpheader[5] = htonl((unsigned int)(rtp->rxjitter * 65536.));
 	rtcpheader[6] = htonl(rtp->rtcp->themrxlsr);
 	rtcpheader[7] = htonl((((dlsr.tv_sec * 1000) + (dlsr.tv_usec / 1000)) * 65536) / 1000);
 

Modified: team/russell/iax2_osp/main/say.c
URL: http://svn.digium.com/view/asterisk/team/russell/iax2_osp/main/say.c?view=diff&rev=61701&r1=61700&r2=61701
==============================================================================
--- team/russell/iax2_osp/main/say.c (original)
+++ team/russell/iax2_osp/main/say.c Fri Apr 20 16:01:34 2007
@@ -1113,7 +1113,7 @@
 		} else if (num < 80) {
 			snprintf(fn, sizeof(fn), "digits/60");
 			if ((num % 10) == 1) playa++;
-			num = num - 60;
+			num -= 60;
 		} else if (num < 100) {
 			snprintf(fn, sizeof(fn), "digits/80");
 			num = num - 80;

Modified: team/russell/iax2_osp/sounds/Makefile
URL: http://svn.digium.com/view/asterisk/team/russell/iax2_osp/sounds/Makefile?view=diff&rev=61701&r1=61700&r2=61701
==============================================================================
--- team/russell/iax2_osp/sounds/Makefile (original)
+++ team/russell/iax2_osp/sounds/Makefile Fri Apr 20 16:01:34 2007
@@ -149,3 +149,9 @@
 uninstall:
 	rm -rf $(SOUNDS_DIR)
 	rm -rf $(MOH_DIR)
+
+core_sounds_version:
+	@echo $(CORE_SOUNDS_VERSION)
+
+extra_sounds_version:
+	@echo $(EXTRA_SOUNDS_VERSION)



More information about the asterisk-commits mailing list