[asterisk-commits] branch group/autoconf_and_menuselect r17127 - in /team/group/autoconf_and_men...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Mon Apr 3 12:13:07 MST 2006


Author: russell
Date: Mon Apr  3 14:12:51 2006
New Revision: 17127

URL: http://svn.digium.com/view/asterisk?rev=17127&view=rev
Log: (empty)

Modified:
    team/group/autoconf_and_menuselect/   (props changed)
    team/group/autoconf_and_menuselect/channels/chan_h323.c
    team/group/autoconf_and_menuselect/channels/chan_sip.c
    team/group/autoconf_and_menuselect/channels/h323/ast_h323.cpp
    team/group/autoconf_and_menuselect/http.c
    team/group/autoconf_and_menuselect/include/asterisk/doxyref.h
    team/group/autoconf_and_menuselect/include/asterisk/http.h
    team/group/autoconf_and_menuselect/manager.c

Propchange: team/group/autoconf_and_menuselect/
------------------------------------------------------------------------------
Binary property 'branch-1.2-blocked' - no diff available.

Propchange: team/group/autoconf_and_menuselect/
------------------------------------------------------------------------------
Binary property 'branch-1.2-merged' - no diff available.

Propchange: team/group/autoconf_and_menuselect/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Mon Apr  3 14:12:51 2006
@@ -1,1 +1,1 @@
-/trunk:1-17057
+/trunk:1-17126

Modified: team/group/autoconf_and_menuselect/channels/chan_h323.c
URL: http://svn.digium.com/view/asterisk/team/group/autoconf_and_menuselect/channels/chan_h323.c?rev=17127&r1=17126&r2=17127&view=diff
==============================================================================
--- team/group/autoconf_and_menuselect/channels/chan_h323.c (original)
+++ team/group/autoconf_and_menuselect/channels/chan_h323.c Mon Apr  3 14:12:51 2006
@@ -78,6 +78,7 @@
 #include "asterisk/cli.h"
 #include "asterisk/dsp.h"
 #include "asterisk/causes.h"
+#include "asterisk/stringfields.h"
 #ifdef __cplusplus
 }
 #endif
@@ -101,12 +102,13 @@
 int h323debug;
 
 /** Variables required by Asterisk */
-static const char type[] = "H323";
 static const char desc[] = "The NuFone Network's Open H.323 Channel Driver";
 static const char tdesc[] = "The NuFone Network's Open H.323 Channel Driver";
 static const char config[] = "h323.conf";
 static char default_context[AST_MAX_CONTEXT] = "default";
 static struct sockaddr_in bindaddr;
+
+#define GLOBAL_CAPABILITY (AST_FORMAT_G723_1 | AST_FORMAT_GSM | AST_FORMAT_ULAW | AST_FORMAT_ALAW | AST_FORMAT_G729A | AST_FORMAT_H261)
 
 /** H.323 configuration values */
 static int h323_signalling_port = 1720;
@@ -206,9 +208,9 @@
 static int oh323_fixup(struct ast_channel *oldchan, struct ast_channel *newchan);
 
 static const struct ast_channel_tech oh323_tech = {
-	.type = type,
+	.type = "H323",
 	.description = tdesc,
-	.capabilities = AST_FORMAT_ULAW,
+	.capabilities = ((AST_FORMAT_MAX_AUDIO << 1) - 1),
 	.properties = AST_CHAN_TP_WANTSJITTER,
 	.requester = oh323_request,
 	.send_digit = oh323_digit,
@@ -496,7 +498,7 @@
 	if (c->hangupcause) {
 		q931cause = c->hangupcause;
 	} else {
-		char *cause = pbx_builtin_getvar_helper(c, "DIALSTATUS");
+		const char *cause = pbx_builtin_getvar_helper(c, "DIALSTATUS");
 		if (cause) {
 			if (!strcmp(cause, "CONGESTION")) {
 				q931cause = AST_CAUSE_NORMAL_CIRCUIT_CONGESTION;
@@ -735,14 +737,13 @@
 	ast_mutex_lock(&pvt->lock);
 	if (ch) {
 		ch->tech = &oh323_tech;
-		snprintf(ch->name, sizeof(ch->name), "H323/%s", host);
+		ast_string_field_build(ch, name, "H323/%s", host);
 		ch->nativeformats = pvt->options.capability;
 		if (!ch->nativeformats) {
 			ch->nativeformats = global_options.capability;
 		}
 		pvt->nativeformats = ch->nativeformats;
 		fmt = ast_best_codec(ch->nativeformats);
-		ch->type = type;
 		ch->fds[0] = ast_rtp_fd(pvt->rtp);
 		if (state == AST_STATE_RING) {
 			ch->rings = 1;
@@ -765,7 +766,7 @@
 		strncpy(ch->exten, pvt->exten, sizeof(ch->exten) - 1);		
 		ch->priority = 1;
 		if (!ast_strlen_zero(pvt->accountcode)) {
-			strncpy(ch->accountcode, pvt->accountcode, sizeof(ch->accountcode) - 1);
+			ast_string_field_set(ch, accountcode, pvt->accountcode);
 		}
 		if (pvt->amaflags) {
 			ch->amaflags = pvt->amaflags;
@@ -1234,7 +1235,6 @@
   */
 void connection_made(unsigned call_reference, const char *token)
 {
-	struct ast_channel *c = NULL;
 	struct oh323_pvt *pvt;
 
 	if (h323debug)
@@ -1436,7 +1436,6 @@
   */
 void chan_ringing(unsigned call_reference, const char *token)
 {
-	struct ast_channel *c = NULL;
 	struct oh323_pvt *pvt;
 
 	if (h323debug)
@@ -1479,7 +1478,7 @@
 			break;
 #if 1
 #ifdef DEBUG_THREADS
-		ast_log(LOG_NOTICE, "Avoiding H.323 destory deadlock on %s, locked at %ld/%d by %s (%s:%d)\n", call_token, pvt->owner->lock.thread, pvt->owner->lock.reentrancy, pvt->owner->lock.func, pvt->owner->lock.file, pvt->owner->lock.lineno);
+		ast_log(LOG_NOTICE, "Avoiding H.323 destory deadlock on %s, locked at %ld/%d by %s (%s:%d)\n", call_token, pvt->owner->lock.thread[0], pvt->owner->lock.reentrancy, pvt->owner->lock.func[0], pvt->owner->lock.file[0], pvt->owner->lock.lineno[0]);
 #else
 		ast_log(LOG_NOTICE, "Avoiding H.323 destory deadlock on %s\n", call_token);
 #endif
@@ -2026,7 +2025,7 @@
 	memset(&global_options, 0, sizeof(global_options));
 	global_options.dtmfcodec = 101;
 	global_options.dtmfmode = H323_DTMF_RFC2833;
-	global_options.capability = ~0;	/* All capabilities */
+	global_options.capability = GLOBAL_CAPABILITY;
 	global_options.bridge = 1;		/* Do native bridging by default */
 	v = ast_variable_browse(cfg, "general");
 	while(v) {
@@ -2282,7 +2281,7 @@
 	}
 }
 
-static int oh323_set_rtp_peer(struct ast_channel *chan, struct ast_rtp *rtp, struct ast_rtp *vrtp, int codecs)
+static int oh323_set_rtp_peer(struct ast_channel *chan, struct ast_rtp *rtp, struct ast_rtp *vrtp, int codecs, int nat_active)
 {
 	/* XXX Deal with Video */
 	struct oh323_pvt *pvt;
@@ -2308,7 +2307,7 @@
 }
 
 static struct ast_rtp_protocol oh323_rtp = {
-	.type = type,
+	.type = "H323",
 	.get_rtp_info = oh323_get_rtp_peer,
 	.get_vrtp_info = oh323_get_vrtp_peer,
 	.set_rtp_peer=  oh323_set_rtp_peer,
@@ -2334,7 +2333,7 @@
 	} else {
 		/* Make sure we can register our channel type */
 		if (ast_channel_register(&oh323_tech)) {
-			ast_log(LOG_ERROR, "Unable to register channel class %s\n", type);
+			ast_log(LOG_ERROR, "Unable to register channel class 'H323'\n");
 			h323_end_process();
 			return -1;
 		}

Modified: team/group/autoconf_and_menuselect/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/group/autoconf_and_menuselect/channels/chan_sip.c?rev=17127&r1=17126&r2=17127&view=diff
==============================================================================
--- team/group/autoconf_and_menuselect/channels/chan_sip.c (original)
+++ team/group/autoconf_and_menuselect/channels/chan_sip.c Mon Apr  3 14:12:51 2006
@@ -4362,7 +4362,7 @@
 	add_header_contentLength(&resp, 0);
 	/* If we are cancelling an incoming invite for some reason, add information
 		about the reason why we are doing this in clear text */
-	if (p->owner && p->owner->hangupcause) {
+	if (msg[0] != '1' && p->owner && p->owner->hangupcause) {
 		add_header(&resp, "X-Asterisk-HangupCause", ast_cause2str(p->owner->hangupcause));
 	}
 	add_blank_header(&resp);

Modified: team/group/autoconf_and_menuselect/channels/h323/ast_h323.cpp
URL: http://svn.digium.com/view/asterisk/team/group/autoconf_and_menuselect/channels/h323/ast_h323.cpp?rev=17127&r1=17126&r2=17127&view=diff
==============================================================================
--- team/group/autoconf_and_menuselect/channels/h323/ast_h323.cpp (original)
+++ team/group/autoconf_and_menuselect/channels/h323/ast_h323.cpp Mon Apr  3 14:12:51 2006
@@ -1,4 +1,6 @@
+#ifndef _GNU_SOURCE
 #define _GNU_SOURCE
+#endif
 /*
  * ast_h323.cpp
  *

Modified: team/group/autoconf_and_menuselect/http.c
URL: http://svn.digium.com/view/asterisk/team/group/autoconf_and_menuselect/http.c?rev=17127&r1=17126&r2=17127&view=diff
==============================================================================
--- team/group/autoconf_and_menuselect/http.c (original)
+++ team/group/autoconf_and_menuselect/http.c Mon Apr  3 14:12:51 2006
@@ -18,10 +18,13 @@
 
 /*!
  * \file 
- * \brief http server
+ * \brief http server for AMI access
  *
+ * \author Mark Spencer <markster at digium.com>
  * This program implements a tiny http server supporting the "get" method
  * only and was inspired by micro-httpd by Jef Poskanzer 
+ * 
+ * \ref AstHTTP - AMI over the http protocol
  */
 
 #include <sys/types.h>
@@ -41,6 +44,9 @@
 #include <pthread.h>
 
 #include "asterisk.h"
+
+ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
+
 #include "asterisk/cli.h"
 #include "asterisk/http.h"
 #include "asterisk/utils.h"
@@ -67,7 +73,7 @@
 static struct sockaddr_in oldsin;
 static int enablestatic=0;
 
-/* Limit the kinds of files we're willing to serve up */
+/*! \brief Limit the kinds of files we're willing to serve up */
 static struct {
 	char *ext;
 	char *mtype;
@@ -360,18 +366,21 @@
 	if (fgets(buf, sizeof(buf), ser->f)) {
 		/* Skip method */
 		uri = buf;
-		while(*uri && (*uri > 32)) uri++;
+		while(*uri && (*uri > 32))
+			uri++;
 		if (*uri) {
 			*uri = '\0';
 			uri++;
 		}
 
 		/* Skip white space */
-		while (*uri && (*uri < 33)) uri++;
+		while (*uri && (*uri < 33))
+			uri++;
 
 		if (*uri) {
 			c = uri;
-			while (*c && (*c > 32)) c++;
+			while (*c && (*c > 32))
+				 c++;
 			if (*c) {
 				*c = '\0';
 			}
@@ -492,7 +501,7 @@
 	return NULL;
 }
 
-char *ast_http_setcookie(const char *var, const char *val, int expires, char *buf, int buflen)
+char *ast_http_setcookie(const char *var, const char *val, int expires, char *buf, size_t buflen)
 {
 	char *c;
 	c = buf;
@@ -575,6 +584,7 @@
 	struct hostent *hp;
 	struct ast_hostent ahp;
 	char newprefix[MAX_PREFIX];
+
 	memset(&sin, 0, sizeof(sin));
 	sin.sin_port = 8088;
 	strcpy(newprefix, DEFAULT_PREFIX);
@@ -654,7 +664,7 @@
 
 static struct ast_cli_entry http_cli[] = {
 	{ { "show", "http", NULL }, handle_show_http,
-	  "Display HTTP status", show_http_help },
+	  "Display HTTP server status", show_http_help },
 };
 
 int ast_http_init(void)

Modified: team/group/autoconf_and_menuselect/include/asterisk/doxyref.h
URL: http://svn.digium.com/view/asterisk/team/group/autoconf_and_menuselect/include/asterisk/doxyref.h?rev=17127&r1=17126&r2=17127&view=diff
==============================================================================
--- team/group/autoconf_and_menuselect/include/asterisk/doxyref.h (original)
+++ team/group/autoconf_and_menuselect/include/asterisk/doxyref.h Mon Apr  3 14:12:51 2006
@@ -37,6 +37,7 @@
  *  \arg \ref AstREADME
  *  \arg \ref AstVar
  *  \arg \ref AstENUM : The IETF way to redirect from phone numbers to VoIP calls
+ *  \arg \ref AstHTTP
  *  \arg \ref ConfigFiles
  *  \arg \ref SoundFiles included in the Asterisk distribution
  *  \arg \ref AstCREDITS : A Thank You to contributors
@@ -227,8 +228,16 @@
  * \verbinclude mgcp.conf.sample
  */
 
+/*! \page README_misdn MISDN documentation
+ * \arg See \ref Config_misdn
+ * \section mISDN configuration
+ * \verbinclude misdn.txt
+ */
+
 /*! \page Config_misdn MISDN configuration
  * \arg Implemented in \ref chan_misdn.c
+ * \arg \ref README_misdn
+ * \arg See the mISDN home page: http://www.isdn4linux.de/mISDN/
  * \section misdnconf misdn.conf
  * \verbinclude misdn.conf.sample
  */
@@ -446,3 +455,12 @@
  *  \par See also
  *  \arg \ref codecs 
  */
+
+/*! \page AstHTTP AMI over HTTP support
+ * The http.c file includes support for manager transactions over
+ * http.
+ *  \section ami AMI - The manager Interface
+ *  \arg \link Config_ami Configuration file \endlink
+ *  \verbinclude http.txt
+ */
+

Modified: team/group/autoconf_and_menuselect/include/asterisk/http.h
URL: http://svn.digium.com/view/asterisk/team/group/autoconf_and_menuselect/include/asterisk/http.h?rev=17127&r1=17126&r2=17127&view=diff
==============================================================================
--- team/group/autoconf_and_menuselect/include/asterisk/http.h (original)
+++ team/group/autoconf_and_menuselect/include/asterisk/http.h Mon Apr  3 14:12:51 2006
@@ -16,10 +16,6 @@
  * at the top of the source tree.
  */
 
-/*
- * DNS SRV record support
- */
-
 #ifndef _ASTERISK_HTTP_H
 #define _ASTERISK_HTTP_H
 
@@ -30,9 +26,10 @@
   \brief Support for Private Asterisk HTTP Servers.
   \note Note: The Asterisk HTTP servers are extremely simple and minimal and
         only support the "GET" method.
+  \author Mark Spencer <markster at digium.com>
 */
 
-/* HTTP Callbacks take the socket, the method and the path as arguments and should
+/*! \brief HTTP Callbacks take the socket, the method and the path as arguments and should
    return the content, allocated with malloc().  Status should be changed to reflect
    the status of the request if it isn't 200 and title may be set to a malloc()'d string
    to an appropriate title for non-200 responses.  Content length may also be specified. 
@@ -49,16 +46,16 @@
 	ast_http_callback callback;
 };
 
-/* Link into the Asterisk HTTP server */
+/*! \brief Link into the Asterisk HTTP server */
 int ast_http_uri_link(struct ast_http_uri *urihandler);
 
-/* Return a malloc()'d string containing an HTTP error message */
+/*! \brief Return a malloc()'d string containing an HTTP error message */
 char *ast_http_error(int status, const char *title, const char *extra_header, const char *text);
 
-/* Destroy an HTTP server */
+/*! \brief Destroy an HTTP server */
 void ast_http_uri_unlink(struct ast_http_uri *urihandler);
 
-char *ast_http_setcookie(const char *var, const char *val, int expires, char *buf, int buflen);
+char *ast_http_setcookie(const char *var, const char *val, int expires, char *buf, size_t buflen);
 
 int ast_http_init(void);
 int ast_http_reload(void);

Modified: team/group/autoconf_and_menuselect/manager.c
URL: http://svn.digium.com/view/asterisk/team/group/autoconf_and_menuselect/manager.c?rev=17127&r1=17126&r2=17127&view=diff
==============================================================================
--- team/group/autoconf_and_menuselect/manager.c (original)
+++ team/group/autoconf_and_menuselect/manager.c Mon Apr  3 14:12:51 2006
@@ -237,7 +237,7 @@
 	return ret;
 }
 
-static void xml_copy_escape(char **dst, int *maxlen, const char *src, int lower)
+static void xml_copy_escape(char **dst, size_t *maxlen, const char *src, int lower)
 {
 	while (*src && (*maxlen > 6)) {
 		switch(*src) {
@@ -273,6 +273,7 @@
 		src++;
 	}
 }
+
 static char *xml_translate(char *in, struct ast_variable *vars)
 {
 	struct ast_variable *v;
@@ -281,12 +282,13 @@
 	char *objtype=NULL;
 	int colons = 0;
 	int breaks = 0;
-	int len;
+	size_t len;
 	int count = 1;
 	int escaped = 0;
 	int inobj = 0;
 	int x;
 	v = vars;
+
 	while(v) {
 		if (!dest && !strcasecmp(v->name, "ajaxdest"))
 			dest = v->value;
@@ -298,7 +300,7 @@
 		dest = "unknown";
 	if (!objtype)
 		objtype = "generic";
-	for (x=0;in[x];x++) {
+	for (x=0; in[x]; x++) {
 		if (in[x] == ':')
 			colons++;
 		else if (in[x] == '\n')
@@ -306,14 +308,15 @@
 		else if (strchr("&\"<>", in[x]))
 			escaped++;
 	}
-	len = strlen(in) + colons * 5 + breaks * (40 + strlen(dest) + strlen(objtype)) + escaped * 10; /* foo="bar", "<response type=\"object\" id=\"dest\"", "&amp;" */
+	len = (size_t) (strlen(in) + colons * 5 + breaks * (40 + strlen(dest) + strlen(objtype)) + escaped * 10); /* foo="bar", "<response type=\"object\" id=\"dest\"", "&amp;" */
 	out = malloc(len);
 	if (!out)
 		return 0;
 	tmp = out;
 	while(*in) {
 		var = in;
-		while (*in && (*in >= 32)) in++;
+		while (*in && (*in >= 32))
+			in++;
 		if (*in) {
 			if ((count > 3) && inobj) {
 				ast_build_string(&tmp, &len, " /></response>\n");
@@ -353,10 +356,11 @@
 	int x;
 	int colons = 0;
 	int breaks = 0;
-	int len;
+	size_t len;
 	int count=1;
 	char *tmp, *var, *val, *out;
-	for (x=0;in[x];x++) {
+
+	for (x=0; in[x]; x++) {
 		if (in[x] == ':')
 			colons++;
 		if (in[x] == '\n')
@@ -369,7 +373,8 @@
 	tmp = out;
 	while(*in) {
 		var = in;
-		while (*in && (*in >= 32)) in++;
+		while (*in && (*in >= 32))
+			in++;
 		if (*in) {
 			if ((count % 4) == 0){
 				ast_build_string(&tmp, &len, "<tr><td colspan=\"2\"><hr></td></tr>\r\n");
@@ -405,20 +410,20 @@
 	va_end(ap);
 	if (res == -1) {
 		ast_log(LOG_ERROR, "Memory allocation failure\n");
-	} else {
-		if (s->fd > -1)
-			ast_carefulwrite(s->fd, stuff, strlen(stuff), s->writetimeout);
-		else {
-			tmp = realloc(s->outputstr, (s->outputstr ? strlen(s->outputstr) : 0) + strlen(stuff) + 1);
-			if (tmp) {
-				if (!s->outputstr)
-					tmp[0] = '\0';
-				s->outputstr = tmp;
-				strcat(s->outputstr, stuff);
-			}
-		}
-		free(stuff);
-	}
+		return;
+	} 
+	if (s->fd > -1)
+		ast_carefulwrite(s->fd, stuff, strlen(stuff), s->writetimeout);
+	else {
+		tmp = realloc(s->outputstr, (s->outputstr ? strlen(s->outputstr) : 0) + strlen(stuff) + 1);
+		if (tmp) {
+			if (!s->outputstr)
+				tmp[0] = '\0';
+			s->outputstr = tmp;
+			strcat(s->outputstr, stuff);
+		}
+	}
+	free(stuff);
 }
 
 static int handle_showmancmd(int fd, int argc, char *argv[])
@@ -2139,7 +2144,7 @@
 	char workspace[256];
 	char cookie[128];
 	char iabuf[INET_ADDRSTRLEN];
-	int len = sizeof(workspace);
+	size_t len = sizeof(workspace);
 	int blastaway = 0;
 	char *c = workspace;
 	char *retval=NULL;



More information about the asterisk-commits mailing list