[asterisk-commits] oej: branch oej/videocaps r61754 - in /team/oej/videocaps: ./ apps/ channels/...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Sat Apr 21 09:49:45 MST 2007


Author: oej
Date: Sat Apr 21 11:49:44 2007
New Revision: 61754

URL: http://svn.digium.com/view/asterisk?view=rev&rev=61754
Log:
Reset automerge, resolve conflicts

Added:
    team/oej/videocaps/apps/app_minivm.c
      - copied unchanged from r61708, trunk/apps/app_minivm.c
    team/oej/videocaps/configs/extensions_minivm.conf.sample
      - copied unchanged from r61708, trunk/configs/extensions_minivm.conf.sample
    team/oej/videocaps/configs/minivm.conf.sample
      - copied unchanged from r61708, trunk/configs/minivm.conf.sample
Modified:
    team/oej/videocaps/   (props changed)
    team/oej/videocaps/apps/app_queue.c
    team/oej/videocaps/apps/app_voicemail.c
    team/oej/videocaps/channels/chan_iax2.c
    team/oej/videocaps/channels/chan_sip.c
    team/oej/videocaps/channels/iax2-parser.c
    team/oej/videocaps/channels/iax2-parser.h
    team/oej/videocaps/channels/iax2.h
    team/oej/videocaps/funcs/func_callerid.c
    team/oej/videocaps/funcs/func_cdr.c
    team/oej/videocaps/funcs/func_channel.c
    team/oej/videocaps/funcs/func_groupcount.c
    team/oej/videocaps/funcs/func_timeout.c
    team/oej/videocaps/include/asterisk/config.h
    team/oej/videocaps/include/asterisk/rtp.h
    team/oej/videocaps/main/config.c
    team/oej/videocaps/main/loader.c
    team/oej/videocaps/main/manager.c
    team/oej/videocaps/main/rtp.c
    team/oej/videocaps/sounds/Makefile

Propchange: team/oej/videocaps/
------------------------------------------------------------------------------
    automerge = http://edvina.net/training/

Propchange: team/oej/videocaps/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Sat Apr 21 11:49:44 2007
@@ -1,1 +1,1 @@
-/trunk:1-55904
+/trunk:1-61752

Modified: team/oej/videocaps/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/oej/videocaps/apps/app_queue.c?view=diff&rev=61754&r1=61753&r2=61754
==============================================================================
--- team/oej/videocaps/apps/app_queue.c (original)
+++ team/oej/videocaps/apps/app_queue.c Sat Apr 21 11:49:44 2007
@@ -2124,7 +2124,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/oej/videocaps/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/oej/videocaps/apps/app_voicemail.c?view=diff&rev=61754&r1=61753&r2=61754
==============================================================================
--- team/oej/videocaps/apps/app_voicemail.c (original)
+++ team/oej/videocaps/apps/app_voicemail.c Sat Apr 21 11:49:44 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);
 			}
@@ -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/oej/videocaps/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/oej/videocaps/channels/chan_iax2.c?view=diff&rev=61754&r1=61753&r2=61754
==============================================================================
--- team/oej/videocaps/channels/chan_iax2.c (original)
+++ team/oej/videocaps/channels/chan_iax2.c Sat Apr 21 11:49:44 2007
@@ -577,6 +577,8 @@
 		AST_STRING_FIELD(accountcode);
 		AST_STRING_FIELD(mohinterpret);
 		AST_STRING_FIELD(mohsuggest);
+		/*! received OSP token */
+		AST_STRING_FIELD(osptoken);
 	);
 	
 	/*! permitted authentication methods */
@@ -851,6 +853,9 @@
 static void destroy_user(struct iax2_user *user);
 static void prune_peers(void);
 
+static int acf_channel_read(struct ast_channel *chan, const char *funcname, char *preparse, char *buf, size_t buflen);
+static int acf_channel_write(struct ast_channel *chan, const char *function, char *data, const char *value);
+
 static const struct ast_channel_tech iax2_tech = {
 	.type = "IAX2",
 	.description = tdesc,
@@ -874,6 +879,8 @@
 	.bridge = iax2_bridge,
 	.transfer = iax2_transfer,
 	.fixup = iax2_fixup,
+	.func_channel_read = acf_channel_read,
+	.func_channel_write = acf_channel_write,
 };
 
 static void insert_idle_thread(struct iax2_thread *thread)
@@ -2890,6 +2897,11 @@
 	struct parsed_dial_string pds;
 	struct create_addr_info cai;
 	struct ast_var_t *var;
+	const char* osp_token_ptr;
+	unsigned int osp_token_length;
+	unsigned char osp_block_index;
+	unsigned int osp_block_length;
+	unsigned char osp_buffer[256];
 
 	if ((c->_state != AST_STATE_DOWN) && (c->_state != AST_STATE_RESERVED)) {
 		ast_log(LOG_WARNING, "Channel is already in use (%s)?\n", c->name);
@@ -3009,6 +3021,25 @@
 		iaxs[callno]->pingtime = autokill / 2;
 		iaxs[callno]->initid = ast_sched_add(sched, autokill * 2, auto_congest, CALLNO_TO_PTR(callno));
 	}
+
+	/* Check if there is an OSP token set by IAXCHANINFO function */
+	osp_token_ptr = iaxs[callno]->osptoken;
+	if (!ast_strlen_zero(osp_token_ptr)) {
+		if ((osp_token_length = strlen(osp_token_ptr)) <= IAX_MAX_OSPTOKEN_SIZE) {
+			osp_block_index = 0;
+			while (osp_token_length > 0) {
+				osp_block_length = IAX_MAX_OSPBLOCK_SIZE < osp_token_length ? IAX_MAX_OSPBLOCK_SIZE : osp_token_length;
+				osp_buffer[0] = osp_block_index;
+				memcpy(osp_buffer + 1, osp_token_ptr, osp_block_length);
+				iax_ie_append_raw(&ied, IAX_IE_OSPTOKEN, osp_buffer, osp_block_length + 1);
+				osp_block_index++;
+				osp_token_ptr += osp_block_length;
+				osp_token_length -= osp_block_length;
+			} 
+		} else
+			ast_log(LOG_WARNING, "OSP token is too long\n");
+	} else if (option_debug && iaxdebug)
+		ast_log(LOG_DEBUG, "OSP token is undefined\n");
 
 	/* send the command using the appropriate socket for this peer */
 	iaxs[callno]->sockfd = cai.sockfd;
@@ -6316,6 +6347,36 @@
 	iaxs[fr->callno]->remote_rr.ooo = ies->rr_ooo;
 }
 
+static void save_osptoken(struct iax_frame *fr, struct iax_ies *ies) 
+{
+	int i;
+	unsigned int length, offset = 0;
+	char full_osptoken[IAX_MAX_OSPBUFF_SIZE];
+
+	for (i = 0; i < IAX_MAX_OSPBLOCK_NUM; i++) {
+		length = ies->ospblocklength[i];
+		if (length != 0) {
+			if (length > IAX_MAX_OSPBLOCK_SIZE) {
+				/* OSP token block length wrong, clear buffer */
+				offset = 0;
+				break;
+			} else {
+				memcpy(full_osptoken + offset, ies->osptokenblock[i], length);
+				offset += length;
+			}
+		} else {
+			break;
+		}
+	}
+	*(full_osptoken + offset) = '\0';
+	if (strlen(full_osptoken) != offset) {
+		/* OSP token length wrong, clear buffer */
+		*full_osptoken = '\0';
+	}
+
+	ast_string_field_set(iaxs[fr->callno], osptoken, full_osptoken);
+}
+
 static int socket_read(int *id, int fd, short events, void *cbdata)
 {
 	struct iax2_thread *thread;
@@ -6940,6 +7001,8 @@
 					ast_mutex_lock(&iaxsl[fr->callno]);
 				} else
 					exists = 0;
+				/* Get OSP token if it does exist */
+				save_osptoken(fr, &ies);
 				if (ast_strlen_zero(iaxs[fr->callno]->secret) && ast_strlen_zero(iaxs[fr->callno]->inkeys)) {
 					if (strcmp(iaxs[fr->callno]->exten, "TBD") && !exists) {
 						memset(&ied0, 0, sizeof(ied0));
@@ -9824,6 +9887,61 @@
 	"\n"
 };
 
+static int acf_channel_write(struct ast_channel *chan, const char *function, char *args, const char *value)
+{
+	struct chan_iax2_pvt *pvt;
+	unsigned int callno;
+	int res = 0;
+
+	if (!chan || chan->tech != &iax2_tech) {
+		ast_log(LOG_ERROR, "This function requires a valid IAX2 channel\n");
+		return -1;
+	}
+
+	callno = PTR_TO_CALLNO(chan->tech_pvt);
+	ast_mutex_lock(&iaxsl[callno]);
+	if (!(pvt = iaxs[callno])) {
+		ast_mutex_unlock(&iaxsl[callno]);
+		return -1;
+	}
+
+	if (!strcasecmp(args, "osptoken"))
+		ast_string_field_set(pvt, osptoken, value);
+	else
+		res = -1;
+
+	ast_mutex_unlock(&iaxsl[callno]);
+
+	return res;
+}
+
+static int acf_channel_read(struct ast_channel *chan, const char *funcname, char *args, char *buf, size_t buflen)
+{
+	struct chan_iax2_pvt *pvt;
+	unsigned int callno;
+	int res = 0;
+
+	if (!chan || chan->tech != &iax2_tech) {
+		ast_log(LOG_ERROR, "This function requires a valid IAX2 channel\n");
+		return -1;
+	}
+
+	callno = PTR_TO_CALLNO(chan->tech_pvt);
+	ast_mutex_lock(&iaxsl[callno]);
+	if (!(pvt = iaxs[callno])) {
+		ast_mutex_unlock(&iaxsl[callno]);
+		return -1;
+	}
+
+	if (!strcasecmp(args, "osptoken"))
+		ast_copy_string(buf, pvt->osptoken, buflen);
+	else
+		res = -1;
+
+	ast_mutex_unlock(&iaxsl[callno]);
+
+	return res;
+}
 
 /*! \brief Part of the device state notification system ---*/
 static int iax2_devicestate(void *data) 

Modified: team/oej/videocaps/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/oej/videocaps/channels/chan_sip.c?view=diff&rev=61754&r1=61753&r2=61754
==============================================================================
--- team/oej/videocaps/channels/chan_sip.c (original)
+++ team/oej/videocaps/channels/chan_sip.c Sat Apr 21 11:49:44 2007
@@ -5094,6 +5094,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;
@@ -15666,6 +15676,9 @@
 		ast_string_field_set(p, context, p->subscribecontext);
 	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) {
@@ -17925,6 +17938,8 @@
 			parse_h264_conf_line(v->value, &global_caps.h264, 30);
 		} else if (!strcasecmp(v->name, "matchexterniplocally")) {
 			global_matchexterniplocally = ast_true(v->value);
+		} else if (!strcasecmp(v->name, "matchexterniplocally")) {
+			global_matchexterniplocally = ast_true(v->value);
 		}
 	}
 

Modified: team/oej/videocaps/channels/iax2-parser.c
URL: http://svn.digium.com/view/asterisk/team/oej/videocaps/channels/iax2-parser.c?view=diff&rev=61754&r1=61753&r2=61754
==============================================================================
--- team/oej/videocaps/channels/iax2-parser.c (original)
+++ team/oej/videocaps/channels/iax2-parser.c Sat Apr 21 11:49:44 2007
@@ -264,6 +264,7 @@
 	{ IAX_IE_RR_DROPPED, "RR_DROPPED", dump_int },
 	{ IAX_IE_RR_OOO, "RR_OUTOFORDER", dump_int },
 	{ IAX_IE_VARIABLE, "VARIABLE", dump_string },
+	{ IAX_IE_OSPTOKEN, "OSPTOKEN" },
 };
 
 static struct iax2_ie prov_ies[] = {
@@ -617,6 +618,7 @@
 	int ie;
 	char tmp[256], *tmp2;
 	struct ast_variable *var, *var2, *prev;
+	unsigned int count;
 	memset(ies, 0, (int)sizeof(struct iax_ies));
 	ies->msgcount = -1;
 	ies->firmwarever = -1;
@@ -930,6 +932,15 @@
 				ies->vars = var;
 			}
 			break;
+		case IAX_IE_OSPTOKEN:
+			if ((count = data[2]) < IAX_MAX_OSPBLOCK_NUM) {
+				ies->osptokenblock[count] = (char *)data + 2 + 1;
+				ies->ospblocklength[count] = len - 1;
+			} else {
+				snprintf(tmp, (int)sizeof(tmp), "Expected OSP token block index to be 0~%d but was %d\n", IAX_MAX_OSPBLOCK_NUM - 1, count);
+				errorf(tmp);
+			}
+			break;
 		default:
 			snprintf(tmp, (int)sizeof(tmp), "Ignoring unknown information element '%s' (%d) of length %d\n", iax_ie2str(ie), ie, len);
 			outputf(tmp);

Modified: team/oej/videocaps/channels/iax2-parser.h
URL: http://svn.digium.com/view/asterisk/team/oej/videocaps/channels/iax2-parser.h?view=diff&rev=61754&r1=61753&r2=61754
==============================================================================
--- team/oej/videocaps/channels/iax2-parser.h (original)
+++ team/oej/videocaps/channels/iax2-parser.h Sat Apr 21 11:49:44 2007
@@ -74,6 +74,8 @@
 	unsigned int rr_dropped;
 	unsigned int rr_ooo;
 	struct ast_variable *vars;
+	char *osptokenblock[IAX_MAX_OSPBLOCK_NUM];
+	unsigned int ospblocklength[IAX_MAX_OSPBLOCK_NUM];
 };
 
 #define DIRECTION_INGRESS 1

Modified: team/oej/videocaps/channels/iax2.h
URL: http://svn.digium.com/view/asterisk/team/oej/videocaps/channels/iax2.h?view=diff&rev=61754&r1=61753&r2=61754
==============================================================================
--- team/oej/videocaps/channels/iax2.h (original)
+++ team/oej/videocaps/channels/iax2.h Sat Apr 21 11:49:44 2007
@@ -129,7 +129,12 @@
 #define IAX_IE_RR_DROPPED			50		/* Dropped frames (presumably by jitterbuf) u32 */
 #define IAX_IE_RR_OOO				51		/* Frames received Out of Order u32 */
 #define IAX_IE_VARIABLE				52		/* Remote variables */
-
+#define IAX_IE_OSPTOKEN				53		/* OSP token */
+
+#define IAX_MAX_OSPBLOCK_SIZE		254		/* Max OSP token block size, 255 bytes - 1 byte OSP token block index */
+#define IAX_MAX_OSPBLOCK_NUM		4
+#define IAX_MAX_OSPTOKEN_SIZE		(IAX_MAX_OSPBLOCK_SIZE * IAX_MAX_OSPBLOCK_NUM)
+#define IAX_MAX_OSPBUFF_SIZE		(IAX_MAX_OSPTOKEN_SIZE + 16)
 
 #define IAX_AUTH_PLAINTEXT			(1 << 0)
 #define IAX_AUTH_MD5				(1 << 1)

Modified: team/oej/videocaps/funcs/func_callerid.c
URL: http://svn.digium.com/view/asterisk/team/oej/videocaps/funcs/func_callerid.c?view=diff&rev=61754&r1=61753&r2=61754
==============================================================================
--- team/oej/videocaps/funcs/func_callerid.c (original)
+++ team/oej/videocaps/funcs/func_callerid.c Sat Apr 21 11:49:44 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/oej/videocaps/funcs/func_cdr.c
URL: http://svn.digium.com/view/asterisk/team/oej/videocaps/funcs/func_cdr.c?view=diff&rev=61754&r1=61753&r2=61754
==============================================================================
--- team/oej/videocaps/funcs/func_cdr.c (original)
+++ team/oej/videocaps/funcs/func_cdr.c Sat Apr 21 11:49:44 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/oej/videocaps/funcs/func_channel.c
URL: http://svn.digium.com/view/asterisk/team/oej/videocaps/funcs/func_channel.c?view=diff&rev=61754&r1=61753&r2=61754
==============================================================================
--- team/oej/videocaps/funcs/func_channel.c (original)
+++ team/oej/videocaps/funcs/func_channel.c Sat Apr 21 11:49:44 2007
@@ -182,6 +182,9 @@
 		"    rtt                   Round trip time\n"
 		"    all                   All statistics (in a form suited to logging, but not for parsing)\n"
 		"\n"
+		"chan_iax2 provides the following additional options:\n"
+		"R/W    osptoken           Get or set the OSP token information for a call\n"
+		"\n"
 		"Additional items may be available from the channel driver providing\n"
 		"the channel; see its documentation for details.\n"
 		"\n"

Modified: team/oej/videocaps/funcs/func_groupcount.c
URL: http://svn.digium.com/view/asterisk/team/oej/videocaps/funcs/func_groupcount.c?view=diff&rev=61754&r1=61753&r2=61754
==============================================================================
--- team/oej/videocaps/funcs/func_groupcount.c (original)
+++ team/oej/videocaps/funcs/func_groupcount.c Sat Apr 21 11:49:44 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/oej/videocaps/funcs/func_timeout.c
URL: http://svn.digium.com/view/asterisk/team/oej/videocaps/funcs/func_timeout.c?view=diff&rev=61754&r1=61753&r2=61754
==============================================================================
--- team/oej/videocaps/funcs/func_timeout.c (original)
+++ team/oej/videocaps/funcs/func_timeout.c Sat Apr 21 11:49:44 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/oej/videocaps/include/asterisk/config.h
URL: http://svn.digium.com/view/asterisk/team/oej/videocaps/include/asterisk/config.h?view=diff&rev=61754&r1=61753&r2=61754
==============================================================================
--- team/oej/videocaps/include/asterisk/config.h (original)
+++ team/oej/videocaps/include/asterisk/config.h Sat Apr 21 11:49:44 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/oej/videocaps/include/asterisk/rtp.h
URL: http://svn.digium.com/view/asterisk/team/oej/videocaps/include/asterisk/rtp.h?view=diff&rev=61754&r1=61753&r2=61754
==============================================================================
--- team/oej/videocaps/include/asterisk/rtp.h (original)
+++ team/oej/videocaps/include/asterisk/rtp.h Sat Apr 21 11:49:44 2007
@@ -84,6 +84,19 @@
 	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 */
+};
+
 /*! RTP callback structure */
 /*!
  * \brief Structure representing a RTP session.
@@ -98,19 +111,6 @@
 	int isAstFormat; 	/*!< whether the following code is an AST_FORMAT */
 	int code;
 };
-
-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 */
-};
-
 
 /*!
  * \brief Get the amount of space required to hold an RTP session

Modified: team/oej/videocaps/main/config.c
URL: http://svn.digium.com/view/asterisk/team/oej/videocaps/main/config.c?view=diff&rev=61754&r1=61753&r2=61754
==============================================================================
--- team/oej/videocaps/main/config.c (original)
+++ team/oej/videocaps/main/config.c Sat Apr 21 11:49:44 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/oej/videocaps/main/loader.c
URL: http://svn.digium.com/view/asterisk/team/oej/videocaps/main/loader.c?view=diff&rev=61754&r1=61753&r2=61754
==============================================================================
--- team/oej/videocaps/main/loader.c (original)
+++ team/oej/videocaps/main/loader.c Sat Apr 21 11:49:44 2007
@@ -529,6 +529,7 @@
 		ast_verbose("The previous reload command didn't finish yet\n");
 		return -1;	/* reload already in progress */
 	}
+	ast_lastreloadtime = time(NULL);
 
 	/* Call "predefined" reload here first */
 	for (i = 0; reload_classes[i].name; i++) {
@@ -537,7 +538,6 @@
 			res = 2;	/* found and reloaded */
 		}
 	}
-	ast_lastreloadtime = time(NULL);
 
 	if (name && res) {
 		ast_mutex_unlock(&reloadlock);

Modified: team/oej/videocaps/main/manager.c
URL: http://svn.digium.com/view/asterisk/team/oej/videocaps/main/manager.c?view=diff&rev=61754&r1=61753&r2=61754
==============================================================================
--- team/oej/videocaps/main/manager.c (original)
+++ team/oej/videocaps/main/manager.c Sat Apr 21 11:49:44 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/oej/videocaps/main/rtp.c
URL: http://svn.digium.com/view/asterisk/team/oej/videocaps/main/rtp.c?view=diff&rev=61754&r1=61753&r2=61754
==============================================================================
--- team/oej/videocaps/main/rtp.c (original)
+++ team/oej/videocaps/main/rtp.c Sat Apr 21 11:49:44 2007
@@ -148,8 +148,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;
@@ -998,25 +998,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:
@@ -1158,7 +1160,6 @@
 	unsigned int seqno;
 	int version;
 	int payloadtype;
-	int tseqno;
 	int hdrlen = 12;
 	int padding;
 	int mark;
@@ -1279,8 +1280,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;
@@ -1291,11 +1290,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 ( (int)rtp->lastrxseqno - (int)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;
 	
@@ -2456,7 +2452,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;
@@ -2558,7 +2554,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/oej/videocaps/sounds/Makefile
URL: http://svn.digium.com/view/asterisk/team/oej/videocaps/sounds/Makefile?view=diff&rev=61754&r1=61753&r2=61754
==============================================================================
--- team/oej/videocaps/sounds/Makefile (original)
+++ team/oej/videocaps/sounds/Makefile Sat Apr 21 11:49:44 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