[asterisk-commits] trunk r10271 - /trunk/channels/chan_sip.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Thu Feb 16 01:19:37 MST 2006


Author: oej
Date: Thu Feb 16 02:19:34 2006
New Revision: 10271

URL: http://svn.digium.com/view/asterisk?rev=10271&view=rev
Log:
Whitespace cleanup

Modified:
    trunk/channels/chan_sip.c

Modified: trunk/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_sip.c?rev=10271&r1=10270&r2=10271&view=diff
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Thu Feb 16 02:19:34 2006
@@ -186,7 +186,7 @@
 	const char * const mediatype;
 	const char * const text;
 } subscription_types[] = {
-	{ NONE,            "-",        "unknown",	                  "unknown" },
+	{ NONE,		   "-",        "unknown",	             "unknown" },
  	/* IETF draft: draft-ietf-sipping-dialog-package-05.txt */
 	{ DIALOG_INFO_XML, "dialog",   "application/dialog-info+xml", "dialog-info+xml" },
 	{ CPIM_PIDF_XML,   "presence", "application/cpim-pidf+xml",   "cpim-pidf+xml" },  /* RFC 3863 */
@@ -261,10 +261,10 @@
 	{ "Allow-Events", "u" },
 	{ "Event", "o" },
 	{ "Via", "v" },
-	{ "Accept-Contact",      "a" },
-	{ "Reject-Contact",      "j" },
+	{ "Accept-Contact", "a" },
+	{ "Reject-Contact", "j" },
 	{ "Request-Disposition", "d" },
-	{ "Session-Expires",     "x" },
+	{ "Session-Expires", "x" },
 };
 
 /*!  Define SIP option tags, used in Require: and Supported: headers 
@@ -520,10 +520,10 @@
 /*! \brief sip_auth: Creadentials for authentication to other SIP services */
 struct sip_auth {
 	char realm[AST_MAX_EXTENSION];  /*!< Realm in which these credentials are valid */
-	char username[256];             /*!< Username */
-	char secret[256];               /*!< Secret */
-	char md5secret[256];            /*!< MD5Secret */
-	struct sip_auth *next;          /*!< Next auth structure in list */
+	char username[256];		/*!< Username */
+	char secret[256];		/*!< Secret */
+	char md5secret[256];		/*!< MD5Secret */
+	struct sip_auth *next;		/*!< Next auth structure in list */
 };
 
 /*--- Various flags for the flags field in the pvt structure 
@@ -705,7 +705,7 @@
 	int rtpkeepalive;			/*!< Send RTP packets for keepalive */
 	enum subscriptiontype subscribed;	/*!< Is this dialog a subscription?  */
 	int stateid;
-	int laststate;                          /*!< Last known extension state */
+	int laststate;				/*!< Last known extension state */
 	int dialogver;
 	
 	struct ast_dsp *vad;			/*!< Voice Activation Detection dsp */
@@ -829,10 +829,10 @@
 #define REG_STATE_UNREGISTERED		0	/*!< We are not registred */
 #define REG_STATE_REGSENT		1	/*!< Registration request sent */
 #define REG_STATE_AUTHSENT		2	/*!< We have tried to authenticate */
-#define REG_STATE_REGISTERED   		3	/*!< Registred and done */
-#define REG_STATE_REJECTED	   	4	/*!< Registration rejected */
-#define REG_STATE_TIMEOUT	   	5	/*!< Registration timed out */
-#define REG_STATE_NOAUTH	   	6	/*!< We have no accepted credentials */
+#define REG_STATE_REGISTERED		3	/*!< Registred and done */
+#define REG_STATE_REJECTED		4	/*!< Registration rejected */
+#define REG_STATE_TIMEOUT		5	/*!< Registration timed out */
+#define REG_STATE_NOAUTH		6	/*!< We have no accepted credentials */
 #define REG_STATE_FAILED		7	/*!< Registration failed after several tries */
 
 
@@ -887,7 +887,7 @@
 } regl;
 
 /*! \todo Move the sip_auth list to AST_LIST */
-static struct sip_auth *authl = NULL;          /*!< Authentication list for realm authentication */
+static struct sip_auth *authl = NULL;		/*!< Authentication list for realm authentication */
 
 
 /* --- Sockets and networking --------------*/
@@ -942,12 +942,12 @@
 static int sip_transfer(struct ast_channel *ast, const char *dest);
 static int sip_fixup(struct ast_channel *oldchan, struct ast_channel *newchan);
 static int sip_senddigit(struct ast_channel *ast, char digit);
-static int clear_realm_authentication(struct sip_auth *authlist);                            /* Clear realm authentication list (at reload) */
-static struct sip_auth *add_realm_authentication(struct sip_auth *authlist, char *configuration, int lineno);   /* Add realm authentication in list */
-static struct sip_auth *find_realm_authentication(struct sip_auth *authlist, const char *realm);         /* Find authentication for a specific realm */
+static int clear_realm_authentication(struct sip_auth *authlist);	/* Clear realm authentication list (at reload) */
+static struct sip_auth *add_realm_authentication(struct sip_auth *authlist, char *configuration, int lineno);	/* Add realm authentication in list */
+static struct sip_auth *find_realm_authentication(struct sip_auth *authlist, const char *realm);	/* Find authentication for a specific realm */
 static int check_auth(struct sip_pvt *p, struct sip_request *req, const char *username,
-		      const char *secret, const char *md5secret, int sipmethod,
-		      char *uri, int reliable, int ignore);
+		const char *secret, const char *md5secret, int sipmethod,
+		char *uri, int reliable, int ignore);
 static int check_sip_domain(const char *domain, char *context, size_t len); /* Check if domain is one of our local domains */
 static void append_date(struct sip_request *req);	/* Append date to SIP packet */
 static int determine_firstline_parts(struct sip_request *req);
@@ -1140,7 +1140,7 @@
 
 	/* z9hG4bK is a magic cookie.  See RFC 3261 section 8.1.1.7 */
 	ast_string_field_build(p, via, "SIP/2.0/UDP %s:%d;branch=z9hG4bK%08x%s",
-			       ast_inet_ntoa(iabuf, sizeof(iabuf), p->ourip), ourport, p->branch, rport);
+			 ast_inet_ntoa(iabuf, sizeof(iabuf), p->ourip), ourport, p->branch, rport);
 }
 
 /*! \brief NAT fix - decide which IP address to use for ASterisk server?
@@ -1212,15 +1212,15 @@
 /*! \brief Append to SIP dialog history with arg list  */
 static int append_history_full(struct sip_pvt *p, const char *fmt, ...)
 {
-        va_list ap;
+	va_list ap;
 
 	if (!recordhistory || !p)
 		return 0;
-        va_start(ap, fmt);
-        append_history_va(p, fmt, ap);
-        va_end(ap);
-
-        return 0;
+	va_start(ap, fmt);
+	append_history_va(p, fmt, ap);
+	va_end(ap);
+
+	return 0;
 }
 
 /*! \brief Retransmit SIP message if no answer */
@@ -2081,8 +2081,8 @@
 		/* Check whether there is a VXML_URL variable */
 		if (!p->options->vxml_url && !strcasecmp(ast_var_name(current), "VXML_URL")) {
 			p->options->vxml_url = ast_var_value(current);
-               } else if (!p->options->uri_options && !strcasecmp(ast_var_name(current), "SIP_URI_OPTIONS")) {
-                       p->options->uri_options = ast_var_value(current);
+		} else if (!p->options->uri_options && !strcasecmp(ast_var_name(current), "SIP_URI_OPTIONS")) {
+			p->options->uri_options = ast_var_value(current);
 		} else if (!p->options->distinctive_ring && !strcasecmp(ast_var_name(current), "ALERT_INFO")) {
 			/* Check whether there is a ALERT_INFO variable */
 			p->options->distinctive_ring = ast_var_value(current);
@@ -2307,8 +2307,8 @@
 		/* incoming and outgoing affects the inUse counter */
 		case DEC_CALL_LIMIT:
 			if ( *inuse > 0 ) {
-			         if (ast_test_flag(fup, SIP_INC_COUNT))
-				         (*inuse)--;
+				if (ast_test_flag(fup, SIP_INC_COUNT))
+					(*inuse)--;
 			} else {
 				*inuse = 0;
 			}
@@ -2328,7 +2328,7 @@
 				}
 			}
 			(*inuse)++;
-	                ast_set_flag(fup, SIP_INC_COUNT);
+			ast_set_flag(fup, SIP_INC_COUNT);
 			if (option_debug > 1 || sipdebug) {
 				ast_log(LOG_DEBUG, "Call %s %s '%s' is %d out of %d\n", outgoing ? "to" : "from", u ? "user":"peer", name, *inuse, *call_limit);
 			}
@@ -2474,9 +2474,9 @@
 		case AST_CAUSE_NO_ROUTE_DESTINATION:	/* 3 IAX2: Can't find extension in context */
 		case AST_CAUSE_NO_ROUTE_TRANSIT_NET:	/* 2 */
 			return "404 Not Found";
-                case AST_CAUSE_CONGESTION:		/* 34 */
-                case AST_CAUSE_SWITCH_CONGESTION:	/* 42 */
-                        return "503 Service Unavailable";
+		case AST_CAUSE_CONGESTION:		/* 34 */
+		case AST_CAUSE_SWITCH_CONGESTION:	/* 42 */
+			return "503 Service Unavailable";
 		case AST_CAUSE_NO_USER_RESPONSE:	/* 18 */
 			return "408 Request Timeout";
 		case AST_CAUSE_NO_ANSWER:		/* 19 */
@@ -2492,7 +2492,7 @@
 		case AST_CAUSE_USER_BUSY:
 			return "486 Busy here";
 		case AST_CAUSE_FAILURE:
-                	return "500 Server internal failure";
+			return "500 Server internal failure";
 		case AST_CAUSE_FACILITY_REJECTED:	/* 29 */
 			return "501 Not Implemented";
 		case AST_CAUSE_CHAN_NOT_IMPLEMENTED:
@@ -3783,8 +3783,8 @@
 	}
 
 	/* Manager Hold and Unhold events must be generated, if necessary */
-	if (sin.sin_addr.s_addr && !sendonly) {	        
-	        append_history(p, "Unhold", "%s", req->data);
+	if (sin.sin_addr.s_addr && !sendonly) {
+		append_history(p, "Unhold", "%s", req->data);
 
 		if (global_callevents && ast_test_flag(p, SIP_CALL_ONHOLD)) {
 			manager_event(EVENT_FLAG_CALL, "Unhold",
@@ -3793,16 +3793,16 @@
 				p->owner->name, 
 				p->owner->uniqueid);
 
-       		}
+		}
 		ast_clear_flag(p, SIP_CALL_ONHOLD);
-	} else {	        
+	} else {
 		/* No address for RTP, we're on hold */
-	        append_history(p, "Hold", "%s", req->data);
-
-	        if (global_callevents && !ast_test_flag(p, SIP_CALL_ONHOLD)) {
+		append_history(p, "Hold", "%s", req->data);
+
+		if (global_callevents && !ast_test_flag(p, SIP_CALL_ONHOLD)) {
 			manager_event(EVENT_FLAG_CALL, "Hold",
 				"Channel: %s\r\n"
-		   	    	"Uniqueid: %s\r\n",
+				"Uniqueid: %s\r\n",
 				p->owner->name, 
 				p->owner->uniqueid);
 		}
@@ -3973,8 +3973,8 @@
 
 					/* Add rport to first VIA header if requested */
 					/* Whoo hoo!  Now we can indicate port address translation too!  Just
-				   	   another RFC (RFC3581). I'll leave the original comments in for
-				   	   posterity.  */
+					   another RFC (RFC3581). I'll leave the original comments in for
+					   posterity.  */
 					snprintf(new, sizeof(new), "%s;received=%s;rport=%d", tmp, ast_inet_ntoa(iabuf, sizeof(iabuf), p->recv.sin_addr), ntohs(p->recv.sin_port));
 				} else {
 					/* We should *always* add a received to the topmost via */
@@ -4880,10 +4880,10 @@
 		x=0;
 
 		/* Test p->username against allowed characters in AST_DIGIT_ANY
-		If it matches the allowed characters list, then sipuser = ";user=phone"
-		If not, then sipuser = ""
-        	*/
-        	/* + is allowed in first position in a tel: uri */
+			If it matches the allowed characters list, then sipuser = ";user=phone"
+			If not, then sipuser = ""
+		*/
+		/* + is allowed in first position in a tel: uri */
         	if (p->username && p->username[0] == '+')
 			x=1;
 
@@ -5048,7 +5048,7 @@
 				ast_log(LOG_WARNING,"No Headp for the channel...ooops!\n");
 			else {
 				AST_LIST_TRAVERSE(headp, current, entries) {  
-					/* SIPADDHEADER: Add SIP header to outgoing call        */
+					/* SIPADDHEADER: Add SIP header to outgoing call */
 					if (!strncasecmp(ast_var_name(current), "SIPADDHEADER", strlen("SIPADDHEADER"))) {
 						char *content, *end;
 						const char *header = ast_var_value(current);
@@ -6853,7 +6853,7 @@
 		} else {
 			ast_log(LOG_NOTICE, "Supervised transfer requested, but unable to find callid '%s'.  Both legs must reside on Asterisk box to transfer at this time.\n", replace_callid);
 			/* XXX The refer_to could contain a call on an entirely different machine, requiring an 
-	    		  INVITE with a replaces header -anthm XXX */
+				INVITE with a replaces header -anthm XXX */
 			/* The only way to find out is to use the dialplan - oej */
 		}
 	} else if (ast_exists_extension(NULL, sip_pvt->context, refer_to, 1, NULL) || !strcmp(refer_to, ast_parking_ext())) {
@@ -7372,7 +7372,7 @@
 	return 0;
 }
 
-                
+
 /*! \brief  Receive SIP MESSAGE method messages
 \note	We only handle messages within current calls currently 
 	Reference: RFC 3428 */
@@ -7502,7 +7502,7 @@
 	}
 	return res;
 }
-                           
+
 /*! \brief  CLI Command 'SIP Show Users' */
 static int sip_show_users(int fd, int argc, char *argv[])
 {
@@ -8440,9 +8440,9 @@
 		}
 		if (cur->subscribed != NONE && subscriptions) {
 			ast_cli(fd, FORMAT3, ast_inet_ntoa(iabuf, sizeof(iabuf), cur->sa.sin_addr),
-			        ast_strlen_zero(cur->username) ? ( ast_strlen_zero(cur->cid_num) ? "(None)" : cur->cid_num ) : cur->username, 
-			        cur->callid, cur->exten, ast_extension_state2str(cur->laststate), 
-			        subscription_type2str(cur->subscribed));
+				ast_strlen_zero(cur->username) ? ( ast_strlen_zero(cur->cid_num) ? "(None)" : cur->cid_num ) : cur->username, 
+			   	cur->callid, cur->exten, ast_extension_state2str(cur->laststate), 
+				subscription_type2str(cur->subscribed));
 			numchans++;
 		}
 		cur = cur->next;
@@ -10021,7 +10021,7 @@
 					update_call_counter(p, DEC_CALL_LIMIT);
 					break;
 				case 482: /* SIP is incapable of performing a hairpin call, which
-				             is yet another failure of not having a layer 2 (again, YAY
+					is yet another failure of not having a layer 2 (again, YAY
 							 IETF for thinking ahead).  So we treat this as a call
 							 forward and hope we end up at the right place... */
 					ast_log(LOG_DEBUG, "Hairpin detected, setting up call forward for what it's worth\n");



More information about the asterisk-commits mailing list