[asterisk-commits] [svn-commits] branch oej/ami_ssl r17742 - in /team/oej/ami_ssl: ./ apps/ channels/ channels...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Thu Apr 6 00:46:59 MST 2006


Author: oej
Date: Thu Apr  6 02:46:30 2006
New Revision: 17742

URL: http://svn.digium.com/view/asterisk?rev=17742&view=rev
Log:
Update to trunk manually, try to kick autostart so that it runs on this branch

Added:
    team/oej/ami_ssl/res/res_config_pgsql.c
      - copied unchanged from r17740, trunk/res/res_config_pgsql.c
Removed:
    team/oej/ami_ssl/formats/format_au.c
    team/oej/ami_ssl/formats/format_pcm_alaw.c
Modified:
    team/oej/ami_ssl/   (props changed)
    team/oej/ami_ssl/CREDITS
    team/oej/ami_ssl/Makefile
    team/oej/ami_ssl/app.c
    team/oej/ami_ssl/apps/app_alarmreceiver.c
    team/oej/ami_ssl/apps/app_channelredirect.c
    team/oej/ami_ssl/apps/app_exec.c
    team/oej/ami_ssl/apps/app_page.c
    team/oej/ami_ssl/apps/app_queue.c
    team/oej/ami_ssl/apps/app_senddtmf.c
    team/oej/ami_ssl/apps/app_voicemail.c
    team/oej/ami_ssl/channels/chan_agent.c
    team/oej/ami_ssl/channels/chan_iax2.c
    team/oej/ami_ssl/channels/chan_local.c
    team/oej/ami_ssl/channels/chan_mgcp.c
    team/oej/ami_ssl/channels/chan_misdn.c
    team/oej/ami_ssl/channels/chan_sip.c
    team/oej/ami_ssl/channels/chan_zap.c
    team/oej/ami_ssl/channels/misdn/Makefile
    team/oej/ami_ssl/channels/misdn/isdn_lib.c
    team/oej/ami_ssl/channels/misdn/isdn_lib.h
    team/oej/ami_ssl/channels/misdn/isdn_msg_parser.c
    team/oej/ami_ssl/channels/misdn/portinfo.c
    team/oej/ami_ssl/devicestate.c
    team/oej/ami_ssl/dns.c
    team/oej/ami_ssl/enum.c
    team/oej/ami_ssl/formats/Makefile
    team/oej/ami_ssl/formats/format_ogg_vorbis.c
    team/oej/ami_ssl/formats/format_sln.c
    team/oej/ami_ssl/include/asterisk/pbx.h
    team/oej/ami_ssl/manager.c
    team/oej/ami_ssl/pbx.c
    team/oej/ami_ssl/pbx/pbx_dundi.c
    team/oej/ami_ssl/res/Makefile
    team/oej/ami_ssl/res/res_musiconhold.c
    team/oej/ami_ssl/rtp.c
    team/oej/ami_ssl/udptl.c

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

Propchange: team/oej/ami_ssl/
------------------------------------------------------------------------------
Binary property 'branch-1.2-blocked' - no diff available.

Propchange: team/oej/ami_ssl/
------------------------------------------------------------------------------
Binary property 'branch-1.2-merged' - no diff available.

Propchange: team/oej/ami_ssl/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Thu Apr  6 02:46:30 2006
@@ -1,1 +1,1 @@
-/trunk:1-17261
+/trunk:1-17740

Modified: team/oej/ami_ssl/CREDITS
URL: http://svn.digium.com/view/asterisk/team/oej/ami_ssl/CREDITS?rev=17742&r1=17741&r2=17742&view=diff
==============================================================================
--- team/oej/ami_ssl/CREDITS (original)
+++ team/oej/ami_ssl/CREDITS Thu Apr  6 02:46:30 2006
@@ -12,6 +12,8 @@
 Telesthetic - for supporting SIP development
 
 Christos Ricudis - for substantial code contributions
+
+nic.at - ENUM support in Asterisk
 
 Paul Bagyenda, Digital Solutions - for initial Voicetronix driver development
 

Modified: team/oej/ami_ssl/Makefile
URL: http://svn.digium.com/view/asterisk/team/oej/ami_ssl/Makefile?rev=17742&r1=17741&r2=17742&view=diff
==============================================================================
--- team/oej/ami_ssl/Makefile (original)
+++ team/oej/ami_ssl/Makefile Thu Apr  6 02:46:30 2006
@@ -28,6 +28,7 @@
 ifeq ($(CROSS_COMPILE),)
   OSARCH=$(shell uname -s)
   OSREV=$(shell uname -r)
+  MARCH=$(shell uname -m)
 else
   OSARCH=$(CROSS_ARCH)
   OSREV=$(CROSS_REV)
@@ -402,8 +403,11 @@
   AUDIO_LIBS=-framework CoreAudio
   ASTLINK=-Wl,-dynamic
   SOLINK=-dynamic -bundle -undefined suppress -force_flat_namespace
-  OBJS+=poll.o
-  ASTCFLAGS+=-DPOLLCOMPAT
+  # Mac on Intel CoreDuo does not need poll compatibility layer
+  ifneq ($(MARCH),i386)
+    OBJS+=poll.o
+    ASTCFLAGS+=-DPOLLCOMPAT
+  endif
 else
 #These are used for all but Darwin
   ASTLINK=-Wl,-E 

Modified: team/oej/ami_ssl/app.c
URL: http://svn.digium.com/view/asterisk/team/oej/ami_ssl/app.c?rev=17742&r1=17741&r2=17742&view=diff
==============================================================================
--- team/oej/ami_ssl/app.c (original)
+++ team/oej/ami_ssl/app.c Thu Apr  6 02:46:30 2006
@@ -1157,7 +1157,7 @@
 		return AST_LOCK_FAILURE;
 	}
 
-	snprintf(fs, strlen(path) + 19, "%s/.lock-%08x", path, rand());
+	snprintf(fs, strlen(path) + 19, "%s/.lock-%08lx", path, ast_random());
 	fd = open(fs, O_WRONLY | O_CREAT | O_EXCL, 0600);
 	if (fd < 0) {
 		fprintf(stderr, "Unable to create lock file '%s': %s\n", path, strerror(errno));

Modified: team/oej/ami_ssl/apps/app_alarmreceiver.c
URL: http://svn.digium.com/view/asterisk/team/oej/ami_ssl/apps/app_alarmreceiver.c?rev=17742&r1=17741&r2=17742&view=diff
==============================================================================
--- team/oej/ami_ssl/apps/app_alarmreceiver.c (original)
+++ team/oej/ami_ssl/apps/app_alarmreceiver.c Thu Apr  6 02:46:30 2006
@@ -551,13 +551,12 @@
 
 		checksum = checksum % 15;
 
-		if(checksum){
+		if (checksum) {
 			database_increment("checksum-errors");
-			if(option_verbose >= 2){
+			if (option_verbose >= 2)
 				ast_verbose(VERBOSE_PREFIX_2 "AlarmReceiver: Nonzero checksum\n");
 			ast_log(LOG_DEBUG, "AlarmReceiver: Nonzero checksum\n");
 			continue;
-			}
 		}
 
 		/* Check the message type for correctness */

Modified: team/oej/ami_ssl/apps/app_channelredirect.c
URL: http://svn.digium.com/view/asterisk/team/oej/ami_ssl/apps/app_channelredirect.c?rev=17742&r1=17741&r2=17742&view=diff
==============================================================================
--- team/oej/ami_ssl/apps/app_channelredirect.c (original)
+++ team/oej/ami_ssl/apps/app_channelredirect.c Thu Apr  6 02:46:30 2006
@@ -99,15 +99,16 @@
 		context = NULL;
 	}
 
-	if (!(prio = ast_findlabel_extension(chan2, S_OR(context, chan2->context), S_OR(exten, chan2->exten),
-					     priority, chan2->cid.cid_num))) {
+	/* ast_findlabel_extension does not convert numeric priorities; it only does a lookup */
+	if (!(prio = atoi(priority)) && !(prio = ast_findlabel_extension(chan2, S_OR(context, chan2->context),
+									S_OR(exten, chan2->exten), priority, chan2->cid.cid_num))) {
 		ast_log(LOG_WARNING, "'%s' is not a known priority or label\n", priority);
 		goto chanquit;
 	}
 
-	ast_log(LOG_DEBUG, "Attempting async goto (%s) to %s\n", args.channel, args.label);
+	ast_log(LOG_DEBUG, "Attempting async goto (%s) to %s|%s|%d\n", args.channel, S_OR(context, chan2->context), S_OR(exten, chan2->exten), prio);
 
-	if (ast_async_goto_if_exists(chan2, context ? context : chan2->context, exten ? exten : chan2->exten, prio))
+	if (ast_async_goto_if_exists(chan2, S_OR(context, chan2->context), S_OR(exten, chan2->exten), prio))
 		ast_log(LOG_WARNING, "%s failed for %s\n", app, args.channel);
 	else
 		res = 0;

Modified: team/oej/ami_ssl/apps/app_exec.c
URL: http://svn.digium.com/view/asterisk/team/oej/ami_ssl/apps/app_exec.c?rev=17742&r1=17741&r2=17742&view=diff
==============================================================================
--- team/oej/ami_ssl/apps/app_exec.c (original)
+++ team/oej/ami_ssl/apps/app_exec.c Thu Apr  6 02:46:30 2006
@@ -2,8 +2,9 @@
  * Asterisk -- An open source telephony toolkit.
  *
  * Copyright (c) 2004 - 2005, Tilghman Lesher.  All rights reserved.
+ * Portions copyright (c) 2006, Philipp Dunkel.
  *
- * Tilghman Lesher <app_exec__v001 at the-tilghman.com>
+ * Tilghman Lesher <app_exec__v002 at the-tilghman.com>
  *
  * This code is released by the author with no restrictions on usage.
  *
@@ -19,7 +20,8 @@
  *
  * \brief Exec application
  *
- * \author Tilghman Lesher <app_exec__v001 at the-tilghman.com>
+ * \author Tilghman Lesher <app_exec__v002 at the-tilghman.com>
+ * \author Philipp Dunkel <philipp.dunkel at ebox.at>
  *
  * \ingroup applications
  */
@@ -43,18 +45,43 @@
 /* Maximum length of any variable */
 #define MAXRESULT	1024
 
-static char *tdesc = "Executes applications";
+static char *tdesc = "Executes dialplan applications";
+
+/*! Note
+ *
+ * The key difference between these two apps is exit status.  In a
+ * nutshell, Exec tries to be transparent as possible, behaving
+ * in exactly the same way as if the application it calls was
+ * directly invoked from the dialplan.
+ *
+ * TryExec, on the other hand, provides a way to execute applications
+ * and catch any possible fatal error without actually fatally
+ * affecting the dialplan.
+ */
 
 static char *app_exec = "Exec";
-
-static char *exec_synopsis = "Executes internal application";
-
+static char *exec_synopsis = "Executes dialplan application";
 static char *exec_descrip =
 "Usage: Exec(appname(arguments))\n"
 "  Allows an arbitrary application to be invoked even when not\n"
+"hardcoded into the dialplan.  If the underlying application\n"
+"terminates the dialplan, or if the application cannot be found,\n"
+"Exec will terminate the dialplan.\n"
+"  To invoke external applications, see the application System.\n"
+"  If you would like to catch any error instead, see TryExec.\n";
+
+static char *app_tryexec = "TryExec";
+static char *tryexec_synopsis = "Executes dialplan application, always returning";
+static char *tryexec_descrip =
+"Usage: TryExec(appname(arguments))\n"
+"  Allows an arbitrary application to be invoked even when not\n"
 "hardcoded into the dialplan. To invoke external applications\n"
-"see the application System. Returns whatever value the\n"
-"app returns or a non-zero value if the app cannot be found.\n";
+"see the application System.  Always returns to the dialplan.\n"
+"The channel variable TRYSTATUS will be set to:\n"
+"    SUCCESS   if the application returned zero\n"
+"    FAILED    if the application returned non-zero\n"
+"    NOAPP     if the application was not found or was not specified\n"
+"    NOMEMORY  if there was not enough memory to execute.\n";
 
 LOCAL_USER_DECL;
 
@@ -62,12 +89,10 @@
 {
 	int res=0;
 	struct localuser *u;
-	char *s, *appname, *endargs, args[MAXRESULT];
+	char *s, *appname, *endargs, args[MAXRESULT] = "";
 	struct ast_app *app;
 
 	LOCAL_USER_ADD(u);
-
-	memset(args, 0, MAXRESULT);
 
 	/* Check and parse arguments */
 	if (data) {
@@ -96,11 +121,51 @@
 	return res;
 }
 
+static int tryexec_exec(struct ast_channel *chan, void *data)
+{
+	int res=0;
+	struct localuser *u;
+	char *s, *appname, *endargs, args[MAXRESULT] = "";
+	struct ast_app *app;
+
+	LOCAL_USER_ADD(u);
+
+	/* Check and parse arguments */
+	if (data) {
+		if ((s = ast_strdupa(data))) {
+			appname = strsep(&s, "(");
+			if (s) {
+				endargs = strrchr(s, ')');
+				if (endargs)
+					*endargs = '\0';
+				pbx_substitute_variables_helper(chan, s, args, MAXRESULT - 1);
+			}
+			if (appname) {
+				app = pbx_findapp(appname);
+				if (app) {
+					res = pbx_exec(chan, app, args);
+					pbx_builtin_setvar_helper(chan, "TRYSTATUS", res ? "FAILED" : "SUCCESS");
+				} else {
+					ast_log(LOG_WARNING, "Could not find application (%s)\n", appname);
+					pbx_builtin_setvar_helper(chan, "TRYSTATUS", "NOAPP");
+				}
+			}
+		} else {
+			ast_log(LOG_ERROR, "Out of memory\n");
+			pbx_builtin_setvar_helper(chan, "TRYSTATUS", "NOMEMORY");
+		}
+	}
+
+	LOCAL_USER_REMOVE(u);
+	return 0;
+}
+
 int unload_module(void)
 {
 	int res;
 
 	res = ast_unregister_application(app_exec);
+	res |= ast_unregister_application(app_tryexec);
 
 	STANDARD_HANGUP_LOCALUSERS;
 
@@ -109,7 +174,9 @@
 
 int load_module(void)
 {
-	return ast_register_application(app_exec, exec_exec, exec_synopsis, exec_descrip);
+	int res = ast_register_application(app_exec, exec_exec, exec_synopsis, exec_descrip);
+	res |= ast_register_application(app_tryexec, tryexec_exec, tryexec_synopsis, tryexec_descrip);
+	return res;
 }
 
 char *description(void)

Modified: team/oej/ami_ssl/apps/app_page.c
URL: http://svn.digium.com/view/asterisk/team/oej/ami_ssl/apps/app_page.c?rev=17742&r1=17741&r2=17742&view=diff
==============================================================================
--- team/oej/ami_ssl/apps/app_page.c (original)
+++ team/oej/ami_ssl/apps/app_page.c Thu Apr  6 02:46:30 2006
@@ -143,7 +143,7 @@
 	char *tech, *resource;
 	char meetmeopts[80];
 	struct ast_flags flags = { 0 };
-	unsigned int confid = rand();
+	unsigned int confid = ast_random();
 	struct ast_app *app;
 	char *tmp;
 	int res=0;

Modified: team/oej/ami_ssl/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/oej/ami_ssl/apps/app_queue.c?rev=17742&r1=17741&r2=17742&view=diff
==============================================================================
--- team/oej/ami_ssl/apps/app_queue.c (original)
+++ team/oej/ami_ssl/apps/app_queue.c Thu Apr  6 02:46:30 2006
@@ -1211,7 +1211,7 @@
 
 	ast_mutex_lock(&qe->parent->lock);
 	if (newvalue <= qe->parent->servicelevel)
-       		qe->parent->callscompletedinsl++;
+		qe->parent->callscompletedinsl++;
 	oldvalue = qe->parent->holdtime;
 	qe->parent->holdtime = (((oldvalue << 2) - oldvalue) + newvalue) >> 2;
 	ast_mutex_unlock(&qe->parent->lock);
@@ -1753,7 +1753,7 @@
 				if (f) {
 					if (f->frametype == AST_FRAME_CONTROL) {
 						switch(f->subclass) {
-		    			case AST_CONTROL_ANSWER:
+						case AST_CONTROL_ANSWER:
 							/* This is our guy if someone answered. */
 							if (!peer) {
 								if (option_verbose > 2)
@@ -1992,7 +1992,7 @@
 		tmp->metric += mem->penalty * 1000000;
 		break;
 	case QUEUE_STRATEGY_RANDOM:
-		tmp->metric = rand() % 1000;
+		tmp->metric = ast_random() % 1000;
 		tmp->metric += mem->penalty * 1000000;
 		break;
 	case QUEUE_STRATEGY_FEWESTCALLS:
@@ -2193,7 +2193,7 @@
 				/* Agent must have hung up */
 				ast_log(LOG_WARNING, "Agent on %s hungup on the customer.  They're going to be pissed.\n", peer->name);
 				ast_queue_log(queuename, qe->chan->uniqueid, peer->name, "AGENTDUMP", "%s", "");
-                                record_abandoned(qe);
+				record_abandoned(qe);
 				if (qe->parent->eventwhencalled) {
 					manager_event(EVENT_FLAG_AGENT, "AgentDump",
 						      "Queue: %s\r\n"
@@ -2223,7 +2223,7 @@
 		if (res < 0) {
 			ast_queue_log(queuename, qe->chan->uniqueid, peer->name, "SYSCOMPAT", "%s", "");
 			ast_log(LOG_WARNING, "Had to drop call because I couldn't make %s compatible with %s\n", qe->chan->name, peer->name);
-                        record_abandoned(qe);
+		record_abandoned(qe);
 			ast_hangup(peer);
 			return -1;
 		}
@@ -2241,7 +2241,7 @@
 			else {
 				/* Last ditch effort -- no CDR, make up something */
 				char tmpid[256];
-				snprintf(tmpid, sizeof(tmpid), "chan-%x", rand());
+				snprintf(tmpid, sizeof(tmpid), "chan-%lx", ast_random());
 				ast_monitor_start(which, qe->parent->monfmt, tmpid, 1 );
 			}
 			if (qe->parent->monjoin)
@@ -2403,7 +2403,7 @@
 				free(last_member);
 
 				if (queue_persistent_members)
-				    dump_queue_members(q);
+					dump_queue_members(q);
 
 				res = RES_OKAY;
 			} else {
@@ -2440,17 +2440,17 @@
 				new_member->next = q->members;
 				q->members = new_member;
 				manager_event(EVENT_FLAG_AGENT, "QueueMemberAdded",
-					"Queue: %s\r\n"
-					"Location: %s\r\n"
-					"Membership: %s\r\n"
-					"Penalty: %d\r\n"
-					"CallsTaken: %d\r\n"
-					"LastCall: %d\r\n"
-					"Status: %d\r\n"
-					"Paused: %d\r\n",
-				q->name, new_member->interface, new_member->dynamic ? "dynamic" : "static",
-				new_member->penalty, new_member->calls, (int)new_member->lastcall, new_member->status, new_member->paused);
-					
+						"Queue: %s\r\n"
+						"Location: %s\r\n"
+						"Membership: %s\r\n"
+						"Penalty: %d\r\n"
+						"CallsTaken: %d\r\n"
+						"LastCall: %d\r\n"
+						"Status: %d\r\n"
+						"Paused: %d\r\n",
+						q->name, new_member->interface, new_member->dynamic ? "dynamic" : "static",
+						new_member->penalty, new_member->calls, (int)new_member->lastcall, new_member->status, new_member->paused);
+
 				if (dump)
 					dump_queue_members(q);
 
@@ -2489,7 +2489,7 @@
 				mem->paused = paused;
 
 				if (queue_persistent_members)
-				    dump_queue_members(q);
+					dump_queue_members(q);
 
 				ast_queue_log(q->name, "NONE", interface, (paused ? "PAUSE" : "UNPAUSE"), "%s", "");
 
@@ -2944,7 +2944,7 @@
 check_turns:
 		if (ringing) {
 			ast_indicate(chan, AST_CONTROL_RINGING);
-		} else {              
+		} else {
 			ast_moh_start(chan, qe.moh);
 		}
 		for (;;) {
@@ -2958,8 +2958,8 @@
 				 ast_queue_log(args.queuename, chan->uniqueid, "NONE", "ABANDON", "%d|%d|%ld", qe.pos, qe.opos, (long)time(NULL) - qe.start);
 				if (option_verbose > 2) {
 					ast_verbose(VERBOSE_PREFIX_3 "User disconnected from queue %s while waiting their turn\n", args.queuename);
-					res = -1;
 				}
+				res = -1;
 				break;
 			}
 			if (!res) 
@@ -2981,7 +2981,7 @@
 
 				/* Leave if we have exceeded our queuetimeout */
 				if (qe.expire && (time(NULL) > qe.expire)) {
-                                        record_abandoned(&qe);
+					record_abandoned(&qe);
 					reason = QUEUE_TIMEOUT;
 					res = 0;
 					ast_queue_log(args.queuename, chan->uniqueid,"NONE", "EXITWITHTIMEOUT", "%d", qe.pos);
@@ -3057,8 +3057,8 @@
 					ast_queue_log(args.queuename, chan->uniqueid, "NONE", "ABANDON", "%d|%d|%ld", qe.pos, qe.opos, (long)time(NULL) - qe.start);
 					if (option_verbose > 2) {
 						ast_verbose(VERBOSE_PREFIX_3 "User disconnected from queue %s when they almost made it\n", args.queuename);
-						res = -1;
 					}
+					res = -1;
 					break;
 				}
 				if (res && valid_exit(&qe, res)) {
@@ -3067,12 +3067,10 @@
 				}
 				/* exit after 'timeout' cycle if 'n' option enabled */
 				if (go_on) {
-					if (option_verbose > 2) {
+					if (option_verbose > 2)
 						ast_verbose(VERBOSE_PREFIX_3 "Exiting on time-out cycle\n");
-						res = -1;
-					}
 					ast_queue_log(args.queuename, chan->uniqueid, "NONE", "EXITWITHTIMEOUT", "%d", qe.pos);
-                                        record_abandoned(&qe);
+					record_abandoned(&qe);
 					reason = QUEUE_TIMEOUT;
 					res = 0;
 					break;

Modified: team/oej/ami_ssl/apps/app_senddtmf.c
URL: http://svn.digium.com/view/asterisk/team/oej/ami_ssl/apps/app_senddtmfc?rev=17742&r1=17741&r2=17742&view=diff
==============================================================================
--- team/oej/ami_ssl/apps/app_senddtmf.c (original)
+++ team/oej/ami_ssl/apps/app_senddtmf.c Thu Apr  6 02:46:30 2006
@@ -52,7 +52,7 @@
 
 static char *descrip = 
 " SendDTMF(digits[|timeout_ms]): Sends DTMF digits on a channel. \n"
-" Accepted digits: 0-9, *#abcd\n"
+" Accepted digits: 0-9, *#abcd, w (.5s pause)\n"
 " The application will either pass the assigned digits or terminate if it\n"
 " encounters an error.\n";
 

Modified: team/oej/ami_ssl/apps/app_voicemail.c
URL: http://svn.digium.com/view/asterisk/team/oej/ami_ssl/apps/app_voicemail.c?rev=17742&r1=17741&r2=17742&view=diff
==============================================================================
--- team/oej/ami_ssl/apps/app_voicemail.c (original)
+++ team/oej/ami_ssl/apps/app_voicemail.c Thu Apr  6 02:46:30 2006
@@ -1753,11 +1753,11 @@
 			fprintf(p, "Subject: New message %d in mailbox %s\n", msgnum + 1, mailbox);
 		else
 			fprintf(p, "Subject: [PBX]: New message %d in mailbox %s\n", msgnum + 1, mailbox);
-		fprintf(p, "Message-ID: <Asterisk-%d-%d-%s-%d@%s>\n", msgnum, (unsigned int)rand(), mailbox, getpid(), host);
+		fprintf(p, "Message-ID: <Asterisk-%d-%d-%s-%d@%s>\n", msgnum, (unsigned int)ast_random(), mailbox, getpid(), host);
 		fprintf(p, "MIME-Version: 1.0\n");
 		if (attach_user_voicemail) {
 			/* Something unique. */
-			snprintf(bound, sizeof(bound), "voicemail_%d%s%d%d", msgnum, mailbox, getpid(), (unsigned int)rand());
+			snprintf(bound, sizeof(bound), "voicemail_%d%s%d%d", msgnum, mailbox, getpid(), (unsigned int)ast_random());
 
 			fprintf(p, "Content-Type: multipart/mixed; boundary=\"%s\"\n\n\n", bound);
 

Modified: team/oej/ami_ssl/channels/chan_agent.c
URL: http://svn.digium.com/view/asterisk/team/oej/ami_ssl/channels/chan_agent.c?rev=17742&r1=17741&r2=17742&view=diff
==============================================================================
--- team/oej/ami_ssl/channels/chan_agent.c (original)
+++ team/oej/ami_ssl/channels/chan_agent.c Thu Apr  6 02:46:30 2006
@@ -924,7 +924,7 @@
 			tmp->rawreadformat = AST_FORMAT_SLINEAR;
 		}
 		if (p->pending)
-			ast_string_field_build(tmp, name, "Agent/P%s-%d", p->agent, rand() & 0xffff);
+			ast_string_field_build(tmp, name, "Agent/P%s-%d", p->agent, ast_random() & 0xffff);
 		else
 			ast_string_field_build(tmp, name, "Agent/%s", p->agent);
 		/* Safe, agentlock already held */

Modified: team/oej/ami_ssl/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/team/oej/ami_ssl/channels/chan_iax2.c?rev=17742&r1=17741&r2=17742&view=diff
==============================================================================
--- team/oej/ami_ssl/channels/chan_iax2.c (original)
+++ team/oej/ami_ssl/channels/chan_iax2.c Thu Apr  6 02:46:30 2006
@@ -778,6 +778,7 @@
 static int send_command_immediate(struct chan_iax2_pvt *, char, int, unsigned int, const unsigned char *, int, int);
 static int send_command_final(struct chan_iax2_pvt *, char, int, unsigned int, const unsigned char *, int, int);
 static int send_command_transfer(struct chan_iax2_pvt *, char, int, unsigned int, const unsigned char *, int);
+static struct iax2_peer *build_peer(const char *name, struct ast_variable *v, int temponly);
 static struct iax2_user *build_user(const char *name, struct ast_variable *v, int temponly);
 static void destroy_user(struct iax2_user *user);
 static int expire_registry(void *data);
@@ -1291,7 +1292,7 @@
 		last++;
 	else
 		last = s;
-	snprintf(s2, strlen(s) + 100, "/var/tmp/%s-%ld", last, (unsigned long)rand());
+	snprintf(s2, strlen(s) + 100, "/var/tmp/%s-%ld", last, (unsigned long)ast_random());
 	res = stat(s, &stbuf);
 	if (res < 0) {
 		ast_log(LOG_WARNING, "Failed to stat '%s': %s\n", s, strerror(errno));
@@ -1609,19 +1610,14 @@
 	int res;
 	char iabuf[INET_ADDRSTRLEN];
 	int callno = f->callno;
+
+	/* Don't send if there was an error, but return error instead */
+	if (!callno || !iaxs[callno] || iaxs[callno]->error)
+	    return -1;
 	
 	/* Called with iaxsl held */
-	if (!iaxs[callno])
-		return -1;
 	if (option_debug > 2 && iaxdebug)
 		ast_log(LOG_DEBUG, "Sending %d on %d/%d to %s:%d\n", f->ts, callno, iaxs[callno]->peercallno, ast_inet_ntoa(iabuf, sizeof(iabuf), iaxs[callno]->addr.sin_addr), ntohs(iaxs[callno]->addr.sin_port));
-	/* Don't send if there was an error, but return error instead */
-	if (!callno) {
-		ast_log(LOG_WARNING, "Call number = %d\n", callno);
-		return -1;
-	}
-	if (iaxs[callno]->error)
-		return -1;
 	if (f->transfer) {
 		if (iaxdebug)
 			iax_showframe(f, NULL, 0, &iaxs[callno]->transfer, f->datalen - sizeof(struct ast_iax2_full_hdr));
@@ -1642,6 +1638,30 @@
 	return res;
 }
 
+static void iax2_destroy_helper(struct chan_iax2_pvt *pvt)
+{
+	/* No more pings or lagrq's */
+	if (pvt->pingid > -1)
+		ast_sched_del(sched, pvt->pingid);
+	pvt->pingid = -1;
+	if (pvt->lagid > -1)
+		ast_sched_del(sched, pvt->lagid);
+	pvt->lagid = -1;
+	if (pvt->autoid > -1)
+		ast_sched_del(sched, pvt->autoid);
+	pvt->autoid = -1;
+	if (pvt->authid > -1)
+		ast_sched_del(sched, pvt->authid);
+	pvt->authid = -1;
+	if (pvt->initid > -1)
+		ast_sched_del(sched, pvt->initid);
+	pvt->initid = -1;
+#ifdef NEWJB
+	if (pvt->jbid > -1)
+		ast_sched_del(sched, pvt->jbid);
+	pvt->jbid = -1;
+#endif
+}
 
 static int iax2_predestroy(int callno)
 {
@@ -1654,27 +1674,7 @@
 		return -1;
 	}
 	if (!ast_test_flag(pvt, IAX_ALREADYGONE)) {
-		/* No more pings or lagrq's */
-		if (pvt->pingid > -1)
-			ast_sched_del(sched, pvt->pingid);
-		if (pvt->lagid > -1)
-			ast_sched_del(sched, pvt->lagid);
-		if (pvt->autoid > -1)
-			ast_sched_del(sched, pvt->autoid);
-		if (pvt->authid > -1)
-			ast_sched_del(sched, pvt->authid);
-		if (pvt->initid > -1)
-			ast_sched_del(sched, pvt->initid);
-#ifdef NEWJB
-		if (pvt->jbid > -1)
-			ast_sched_del(sched, pvt->jbid);
-		pvt->jbid = -1;
-#endif
-		pvt->pingid = -1;
-		pvt->lagid = -1;
-		pvt->autoid = -1;
-		pvt->initid = -1;
-		pvt->authid = -1;
+		iax2_destroy_helper(pvt);
 		ast_set_flag(pvt, IAX_ALREADYGONE);	
 	}
 	c = pvt->owner;
@@ -1729,27 +1729,7 @@
 	if (pvt) {
 		if (!owner)
 			pvt->owner = NULL;
-		/* No more pings or lagrq's */
-		if (pvt->pingid > -1)
-			ast_sched_del(sched, pvt->pingid);
-		if (pvt->lagid > -1)
-			ast_sched_del(sched, pvt->lagid);
-		if (pvt->autoid > -1)
-			ast_sched_del(sched, pvt->autoid);
-		if (pvt->authid > -1)
-			ast_sched_del(sched, pvt->authid);
-		if (pvt->initid > -1)
-			ast_sched_del(sched, pvt->initid);
-#ifdef NEWJB
-		if (pvt->jbid > -1)
-			ast_sched_del(sched, pvt->jbid);
-		pvt->jbid = -1;
-#endif
-		pvt->pingid = -1;
-		pvt->lagid = -1;
-		pvt->autoid = -1;
-		pvt->authid = -1;
-		pvt->initid = -1;
+		iax2_destroy_helper(pvt);
 		if (pvt->bridgetrans)
 			ast_translator_free_path(pvt->bridgetrans);
 		pvt->bridgetrans = NULL;
@@ -2706,12 +2686,6 @@
 	return 0;
 }
 
-static struct iax2_peer *build_peer(const char *name, struct ast_variable *v, int temponly);
-static struct iax2_user *build_user(const char *name, struct ast_variable *v, int temponly);
-
-static void destroy_user(struct iax2_user *user);
-static int expire_registry(void *data);
-
 static struct iax2_peer *realtime_peer(const char *peername, struct sockaddr_in *sin)
 {
 	struct ast_variable *var;
@@ -3275,7 +3249,7 @@
 	int res;
 	struct iax_ie_data ied0;
 	struct iax_ie_data ied1;
-	unsigned int transferid = rand();
+	unsigned int transferid = (unsigned int)ast_random();
 	memset(&ied0, 0, sizeof(ied0));
 	iax_ie_append_addr(&ied0, IAX_IE_APPARENT_ADDR, &iaxs[callno1]->addr);
 	iax_ie_append_short(&ied0, IAX_IE_CALLNO, iaxs[callno1]->peercallno);
@@ -3816,9 +3790,9 @@
 	ms = ast_tvdiff_ms(ast_tvnow(), p->rxcore);
 #ifdef IAXTESTS
 	if (test_jit) {
-		if (!test_jitpct || ((100.0 * rand() / (RAND_MAX + 1.0)) < test_jitpct)) {
-			jit = (int)((float)test_jit * rand() / (RAND_MAX + 1.0));
-			if ((int)(2.0 * rand() / (RAND_MAX + 1.0)))
+		if (!test_jitpct || ((100.0 * ast_random() / (RAND_MAX + 1.0)) < test_jitpct)) {
+			jit = (int)((float)test_jit * ast_random() / (RAND_MAX + 1.0));
+			if ((int)(2.0 * ast_random() / (RAND_MAX + 1.0)))
 				jit = -jit;
 			ms += jit;
 		}
@@ -5170,7 +5144,7 @@
 	memset(&ied, 0, sizeof(ied));
 	iax_ie_append_short(&ied, IAX_IE_AUTHMETHODS, p->authmethods);
 	if (p->authmethods & (IAX_AUTH_MD5 | IAX_AUTH_RSA)) {
-		snprintf(p->challenge, sizeof(p->challenge), "%d", rand());
+		snprintf(p->challenge, sizeof(p->challenge), "%d", (int)ast_random());
 		iax_ie_append_str(&ied, IAX_IE_CHALLENGE, p->challenge);
 	}
 	if (p->encmethods)
@@ -5720,17 +5694,19 @@
 	if (reg->expire > -1)
 		ast_sched_del(sched, reg->expire);
 	reg->expire = ast_sched_add(sched, (5 * reg->refresh / 6) * 1000, iax2_do_register_s, reg);
-	if ((inaddrcmp(&oldus, &reg->us) || (reg->messages != oldmsgs)) && (option_verbose > 2)) {
-		if (reg->messages > 65534)
-			snprintf(msgstatus, sizeof(msgstatus), " with message(s) waiting\n");
-		else if (reg->messages > 1)
-			snprintf(msgstatus, sizeof(msgstatus), " with %d messages waiting\n", reg->messages);
-		else if (reg->messages > 0)
-			snprintf(msgstatus, sizeof(msgstatus), " with 1 message waiting\n");
-		else
-			snprintf(msgstatus, sizeof(msgstatus), " with no messages waiting\n");
-		snprintf(ourip, sizeof(ourip), "%s:%d", ast_inet_ntoa(iabuf, sizeof(iabuf), reg->us.sin_addr), ntohs(reg->us.sin_port));
-		ast_verbose(VERBOSE_PREFIX_3 "Registered IAX2 to '%s', who sees us as %s%s\n", ast_inet_ntoa(iabuf, sizeof(iabuf), sin->sin_addr), ourip, msgstatus);
+	if (inaddrcmp(&oldus, &reg->us) || (reg->messages != oldmsgs)) {
+		if (option_verbose > 2) {
+			if (reg->messages > 65534)
+				snprintf(msgstatus, sizeof(msgstatus), " with message(s) waiting\n");
+			else if (reg->messages > 1)
+				snprintf(msgstatus, sizeof(msgstatus), " with %d messages waiting\n", reg->messages);
+			else if (reg->messages > 0)
+				snprintf(msgstatus, sizeof(msgstatus), " with 1 message waiting\n");
+			else
+				snprintf(msgstatus, sizeof(msgstatus), " with no messages waiting\n");
+			snprintf(ourip, sizeof(ourip), "%s:%d", ast_inet_ntoa(iabuf, sizeof(iabuf), reg->us.sin_addr), ntohs(reg->us.sin_port));
+			ast_verbose(VERBOSE_PREFIX_3 "Registered IAX2 to '%s', who sees us as %s%s\n", ast_inet_ntoa(iabuf, sizeof(iabuf), sin->sin_addr), ourip, msgstatus);
+		}
 		manager_event(EVENT_FLAG_SYSTEM, "Registry", "Channel: IAX2\r\nDomain: %s\r\nStatus: Registered\r\n", ast_inet_ntoa(iabuf, sizeof(iabuf), sin->sin_addr));
 	}
 	reg->regstate = REG_STATE_REGISTERED;
@@ -5813,6 +5789,7 @@
 	struct iax2_peer *p = data;
 
 	ast_log(LOG_DEBUG, "Expiring registration for peer '%s'\n", p->name);
+	manager_event(EVENT_FLAG_SYSTEM, "PeerStatus", "Peer: IAX2/%s\r\nPeerStatus: Unregistered\r\nCause: Expired\r\n", p->name);
 	/* Reset the address */
 	memset(&p->addr, 0, sizeof(p->addr));
 	/* Reset expiry value */
@@ -5990,7 +5967,7 @@
 		iax_ie_append_short(&ied, IAX_IE_AUTHMETHODS, p->authmethods);
 		if (p->authmethods & (IAX_AUTH_RSA | IAX_AUTH_MD5)) {
 			/* Build the challenge */
-			snprintf(iaxs[callno]->challenge, sizeof(iaxs[callno]->challenge), "%d", rand());
+			snprintf(iaxs[callno]->challenge, sizeof(iaxs[callno]->challenge), "%d", (int)ast_random());
 			iax_ie_append_str(&ied, IAX_IE_CHALLENGE, iaxs[callno]->challenge);
 		}
 		iax_ie_append_str(&ied, IAX_IE_USERNAME, name);
@@ -6050,29 +6027,9 @@
 	return -1;
 }
 
-static int stop_stuff(int callno)
-{
-		if (iaxs[callno]->lagid > -1)
-			ast_sched_del(sched, iaxs[callno]->lagid);
-		iaxs[callno]->lagid = -1;
-		if (iaxs[callno]->pingid > -1)
-			ast_sched_del(sched, iaxs[callno]->pingid);
-		iaxs[callno]->pingid = -1;
-		if (iaxs[callno]->autoid > -1)
-			ast_sched_del(sched, iaxs[callno]->autoid);
-		iaxs[callno]->autoid = -1;
-		if (iaxs[callno]->initid > -1)
-			ast_sched_del(sched, iaxs[callno]->initid);
-		iaxs[callno]->initid = -1;
-		if (iaxs[callno]->authid > -1)
-			ast_sched_del(sched, iaxs[callno]->authid);
-		iaxs[callno]->authid = -1;
-#ifdef NEWJB
-		if (iaxs[callno]->jbid > -1)
-			ast_sched_del(sched, iaxs[callno]->jbid);
-		iaxs[callno]->jbid = -1;
-#endif
-		return 0;
+static void stop_stuff(int callno)
+{
+	iax2_destroy_helper(iaxs[callno]);
 }
 
 static void __auth_reject(void *nothing)
@@ -6099,9 +6056,8 @@
 {
 	int callno = (int)(long)(data);
 	ast_mutex_lock(&iaxsl[callno]);
-	if (iaxs[callno]) {
+	if (iaxs[callno])
 		iaxs[callno]->authid = -1;
-	}
 	ast_mutex_unlock(&iaxsl[callno]);
 #ifdef SCHED_MULTITHREADED
 	if (schedule_action(__auth_reject, data))
@@ -6559,7 +6515,7 @@
 			ASTOBJ_CONTAINER_LINK_END(&idlelist, thread);
 			return 1;
 		}
-		if (test_losspct && ((100.0*rand()/(RAND_MAX+1.0)) < test_losspct)) { /* simulate random loss condition */
+		if (test_losspct && ((100.0 * ast_random() / (RAND_MAX + 1.0)) < test_losspct)) { /* simulate random loss condition */
 			ASTOBJ_CONTAINER_LINK_END(&idlelist, thread); 
 			return 1;
 		}

Modified: team/oej/ami_ssl/channels/chan_local.c
URL: http://svn.digium.com/view/asterisk/team/oej/ami_ssl/channels/chan_local.c?rev=17742&r1=17741&r2=17742&view=diff
==============================================================================
--- team/oej/ami_ssl/channels/chan_local.c (original)
+++ team/oej/ami_ssl/channels/chan_local.c Thu Apr  6 02:46:30 2006
@@ -478,7 +478,7 @@
 static struct ast_channel *local_new(struct local_pvt *p, int state)
 {
 	struct ast_channel *tmp, *tmp2;
-	int randnum = rand() & 0xffff;
+	int randnum = ast_random() & 0xffff;
 
 	tmp = ast_channel_alloc(1);
 	tmp2 = ast_channel_alloc(1);

Modified: team/oej/ami_ssl/channels/chan_mgcp.c
URL: http://svn.digium.com/view/asterisk/team/oej/ami_ssl/channels/chan_mgcp.c?rev=17742&r1=17741&r2=17742&view=diff
==============================================================================
--- team/oej/ami_ssl/channels/chan_mgcp.c (original)
+++ team/oej/ami_ssl/channels/chan_mgcp.c Thu Apr  6 02:46:30 2006
@@ -2616,7 +2616,7 @@
 	ast_rtp_set_data(p->rtp, p);
 #endif		
 	/* Make a call*ID */
-        snprintf(sub->callid, sizeof(sub->callid), "%08x%s", rand(), sub->txident);
+        snprintf(sub->callid, sizeof(sub->callid), "%08lx%s", ast_random(), sub->txident);
 	/* Transmit the connection create */
 	transmit_connect_with_sdp(sub, NULL);
 	ast_mutex_unlock(&sub->lock);
@@ -3785,7 +3785,7 @@
 					strncpy(e->language, language, sizeof(e->language) - 1);
 					strncpy(e->musicclass, musicclass, sizeof(e->musicclass) - 1);
 					strncpy(e->mailbox, mailbox, sizeof(e->mailbox) - 1);
-					snprintf(e->rqnt_ident, sizeof(e->rqnt_ident), "%08x", rand());
+					snprintf(e->rqnt_ident, sizeof(e->rqnt_ident), "%08lx", ast_random());
 					e->msgstate = -1;
 					e->amaflags = amaflags;
 					e->capability = capability;
@@ -3811,7 +3811,7 @@
 					/* ASSUME we're onhook */
 					e->hookstate = MGCP_ONHOOK;
 					if (!ep_reload) {
-						/*snprintf(txident, sizeof(txident), "%08x", rand());*/
+						/*snprintf(txident, sizeof(txident), "%08lx", ast_random());*/
 						for (i = 0; i < MAX_SUBS; i++) {
 							sub = malloc(sizeof(struct mgcp_subchannel));
 							if (sub) {
@@ -3821,7 +3821,7 @@
 								ast_mutex_init(&sub->cx_queue_lock);
 								sub->parent = e;
 								sub->id = i;
-								snprintf(sub->txident, sizeof(sub->txident), "%08x", rand());
+								snprintf(sub->txident, sizeof(sub->txident), "%08lx", ast_random());
 								/*stnrcpy(sub->txident, txident, sizeof(sub->txident) - 1);*/
 								sub->cxmode = MGCP_CX_INACTIVE;
 								sub->nat = nat;
@@ -3916,7 +3916,7 @@
 						e->onhooktime = time(NULL);
 						/* ASSUME we're onhook */
 						e->hookstate = MGCP_ONHOOK;
-						snprintf(e->rqnt_ident, sizeof(e->rqnt_ident), "%08x", rand());
+						snprintf(e->rqnt_ident, sizeof(e->rqnt_ident), "%08lx", ast_random());
 					}
 
 					for (i = 0, sub = NULL; i < MAX_SUBS; i++) {
@@ -3938,7 +3938,7 @@
 								strncpy(sub->magic, MGCP_SUBCHANNEL_MAGIC, sizeof(sub->magic) - 1);
 								sub->parent = e;
 								sub->id = i;
-								snprintf(sub->txident, sizeof(sub->txident), "%08x", rand());
+								snprintf(sub->txident, sizeof(sub->txident), "%08lx", ast_random());
 								sub->cxmode = MGCP_CX_INACTIVE;
 								sub->next = e->sub;
 								e->sub = sub;

Modified: team/oej/ami_ssl/channels/chan_misdn.c
URL: http://svn.digium.com/view/asterisk/team/oej/ami_ssl/channels/chan_misdn.c?rev=17742&r1=17741&r2=17742&view=diff
==============================================================================
--- team/oej/ami_ssl/channels/chan_misdn.c (original)
+++ team/oej/ami_ssl/channels/chan_misdn.c Thu Apr  6 02:46:30 2006
@@ -1218,6 +1218,9 @@
 		}
 		
 		ch->jb=misdn_jb_init(len, threshold);
+
+		if (!ch->jb ) 
+			bc->nojitter=1;
 	}
 }
 
@@ -1413,6 +1416,27 @@
 		
 		
 	} else { /** ORIGINATOR MISDN **/
+	
+		misdn_cfg_get( port, MISDN_CFG_CPNDIALPLAN, &bc->cpnnumplan, sizeof(int));
+
+		switch (bc->cpnnumplan) {
+			case NUMPLAN_INTERNATIONAL:
+				chan_misdn_log(2, port, " --> CTON: International\n");
+				break;
+			case NUMPLAN_NATIONAL:
+				chan_misdn_log(2, port, " --> CTON: National\n");
+				break;
+			case NUMPLAN_SUBSCRIBER:
+				chan_misdn_log(2, port, " --> CTON: Subscriber\n");
+				break;
+			case NUMPLAN_UNKNOWN:
+				chan_misdn_log(2, port, " --> CTON: Unknown\n");
+				break;
+				/* Maybe we should cut off the prefix if present ? */
+			default:
+				chan_misdn_log(0, port, " --> !!!! Wrong dialplan setting, please see the misdn.conf sample file\n ");
+				break;
+		}
 		
 		char prefix[BUFFERSIZE+1]="";
 		switch( bc->onumplan ) {
@@ -1684,6 +1708,12 @@
 	}
 	
 	p->state = MISDN_CONNECTED;
+
+	if ( ast_strlen_zero(p->bc->cad) ) {
+		chan_misdn_log(2,p->bc->port," --> empty cad using dad\n");
+		ast_copy_string(p->bc->cad,p->bc->dad,sizeof(p->bc->cad));
+	}
+
 	misdn_lib_send_event( p->bc, EVENT_CONNECT);
 	start_bc_tones(p);
 	
@@ -1930,7 +1960,6 @@
 	
 	release_unlock;
 	
-	
 	{
 		const char *varcause=NULL;
 		bc->cause=ast->hangupcause?ast->hangupcause:16;
@@ -2012,6 +2041,7 @@
     
 	}
 	
+
 	chan_misdn_log(1, bc->port, "Channel: %s hanguped\n",ast->name);
 	
 	return 0;
@@ -2107,7 +2137,7 @@
 	}
 
 	if ( ! ch->bc->addr ) {
-		chan_misdn_log(4, ch->bc->port, "misdn_write: no addr for bc dropping:%d\n", frame->samples);
+		chan_misdn_log(8, ch->bc->port, "misdn_write: no addr for bc dropping:%d\n", frame->samples);
 		return 0;
 	}
 	
@@ -2128,7 +2158,7 @@
 		case BCHAN_BRIDGED:
 			break;
 		default:
-		chan_misdn_log(5, ch->bc->port, "BC not active (nor bridged) droping: %d frames addr:%x\n",frame->samples,ch->bc->addr);
+		chan_misdn_log(5, ch->bc->port, "BC not active (nor bridged) droping: %d frames addr:%x exten:%s cid:%s ch->state:%s\n",frame->samples,ch->bc->addr, ast->exten, ast->cid.cid_num,misdn_get_ch_state( ch));
 		return 0;
 	}
 	
@@ -3490,7 +3520,21 @@
 	}
 	break;
 	case EVENT_CONNECT:
+	{
 		misdn_lib_send_event(bc,EVENT_CONNECT_ACKNOWLEDGE);
+	
+		struct ast_channel *bridged=AST_BRIDGED_P(ch->ast);
+		
+		if (bridged && strcasecmp(bridged->tech->type,"mISDN")) {
+			struct chan_list *bridged_ch=MISDN_ASTERISK_TECH_PVT(bridged);
+
+			chan_misdn_log(1,bc->port," --> copying cpndialplan:%d and cad:%s to the A-Channel\n",bc->cpnnumplan,bc->cad);
+
+			bridged_ch->bc->cpnnumplan=bc->cpnnumplan;
+			ast_copy_string(bridged_ch->bc->cad,bc->cad,sizeof(bc->cad));
+		}
+	}
+
 	case EVENT_CONNECT_ACKNOWLEDGE:
 	{
 		ch->l3id=bc->l3_id;
@@ -4227,7 +4271,19 @@
     jb->state_empty = 0;
     jb->bytes_wrote = 0;
     jb->samples = (char *)malloc(size*sizeof(char));
+
+    if (!jb->samples) {
+	    chan_misdn_log(-1,0,"No free Mem for jb->samples\n");
+	    return NULL;
+    }
+    
     jb->ok = (char *)malloc(size*sizeof(char));
+
+    if (!jb->ok) {
+	    chan_misdn_log(-1,0,"No free Mem for jb->ok\n");
+	    return NULL;
+    }
+
     for(i=0; i<size; i++)
  	jb->ok[i]=0;
 
@@ -4240,7 +4296,6 @@
 void misdn_jb_destroy(struct misdn_jb *jb)
 {
 	ast_mutex_destroy(&jb->mutexjb);
-	
 	
 	free(jb->samples);
 	free(jb);
@@ -4374,7 +4429,8 @@
 {
 	if (! ((0 <= port) && (port <= max_ports))) {
 		ast_log(LOG_WARNING, "cb_log called with out-of-range port number! (%d)\n", port);
-		port=-1;
+		port=0;
+		level=-1;
 	}
 		
 	va_list ap;

Modified: team/oej/ami_ssl/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/oej/ami_ssl/channels/chan_sipc?rev=17742&r1=17741&r2=17742&view=diff
==============================================================================
--- team/oej/ami_ssl/channels/chan_sip.c (original)
+++ team/oej/ami_ssl/channels/chan_sip.c Thu Apr  6 02:46:30 2006
@@ -453,8 +453,6 @@
 static struct ast_flags global_flags[2] = {{0}};	/*!< global SIP_ flags */
 
 AST_MUTEX_DEFINE_STATIC(usecnt_lock);
-
-AST_MUTEX_DEFINE_STATIC(rand_lock);			/*!< Lock for thread-safe random generator */
 
 /*! \brief Protect the SIP dialog list (of sip_pvt's) */
 AST_MUTEX_DEFINE_STATIC(iflock);
@@ -704,7 +702,7 @@
 	int callingpres;			/*!< Calling presentation */
 	int authtries;				/*!< Times we've tried to authenticate */
 	int expiry;				/*!< How long we take to expire */
-	int branch;				/*!< One random number */
+	long branch;				/*!< One random number */
 	char tag[11];				/*!< Another random number */
 	int sessionid;				/*!< SDP Session ID */
 	int sessionversion;			/*!< SDP Session Version */
@@ -1038,24 +1036,6 @@
 	get_codec: sip_get_codec,
 };
 
-
-/*!
-  \brief Thread-safe random number generator
-  \return a random number
-
-  This function uses a mutex lock to guarantee that no
-  two threads will receive the same random number.
- */
-static force_inline int thread_safe_rand(void)
-{
-	int val;
-
-	ast_mutex_lock(&rand_lock);
-	val = rand();
-	ast_mutex_unlock(&rand_lock);
-	
-	return val;
-}
 
 /*! \brief Find SIP method from header

[... 2158 lines stripped ...]
_______________________________________________
--Bandwidth and Colocation provided by Easynews.com --

svn-commits mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/svn-commits


More information about the asterisk-commits mailing list