[asterisk-commits] branch oej/sipregister r8837 - in /team/oej/sipregister: ./ channels/chan_sip.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Sat Jan 28 10:46:15 MST 2006


Author: oej
Date: Sat Jan 28 11:46:13 2006
New Revision: 8837

URL: http://svn.digium.com/view/asterisk?rev=8837&view=rev
Log:
Merged revisions 8834-8835 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

........
r8834 | oej | 2006-01-28 18:00:05 +0100 (Sat, 28 Jan 2006) | 3 lines

Change booleans to TRUE/FALSE. 
(At some point we should implement these as enums to simplify debugging)

........
r8835 | oej | 2006-01-28 18:17:37 +0100 (Sat, 28 Jan 2006) | 3 lines

- Remove unused "resetinvite" variable
- Use TRUE/FALSE for fastrestart

........

Modified:
    team/oej/sipregister/   (props changed)
    team/oej/sipregister/channels/chan_sip.c

Propchange: team/oej/sipregister/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Sat Jan 28 11:46:13 2006
@@ -1,1 +1,1 @@
-/trunk:1-8826
+/trunk:1-8836

Modified: team/oej/sipregister/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/oej/sipregister/channels/chan_sip.c?rev=8837&r1=8836&r2=8837&view=diff
==============================================================================
--- team/oej/sipregister/channels/chan_sip.c (original)
+++ team/oej/sipregister/channels/chan_sip.c Sat Jan 28 11:46:13 2006
@@ -440,7 +440,7 @@
    which are not currently in use.  */
 static pthread_t monitor_thread = AST_PTHREADT_NULL;
 
-static int sip_reloading = 0;			/*!< Flag for avoiding multiple reloads at the same time */
+static int sip_reloading = FALSE;			/*!< Flag for avoiding multiple reloads at the same time */
 static enum channelreloadreason sip_reloadreason;	/*!< Reason for last reload/load of configuration */
 
 static struct sched_context *sched;
@@ -1389,7 +1389,6 @@
 {
 	struct sip_pkt *cur, *prev = NULL;
 	int res = -1;
-	int resetinvite = 0;
 
 	/* Just in case... */
 	char *msg;
@@ -1405,7 +1404,6 @@
 			if (!resp && (seqno == p->pendinginvite)) {
 				ast_log(LOG_DEBUG, "Acked pending invite %d\n", p->pendinginvite);
 				p->pendinginvite = 0;
-				resetinvite = 1;
 			}
 			/* this is our baby */
 			if (prev)
@@ -2482,7 +2480,7 @@
 static int sip_hangup(struct ast_channel *ast)
 {
 	struct sip_pvt *p = ast->tech_pvt;
-	int needcancel = 0;
+	int needcancel = FALSE;
 	struct ast_flags locflags = {0};
 
 	if (!p) {
@@ -2509,7 +2507,7 @@
 	}
 	/* If the call is not UP, we need to send CANCEL instead of BYE */
 	if (ast->_state != AST_STATE_UP)
-		needcancel = 1;
+		needcancel = TRUE;
 
 	/* Disconnect */
 	p = ast->tech_pvt;
@@ -3260,7 +3258,7 @@
 	ast_mutex_lock(&iflock);
 	p = iflist;
 	while(p) {	/* In pedantic, we do not want packets with bad syntax to be connected to a PVT */
-		int found = 0;
+		int found = FALSE;
 		if (req->method == SIP_REGISTER)
 			found = (!strcmp(p->callid, callid));
 		else 
@@ -3274,10 +3272,10 @@
 		if (pedanticsipchecking && found  && req->method != SIP_RESPONSE) {	/* SIP Request */
 			if (p->tag[0] == '\0' && totag[0]) {
 				/* We have no to tag, but they have. Wrong dialog */
-				found = 0;
+				found = FALSE;
 			} else if (totag[0]) {			/* Both have tags, compare them */
 				if (strcmp(totag, p->tag)) {
-					found = 0;		/* This is not our packet */
+					found = FALSE;		/* This is not our packet */
 				}
 			}
 			if (!found && option_debug > 4)
@@ -3388,7 +3386,7 @@
 	reg->timeout =  -1;
 	reg->refresh = default_expiry;
 	reg->portno = portnum;
-	reg->callid_valid = 0;
+	reg->callid_valid = FALSE;
 	reg->ocseq = 101;
 	ASTOBJ_CONTAINER_LINK(&regl, reg);		/* Add the new registry entry to the list */
 	ASTOBJ_UNREF(reg,sip_registry_destroy);
@@ -4158,7 +4156,7 @@
 	const char *c;
 	char *n;
 	char *ot, *of;
-	int is_strict = 0;		/*!< Strict routing flag */
+	int is_strict = FALSE;		/*!< Strict routing flag */
 
 	memset(req, 0, sizeof(struct sip_request));
 	
@@ -4176,7 +4174,7 @@
 
 	/* Check for strict or loose router */
 	if (p->route && !ast_strlen_zero(p->route->hop) && strstr(p->route->hop,";lr") == NULL) {
-		is_strict = 1;
+		is_strict = TRUE;
 		if (sipdebug)
 			ast_log(LOG_DEBUG, "Strict routing enforced for session %s\n", p->callid);
 	}
@@ -4765,7 +4763,7 @@
 /*! \brief Build the Remote Party-ID & From using callingpres options */
 static void build_rpid(struct sip_pvt *p)
 {
-	int send_pres_tags = 1;
+	int send_pres_tags = TRUE;
 	const char *privacy=NULL;
 	const char *screen=NULL;
 	char buf[256];
@@ -4818,7 +4816,7 @@
 		screen = "pass";
 		break;
 	case AST_PRES_NUMBER_NOT_AVAILABLE:
-		send_pres_tags = 0;
+		send_pres_tags = FALSE;
 		break;
 	default:
 		ast_log(LOG_WARNING, "Unsupported callingpres (%d)\n", p->callingpres);
@@ -4858,7 +4856,7 @@
 	char urioptions[256]="";
 
 	if (ast_test_flag(p, SIP_USEREQPHONE)) {
-	 	char onlydigits = 1;
+	 	char onlydigits = TRUE;
 		x=0;
 
 		/* Test p->username against allowed characters in AST_DIGIT_ANY
@@ -4871,7 +4869,7 @@
 
 		for (; x < strlen(p->username); x++) {
 			if (!strchr(AST_DIGIT_ANYNUM, p->username[x])) {
-                		onlydigits = 0;
+                		onlydigits = FALSE;
 				break;
 			}
 		}
@@ -5457,7 +5455,7 @@
 		/* Build callid for registration if we haven't registered before */
 		if (!r->callid_valid) {
 			build_callid_registry(r, __ourip, default_fromdomain);
-			r->callid_valid = 1;
+			r->callid_valid = TRUE;
 		}
 		/* Allocate SIP packet for registration */
 		p = sip_alloc( r->callid, NULL, 0, SIP_REGISTER);
@@ -6311,7 +6309,7 @@
 		char *resp_uri ="";
 		char *nonce = "";
 		char *digestusername = "";
-		int  wrongnonce = 0;
+		int  wrongnonce = FALSE;
 		const char *usednonce = p->randdata;
 
 		/* Find their response among the mess that we'r sent for comparison */
@@ -6383,7 +6381,7 @@
 
 		/* Verify nonce from request matches our nonce.  If not, send 401 with new nonce */
 		if (strcasecmp(p->randdata, nonce)) {
-			wrongnonce = 1;
+			wrongnonce = TRUE;
 			usednonce = nonce;
 		}
 
@@ -7467,13 +7465,13 @@
 #define FORMAT2 "%-25.25s %-15.15s %-15.15s \n"
 	char ilimits[40];
 	char iused[40];
-	int showall = 0;
+	int showall = FALSE;
 
 	if (argc < 3) 
 		return RESULT_SHOWUSAGE;
 
 	if (argc == 4 && !strcmp(argv[3],"all")) 
-			showall = 1;
+			showall = TRUE;
 	
 	ast_cli(fd, FORMAT, "* User name", "In use", "Limit");
 	ASTOBJ_CONTAINER_TRAVERSE(&userl, 1, do {
@@ -7553,7 +7551,7 @@
 static int sip_show_users(int fd, int argc, char *argv[])
 {
 	regex_t regexbuf;
-	int havepattern = 0;
+	int havepattern = FALSE;
 
 #define FORMAT  "%-25.25s  %-15.15s  %-15.15s  %-15.15s  %-5.5s%-10.10s\n"
 
@@ -7562,7 +7560,7 @@
 		if (!strcasecmp(argv[3], "like")) {
 			if (regcomp(&regexbuf, argv[4], REG_EXTENDED | REG_NOSUB))
 				return RESULT_SHOWUSAGE;
-			havepattern = 1;
+			havepattern = TRUE;
 		} else
 			return RESULT_SHOWUSAGE;
 	case 3:
@@ -7638,7 +7636,7 @@
 static int _sip_show_peers(int fd, int *total, struct mansession *s, struct message *m, int argc, char *argv[])
 {
 	regex_t regexbuf;
-	int havepattern = 0;
+	int havepattern = FALSE;
 
 #define FORMAT2 "%-25.25s  %-15.15s %-3.3s %-3.3s %-3.3s %-8s %-10s\n"
 #define FORMAT  "%-25.25s  %-15.15s %-3.3s %-3.3s %-3.3s %-8d %-10s\n"
@@ -7662,7 +7660,7 @@
 		if (!strcasecmp(argv[3], "like")) {
 			if (regcomp(&regexbuf, argv[4], REG_EXTENDED | REG_NOSUB))
 				return RESULT_SHOWUSAGE;
-			havepattern = 1;
+			havepattern = TRUE;
 		} else
 			return RESULT_SHOWUSAGE;
 	case 3:
@@ -7822,9 +7820,9 @@
 {
 	struct sip_peer *peer;
 	struct sip_user *user;
-	int pruneuser = 0;
-	int prunepeer = 0;
-	int multi = 0;
+	int pruneuser = FALSE;
+	int prunepeer = FALSE;
+	int multi = FALSE;
 	char *name = NULL;
 	regex_t regexbuf;
 
@@ -7837,10 +7835,10 @@
 		if (!strcasecmp(argv[3], "like"))
 			return RESULT_SHOWUSAGE;
 		if (!strcasecmp(argv[3], "all")) {
-			multi = 1;
-			pruneuser = prunepeer = 1;
+			multi = TRUE;
+			pruneuser = prunepeer = TRUE;
 		} else {
-			pruneuser = prunepeer = 1;
+			pruneuser = prunepeer = TRUE;
 			name = argv[3];
 		}
 		break;
@@ -7850,19 +7848,19 @@
 		if (!strcasecmp(argv[3], "all"))
 			return RESULT_SHOWUSAGE;
 		if (!strcasecmp(argv[3], "like")) {
-			multi = 1;
+			multi = TRUE;
 			name = argv[4];
-			pruneuser = prunepeer = 1;
+			pruneuser = prunepeer = TRUE;
 		} else if (!strcasecmp(argv[3], "user")) {
-			pruneuser = 1;
+			pruneuser = TRUE;
 			if (!strcasecmp(argv[4], "all"))
-				multi = 1;
+				multi = TRUE;
 			else
 				name = argv[4];
 		} else if (!strcasecmp(argv[3], "peer")) {
-			prunepeer = 1;
+			prunepeer = TRUE;
 			if (!strcasecmp(argv[4], "all"))
-				multi = 1;
+				multi = TRUE;
 			else
 				name = argv[4];
 		} else
@@ -7872,10 +7870,10 @@
 		if (strcasecmp(argv[4], "like"))
 			return RESULT_SHOWUSAGE;
 		if (!strcasecmp(argv[3], "user")) {
-			pruneuser = 1;
+			pruneuser = TRUE;
 			name = argv[5];
 		} else if (!strcasecmp(argv[3], "peer")) {
-			prunepeer = 1;
+			prunepeer = TRUE;
 			name = argv[5];
 		} else
 			return RESULT_SHOWUSAGE;
@@ -8067,12 +8065,12 @@
 	struct ast_codec_pref *pref;
 	struct ast_variable *v;
 	struct sip_auth *auth;
-	int x = 0, codec = 0, load_realtime = 0;
+	int x = 0, codec = 0, load_realtime;
 
 	if (argc < 4)
 		return RESULT_SHOWUSAGE;
 
-	load_realtime = (argc == 5 && !strcmp(argv[4], "load")) ? 1 : 0;
+	load_realtime = (argc == 5 && !strcmp(argv[4], "load")) ? TRUE : FALSE;
 	peer = find_peer(argv[3], NULL, load_realtime);
 	if (s) { 	/* Manager */
 		if (peer)
@@ -8250,13 +8248,13 @@
 	struct sip_user *user;
 	struct ast_codec_pref *pref;
 	struct ast_variable *v;
-	int x = 0, codec = 0, load_realtime = 0;
+	int x = 0, codec = 0, load_realtime;
 
 	if (argc < 4)
 		return RESULT_SHOWUSAGE;
 
 	/* Load from realtime storage? */
-	load_realtime = (argc == 5 && !strcmp(argv[4], "load")) ? 1 : 0;
+	load_realtime = (argc == 5 && !strcmp(argv[4], "load")) ? TRUE : FALSE;
 
 	user = find_user(argv[3], load_realtime);
 	if (user) {
@@ -8999,7 +8997,7 @@
 	if (argc != 2) {
 		return RESULT_SHOWUSAGE;
 	}
-	recordhistory = 1;
+	recordhistory = TRUE;
 	ast_cli(fd, "SIP History Recording Enabled (use 'sip show history')\n");
 	return RESULT_SUCCESS;
 }
@@ -9010,7 +9008,7 @@
 	if (argc != 3) {
 		return RESULT_SHOWUSAGE;
 	}
-	recordhistory = 0;
+	recordhistory = FALSE;
 	ast_cli(fd, "SIP History Recording Disabled\n");
 	return RESULT_SUCCESS;
 }
@@ -11374,7 +11372,7 @@
 	struct sip_pvt *sip;
 	struct sip_peer *peer = NULL;
 	time_t t;
-	int fastrestart =0;
+	int fastrestart = FALSE;
 	int lastpeernum = -1;
 	int curpeernum;
 	int reloading;
@@ -11390,7 +11388,7 @@
 		/* Check for a reload request */
 		ast_mutex_lock(&sip_reload_lock);
 		reloading = sip_reloading;
-		sip_reloading = 0;
+		sip_reloading = FALSE;
 		ast_mutex_unlock(&sip_reload_lock);
 		if (reloading) {
 			if (option_verbose > 0)
@@ -11470,12 +11468,12 @@
 
 		/* needs work to send mwi to realtime peers */
 		time(&t);
-		fastrestart = 0;
+		fastrestart = FALSE;
 		curpeernum = 0;
 		peer = NULL;
 		ASTOBJ_CONTAINER_TRAVERSE(&peerl, !peer, do {
 			if ((curpeernum > lastpeernum) && !ast_strlen_zero(iterator->mailbox) && ((t - iterator->lastmsgcheck) > global_mwitime)) {
-				fastrestart = 1;
+				fastrestart = TRUE;
 				lastpeernum = curpeernum;
 				peer = ASTOBJ_REF(iterator);
 			};
@@ -12424,7 +12422,7 @@
 	int format;
 	char iabuf[INET_ADDRSTRLEN];
 	struct ast_flags dummy;
-	int auto_sip_domains = 0;
+	int auto_sip_domains = FALSE;
 	struct sockaddr_in old_bindaddr = bindaddr;
 	int registry_count = 0, peer_count = 0, user_count = 0;
 
@@ -12494,8 +12492,8 @@
 	ast_clear_flag(&global_flags_page2, SIP_PAGE2_DEBUG_CONFIG);
 
 	/* Misc settings for the channel */
-	global_relaxdtmf = 0;
-	global_callevents = 0;
+	global_relaxdtmf = FALSE;
+	global_callevents = FALSE;
 
 	/* Read the [general] config section of sip.conf (or from realtime config) */
 	for (v = ast_variable_browse(cfg, "general"); v; v = v->next) {
@@ -13171,7 +13169,7 @@
 	if (sip_reloading) {
 		ast_verbose("Previous SIP reload not yet done\n");
 	} else {
-		sip_reloading = 1;
+		sip_reloading = TRUE;
 		if (fd)
 			sip_reloadreason = CHANNEL_CLI_RELOAD;
 		else



More information about the asterisk-commits mailing list