[asterisk-commits] branch bweschke/polycom_acd_functions r19217 - in /team/bweschke/polycom_acd_...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Tue Apr 11 07:32:06 MST 2006


Author: bweschke
Date: Tue Apr 11 09:32:03 2006
New Revision: 19217

URL: http://svn.digium.com/view/asterisk?rev=19217&view=rev
Log:
Merged revisions 19128,19160,19188-19189 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

........
r19128 | oej | 2006-04-11 01:09:01 -0500 (Tue, 11 Apr 2006) | 5 lines

- First stab at removing debug and ignore variables that
  we pass along function calls, instead implementing them as
  flags on the incoming packet.
- Adding forward declarations of handle_request functions

........
r19160 | crichter | 2006-04-11 03:31:19 -0500 (Tue, 11 Apr 2006) | 1 line

mISDN Messages must be freed with free_msg \!\!
........
r19188 | rizzo | 2006-04-11 05:00:24 -0500 (Tue, 11 Apr 2006) | 3 lines

staticize a function, and normalize code in preparation to module changes.


........
r19189 | rizzo | 2006-04-11 05:01:00 -0500 (Tue, 11 Apr 2006) | 3 lines

normalize code in preparation to module changes


........

Modified:
    team/bweschke/polycom_acd_functions/   (props changed)
    team/bweschke/polycom_acd_functions/channels/chan_sip.c
    team/bweschke/polycom_acd_functions/channels/chan_skinny.c
    team/bweschke/polycom_acd_functions/channels/misdn/isdn_lib.c
    team/bweschke/polycom_acd_functions/res/res_agi.c
    team/bweschke/polycom_acd_functions/res/res_clioriginate.c
    team/bweschke/polycom_acd_functions/res/res_config_odbc.c
    team/bweschke/polycom_acd_functions/res/res_config_pgsql.c
    team/bweschke/polycom_acd_functions/res/res_convert.c
    team/bweschke/polycom_acd_functions/res/res_crypto.c

Propchange: team/bweschke/polycom_acd_functions/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Tue Apr 11 09:32:03 2006
@@ -1,1 +1,1 @@
-/trunk:1-19101
+/trunk:1-19216

Modified: team/bweschke/polycom_acd_functions/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/polycom_acd_functions/channels/chan_sip.c?rev=19217&r1=19216&r2=19217&view=diff
==============================================================================
--- team/bweschke/polycom_acd_functions/channels/chan_sip.c (original)
+++ team/bweschke/polycom_acd_functions/channels/chan_sip.c Tue Apr 11 09:32:03 2006
@@ -625,6 +625,9 @@
 /* SIP packet flags */
 #define SIP_PKT_DEBUG		(1 << 0)	/*!< Debug this packet */
 #define SIP_PKT_WITH_TOTAG	(1 << 1)	/*!< This packet has a to-tag */
+#define SIP_PKT_IGNORE 		(1 << 2)	/*!< This is a re-transmit, ignore it */
+#define SIP_PKT_IGNORE_RESP	(1 << 3)	/*!< Resp ignore - ??? */
+#define SIP_PKT_IGNORE_REQ	(1 << 4)	/*!< Req ignore - ??? */
 
 #define sipdebug		ast_test_flag(&global_flags[1], SIP_PAGE2_DEBUG)
 #define sipdebug_config		ast_test_flag(&global_flags[1], SIP_PAGE2_DEBUG_CONFIG)
@@ -988,6 +991,16 @@
 static int sip_send_mwi_to_peer(struct sip_peer *peer);
 static int sip_scheddestroy(struct sip_pvt *p, int ms);
 
+/*------Request handling functions */
+static int handle_request_invite(struct sip_pvt *p, struct sip_request *req, int debug, int seqno, struct sockaddr_in *sin, int *recount, char *e);
+static int handle_request_refer(struct sip_pvt *p, struct sip_request *req, int debug, int ignore, int seqno, int *nounlock);
+static int handle_request_bye(struct sip_pvt *p, struct sip_request *req);
+static int handle_request_register(struct sip_pvt *p, struct sip_request *req, struct sockaddr_in *sin, char *e);
+static int handle_request_cancel(struct sip_pvt *p, struct sip_request *req);
+static int handle_request_message(struct sip_pvt *p, struct sip_request *req);
+static int handle_request_subscribe(struct sip_pvt *p, struct sip_request *req, struct sockaddr_in *sin, int seqno, char *e);
+static void handle_request_info(struct sip_pvt *p, struct sip_request *req);
+static int handle_request_options(struct sip_pvt *p, struct sip_request *req);
 
 /*----- RTP interface functions */
 static int sip_set_rtp_peer(struct ast_channel *chan, struct ast_rtp *rtp, struct ast_rtp *vrtp, int codecs, int nat_active);
@@ -6463,7 +6476,7 @@
 }
 
 /*! \brief Verify registration of user */
-static int register_verify(struct sip_pvt *p, struct sockaddr_in *sin, struct sip_request *req, char *uri, int ignore)
+static int register_verify(struct sip_pvt *p, struct sockaddr_in *sin, struct sip_request *req, char *uri)
 {
 	int res = -3;
 	struct sip_peer *peer;
@@ -6523,7 +6536,7 @@
 		} else {
 			ast_copy_flags(&p->flags[0], &peer->flags[0], SIP_NAT);
 			transmit_response(p, "100 Trying", req);
-			if (!(res = check_auth(p, req, peer->name, peer->secret, peer->md5secret, SIP_REGISTER, uri, XMIT_UNRELIABLE, ignore))) {
+			if (!(res = check_auth(p, req, peer->name, peer->secret, peer->md5secret, SIP_REGISTER, uri, XMIT_UNRELIABLE, ast_test_flag(req, SIP_PKT_IGNORE)))) {
 				sip_cancel_destroy(p);
 				switch (parse_register_contact(p, peer, req)) {
 				case PARSE_REGISTER_FAILED:
@@ -7062,7 +7075,7 @@
 	\return 0 on success, -1 on failure, and 1 on challenge sent
 	-2 on authentication error from chedck_auth()
 */
-static int check_user_full(struct sip_pvt *p, struct sip_request *req, int sipmethod, char *uri, enum xmittype reliable, struct sockaddr_in *sin, int ignore, struct sip_peer **authpeer)
+static int check_user_full(struct sip_pvt *p, struct sip_request *req, int sipmethod, char *uri, enum xmittype reliable, struct sockaddr_in *sin, struct sip_peer **authpeer)
 {
 	struct sip_user *user = NULL;
 	struct sip_peer *peer;
@@ -7176,7 +7189,7 @@
 				ast_log(LOG_DEBUG, "Setting NAT on VRTP to %d\n", usenatroute);
 			ast_rtp_setnat(p->vrtp, usenatroute);
 		}
-		if (!(res = check_auth(p, req, user->name, user->secret, user->md5secret, sipmethod, uri, reliable, ignore))) {
+		if (!(res = check_auth(p, req, user->name, user->secret, user->md5secret, sipmethod, uri, reliable, ast_test_flag(req, SIP_PKT_IGNORE)))) {
 			sip_cancel_destroy(p);
 			ast_copy_flags(&p->flags[0], &user->flags[0], SIP_FLAGS_TO_COPY);
 			ast_copy_flags(&p->flags[1], &user->flags[1], SIP_PAGE2_FLAGS_TO_COPY);
@@ -7295,7 +7308,7 @@
 				ast_string_field_free(p, peersecret);
 				ast_string_field_free(p, peermd5secret);
 			}
-			if (!(res = check_auth(p, req, peer->name, p->peersecret, p->peermd5secret, sipmethod, uri, reliable, ignore))) {
+			if (!(res = check_auth(p, req, peer->name, p->peersecret, p->peermd5secret, sipmethod, uri, reliable, ast_test_flag(req, SIP_PKT_IGNORE)))) {
 				ast_copy_flags(&p->flags[0], &peer->flags[0], SIP_FLAGS_TO_COPY);
 				ast_copy_flags(&p->flags[1], &peer->flags[1], SIP_PAGE2_FLAGS_TO_COPY);
 				/* If we have a call limit, set flag */
@@ -7384,9 +7397,9 @@
 /*! \brief  Find user 
 	If we get a match, this will add a reference pointer to the user object in ASTOBJ, that needs to be unreferenced
 */
-static int check_user(struct sip_pvt *p, struct sip_request *req, int sipmethod, char *uri, enum xmittype reliable, struct sockaddr_in *sin, int ignore)
-{
-	return check_user_full(p, req, sipmethod, uri, reliable, sin, ignore, NULL);
+static int check_user(struct sip_pvt *p, struct sip_request *req, int sipmethod, char *uri, enum xmittype reliable, struct sockaddr_in *sin)
+{
+	return check_user_full(p, req, sipmethod, uri, reliable, sin, NULL);
 }
 
 /*! \brief  Get text out of a SIP MESSAGE packet */
@@ -8773,8 +8786,8 @@
 }
 
 
-/*! \brief  handle_request_info: Receive SIP INFO Message */
-/*    Doesn't read the duration of the DTMF signal */
+/*! \brief  handle_request_info: Receive SIP INFO Message
+\note    Doesn't read the duration of the DTMF signal */
 static void handle_request_info(struct sip_pvt *p, struct sip_request *req)
 {
 	char buf[1024];
@@ -10239,35 +10252,30 @@
 				handle_response_invite(p, resp, rest, req, ignore, seqno);
 			} else if (sipmethod == SIP_CANCEL) {
 				ast_log(LOG_DEBUG, "Got 200 OK on CANCEL\n");
+				/* Wait for 487, then destroy */
 			} else if (sipmethod == SIP_MESSAGE)
 				/* We successfully transmitted a message */
 				ast_set_flag(&p->flags[0], SIP_NEEDDESTROY);	
 			break;
 		case 202:   /* Transfer accepted */
-			if (sipmethod == SIP_REFER) {
+			if (sipmethod == SIP_REFER) 
 				handle_response_refer(p, resp, rest, req, ignore, seqno);
-			}
-		break;
+			break;
 		case 401:	/* www-auth */
 		case 407:
-			if (sipmethod == SIP_REFER) {
+			if (sipmethod == SIP_REFER)
 				handle_response_refer(p, resp, rest, req, ignore, seqno);
-			} else if (sipmethod == SIP_BYE) {
+			else if (sipmethod == SIP_INVITE) 
+				handle_response_invite(p, resp, rest, req, ignore, seqno);
+			else if (sipmethod == SIP_BYE) {
 				char *auth, *auth2;
 
-				if (resp == 407) {
-					auth = "Proxy-Authenticate";
-					auth2 = "Proxy-Authorization";
-				} else {
-					auth = "WWW-Authenticate";
-					auth2 = "Authorization";
-				}
+				auth = (resp == 407 ? "Proxy-Authenticate" : "WWW-Authenticate");
+				auth2 = (resp == 407 ? "Proxy-Authorization" : "Authorization");
 				if ((p->authtries == MAX_AUTHTRIES) || do_proxy_auth(p, req, auth, auth2, sipmethod, 0)) {
 					ast_log(LOG_NOTICE, "Failed to authenticate on %s to '%s'\n", msg, get_header(&p->initreq, "From"));
 					ast_set_flag(&p->flags[0], SIP_NEEDDESTROY);	
 				}
-			} else if (sipmethod == SIP_INVITE) {
-				handle_response_invite(p, resp, rest, req, ignore, seqno);
 			}
 			break;
 		case 481:	/* Call leg does not exist */
@@ -10277,11 +10285,10 @@
 			}
 			break;
 		case 501: /* Not Implemented */
-			if (sipmethod == SIP_INVITE) {
+			if (sipmethod == SIP_INVITE) 
 				handle_response_invite(p, resp, rest, req, ignore, seqno);
-			} else if (sipmethod == SIP_REFER) {
+			else if (sipmethod == SIP_REFER) 
 				handle_response_refer(p, resp, rest, req, ignore, seqno);
-			}
 			break;
 		case 603:	/* Declined transfer */
 			if (sipmethod == SIP_REFER) {
@@ -10504,7 +10511,7 @@
 }
 
 /*! \brief Handle incoming notifications */
-static int handle_request_notify(struct sip_pvt *p, struct sip_request *req, int debug, int ignore, struct sockaddr_in *sin, int seqno, char *e)
+static int handle_request_notify(struct sip_pvt *p, struct sip_request *req, struct sockaddr_in *sin, int seqno, char *e)
 {
 	/* This is mostly a skeleton for future improvements */
 	/* Mostly created to return proper answers on notifications on outbound REFER's */
@@ -10643,7 +10650,7 @@
 }
 
 /*! \brief Handle incoming OPTIONS request */
-static int handle_request_options(struct sip_pvt *p, struct sip_request *req, int debug)
+static int handle_request_options(struct sip_pvt *p, struct sip_request *req)
 {
 	int res;
 
@@ -10665,7 +10672,7 @@
 }
 
 /*! \brief Handle incoming INVITE request */
-static int handle_request_invite(struct sip_pvt *p, struct sip_request *req, int debug, int ignore, int seqno, struct sockaddr_in *sin, int *recount, char *e)
+static int handle_request_invite(struct sip_pvt *p, struct sip_request *req, int debug, int seqno, struct sockaddr_in *sin, int *recount, char *e)
 {
 	int res = 1;
 	struct ast_channel *c=NULL;		/* New channel */
@@ -10707,7 +10714,7 @@
 		return 0;
 	}
 
-	if (!ignore && p->pendinginvite) {
+	if (!ast_test_flag(req, SIP_PKT_IGNORE) && p->pendinginvite) {
 		/* We already have a pending invite. Sorry. You are on hold. */
 		transmit_response(p, "491 Request Pending", req);
 		if (option_debug > 1)
@@ -10716,7 +10723,7 @@
 		return 0;
 	}
 
-	if (!ignore) {
+	if (!ast_test_flag(req, SIP_PKT_IGNORE)) {
 		sip_cancel_destroy(p);
 
 		/* This also counts as a pending invite */
@@ -10747,10 +10754,10 @@
 		}
 	} else if (debug)
 		ast_verbose("Ignoring this INVITE request\n");
-	if (!p->lastinvite && !ignore && !p->owner) {
+	if (!p->lastinvite && !ast_test_flag(req, SIP_PKT_IGNORE) && !p->owner) {
 
 		/* Handle authentication if this is our first invite */
-		res = check_user(p, req, SIP_INVITE, e, XMIT_RELIABLE, sin, ignore);
+		res = check_user(p, req, SIP_INVITE, e, XMIT_RELIABLE, sin);
 		if (res > 0)	/* We have challenged the user for auth */
 			return 0; 
 		if (res < 0) { /* Something failed in authentication */
@@ -10829,14 +10836,14 @@
 		
 	} else {
 		if (option_debug > 1 && sipdebug) {
-			if (!ignore)
+			if (!ast_test_flag(req, SIP_PKT_IGNORE))
 				ast_log(LOG_DEBUG, "Got a SIP re-invite for call %s\n", p->callid);
 			else
 				ast_log(LOG_DEBUG, "Got a SIP re-transmit of INVITE for call %s\n", p->callid);
 		}
 		c = p->owner;
 	}
-	if (!ignore && p)
+	if (!ast_test_flag(req, SIP_PKT_IGNORE) && p)
 		p->lastinvite = seqno;
 	if (c) {
 		switch(c->_state) {
@@ -10851,14 +10858,14 @@
 				switch (res) {
 				case AST_PBX_FAILED:
 					ast_log(LOG_WARNING, "Failed to start PBX :(\n");
-					if (ignore)
+					if (ast_test_flag(req, SIP_PKT_IGNORE))
 						transmit_response(p, "503 Unavailable", req);
 					else
 						transmit_response_reliable(p, "503 Unavailable", req);
 					break;
 				case AST_PBX_CALL_LIMIT:
 					ast_log(LOG_WARNING, "Failed to start PBX (call limit reached) \n");
-					if (ignore)
+					if (ast_test_flag(req, SIP_PKT_IGNORE))
 						transmit_response(p, "480 Temporarily Unavailable", req);
 					else
 						transmit_response_reliable(p, "480 Temporarily Unavailable", req);
@@ -10880,7 +10887,7 @@
 				ast_mutex_unlock(&c->lock);
 				if (ast_pickup_call(c)) {
 					ast_log(LOG_NOTICE, "Nothing to pick up for %s\n", p->callid);
-					if (ignore)
+					if (ast_test_flag(req, SIP_PKT_IGNORE))
 						transmit_response(p, "503 Unavailable", req);
 					else
 						transmit_response_reliable(p, "503 Unavailable", req);
@@ -10914,14 +10921,14 @@
 	} else {
 		if (p && !ast_test_flag(&p->flags[0], SIP_NEEDDESTROY)) {
 			if (!p->jointcapability) {
-				if (ignore)
+				if (ast_test_flag(req, SIP_PKT_IGNORE))
 					transmit_response(p, "488 Not Acceptable Here (codec error)", req);
 				else
 					transmit_response_reliable(p, "488 Not Acceptable Here (codec error)", req);
 				ast_set_flag(&p->flags[0], SIP_NEEDDESTROY);	
 			} else {
 				ast_log(LOG_NOTICE, "Unable to create/find SIP channel for this INVITE\n");
-				if (ignore)
+				if (ast_test_flag(req, SIP_PKT_IGNORE))
 					transmit_response(p, "503 Unavailable", req);
 				else
 					transmit_response_reliable(p, "503 Unavailable", req);
@@ -11003,7 +11010,7 @@
 	return res;
 }
 /*! \brief Handle incoming CANCEL request */
-static int handle_request_cancel(struct sip_pvt *p, struct sip_request *req, int debug, int ignore)
+static int handle_request_cancel(struct sip_pvt *p, struct sip_request *req)
 {
 		
 	check_via(p, req);
@@ -11021,8 +11028,7 @@
 	else
 		ast_set_flag(&p->flags[0], SIP_NEEDDESTROY);	
 	if (p->initreq.len > 0) {
-		if (!ignore)
-			transmit_response_reliable(p, "487 Request Terminated", &p->initreq);
+		transmit_response_reliable(p, "487 Request Terminated", &p->initreq);
 		transmit_response(p, "200 OK", req);
 		return 1;
 	} else {
@@ -11032,14 +11038,14 @@
 }
 
 /*! \brief Handle incoming BYE request */
-static int handle_request_bye(struct sip_pvt *p, struct sip_request *req, int debug, int ignore)
+static int handle_request_bye(struct sip_pvt *p, struct sip_request *req)
 {
 	struct ast_channel *c=NULL;
 	int res;
 	struct ast_channel *bridged_to;
 	char iabuf[INET_ADDRSTRLEN];
 	
-	if (p->pendinginvite && !ast_test_flag(&p->flags[0], SIP_OUTGOING) && !ignore)
+	if (p->pendinginvite && !ast_test_flag(&p->flags[0], SIP_OUTGOING) && !ast_test_flag(req, SIP_PKT_IGNORE))
 		transmit_response_reliable(p, "487 Request Terminated", &p->initreq);
 
 	copy_request(&p->initreq, req);
@@ -11085,15 +11091,14 @@
 }
 
 /*! \brief Handle incoming MESSAGE request */
-static int handle_request_message(struct sip_pvt *p, struct sip_request *req, int debug, int ignore)
-{
-	if (!ignore) {
-		if (debug)
+static int handle_request_message(struct sip_pvt *p, struct sip_request *req)
+{
+	if (!ast_test_flag(req, SIP_PKT_IGNORE)) {
+		if (ast_test_flag(req, SIP_PKT_DEBUG))
 			ast_verbose("Receiving message!\n");
 		receive_message(p, req);
-	} else {
-		transmit_response(p, "202 Accepted", req);
-	}
+	} 
+	transmit_response(p, "202 Accepted", req);
 	return 1;
 }
 
@@ -11370,8 +11375,8 @@
 	return 0;
 }
 
-/*! \brief  handle_request_subscribe: Handle incoming SUBSCRIBE request */
-static int handle_request_subscribe(struct sip_pvt *p, struct sip_request *req, int debug, int ignore, struct sockaddr_in *sin, int seqno, char *e)
+/*! \brief  Handle incoming SUBSCRIBE request */
+static int handle_request_subscribe(struct sip_pvt *p, struct sip_request *req, struct sockaddr_in *sin, int seqno, char *e)
 {
 	int gotdest;
 	int res = 0;
@@ -11391,7 +11396,7 @@
 			/* Do not destroy session, since we will break the call if we do */
 			ast_log(LOG_DEBUG, "Got a subscription within the context of another call, can't handle that - %s (Method %s)\n", p->callid, sip_methods[p->initreq.method].text);
 			return 0;
-		} else if (debug) {
+		} else if (ast_test_flag(req, SIP_PKT_DEBUG)) {
 			if (resubscribe)
 				ast_log(LOG_DEBUG, "Got a re-subscribe on existing subscription %s\n", p->callid);
 			else
@@ -11408,16 +11413,16 @@
 		return 0;
 	}
 
-	if (!ignore && !p->initreq.headers) {	/* Set up dialog, new subscription */
+	if (!ast_test_flag(req, SIP_PKT_IGNORE) && !p->initreq.headers) {	/* Set up dialog, new subscription */
 		/* Use this as the basis */
-		if (debug)
+		if (ast_test_flag(req, SIP_PKT_DEBUG))
 			ast_verbose("Creating new subscription\n");
 
 		/* This call is no longer outgoing if it ever was */
 		ast_clear_flag(&p->flags[0], SIP_OUTGOING);
 		copy_request(&p->initreq, req);
 		check_via(p, req);
-	} else if (debug && ignore)
+	} else if (ast_test_flag(req, SIP_PKT_DEBUG) && ast_test_flag(req, SIP_PKT_IGNORE))
 		ast_verbose("Ignoring this SUBSCRIBE request\n");
 
 	/* Find parameters to Event: header value and remove them for now */
@@ -11425,7 +11430,7 @@
 		*eventparam++ = '\0';
 
 	/* Handle authentication if this is our first subscribe */
-	res = check_user_full(p, req, SIP_SUBSCRIBE, e, 0, sin, ignore, &authpeer);
+	res = check_user_full(p, req, SIP_SUBSCRIBE, e, 0, sin, &authpeer);
 	if (res) {
 		if (res < 0) {
 			ast_log(LOG_NOTICE, "Failed to authenticate user %s for SUBSCRIBE\n", get_header(req, "From"));
@@ -11517,7 +11522,7 @@
 			p->stateid = ast_extension_state_add(p->context, p->exten, cb_extensionstate, p);
 	}
 
-	if (!ignore && p)
+	if (!ast_test_flag(req, SIP_PKT_IGNORE) && p)
 		p->lastinvite = seqno;
 	if (p && !ast_test_flag(&p->flags[0], SIP_NEEDDESTROY)) {
 		p->expiry = atoi(get_header(req, "Expires"));
@@ -11597,17 +11602,17 @@
 }
 
 /*! \brief Handle incoming REGISTER request */
-static int handle_request_register(struct sip_pvt *p, struct sip_request *req, int debug, int ignore, struct sockaddr_in *sin, char *e)
+static int handle_request_register(struct sip_pvt *p, struct sip_request *req, struct sockaddr_in *sin, char *e)
 {
 	int res = 0;
 	char iabuf[INET_ADDRSTRLEN];
 
 	/* Use this as the basis */
-	if (debug)
+	if (ast_test_flag(req, SIP_PKT_DEBUG))
 		ast_verbose("Using latest REGISTER request as basis request\n");
 	copy_request(&p->initreq, req);
 	check_via(p, req);
-	if ((res = register_verify(p, sin, req, e, ignore)) < 0) 
+	if ((res = register_verify(p, sin, req, e)) < 0) 
 		ast_log(LOG_NOTICE, "Registration from '%s' failed for '%s' - %s\n", get_header(req, "To"), ast_inet_ntoa(iabuf, sizeof(iabuf), sin->sin_addr), (res == -1) ? "Wrong password" : (res == -2 ? "Username/auth name mismatch" : "Not a local SIP domain"));
 	if (res < 1) {
 		/* Destroy the session, but keep us around for just a bit in case they don't
@@ -11630,7 +11635,7 @@
 	const char *useragent;
 	int seqno;
 	int len;
-	int ignore=0;
+	int ignore = FALSE;
 	int respid;
 	int res = 0;
 	char iabuf[INET_ADDRSTRLEN];
@@ -11675,16 +11680,21 @@
 	if (req->method == SIP_RESPONSE) {	/* Response to our request */
 		/* Response to our request -- Do some sanity checks */	
 		if (!p->initreq.headers) {
-			ast_log(LOG_DEBUG, "That's odd...  Got a response on a call we dont know about. Cseq %d Cmd %s\n", seqno, cmd);
+			if (option_debug)
+				ast_log(LOG_DEBUG, "That's odd...  Got a response on a call we dont know about. Cseq %d Cmd %s\n", seqno, cmd);
 			ast_set_flag(&p->flags[0], SIP_NEEDDESTROY);	
 			return 0;
 		} else if (p->ocseq && (p->ocseq < seqno)) {
-			ast_log(LOG_DEBUG, "Ignoring out of order response %d (expecting %d)\n", seqno, p->ocseq);
+			if (option_debug)
+				ast_log(LOG_DEBUG, "Ignoring out of order response %d (expecting %d)\n", seqno, p->ocseq);
 			return -1;
 		} else if (p->ocseq && (p->ocseq != seqno)) {
 			/* ignore means "don't do anything with it" but still have to 
 			   respond appropriately  */
-			ignore=1;
+			ignore = TRUE;
+			ast_set_flag(req, SIP_PKT_IGNORE);
+			ast_set_flag(req, SIP_PKT_IGNORE_RESP);
+			append_history(p, "Ignore", "Ignoring this retransmit\n");
 		}
 	
 		e = ast_skip_blanks(e);
@@ -11704,7 +11714,7 @@
 	 */			
 	
 	p->method = req->method;	/* Find out which SIP method they are using */
-	if (option_debug > 2)
+	if (option_debug > 3)
 		ast_log(LOG_DEBUG, "**** Received %s (%d) - Command in SIP %s\n", sip_methods[p->method].text, sip_methods[p->method].id, cmd); 
 
 	if (p->icseq && (p->icseq > seqno)) {
@@ -11720,7 +11730,9 @@
 		/* ignore means "don't do anything with it" but still have to 
 		   respond appropriately.  We do this if we receive a repeat of
 		   the last sequence number  */
-		ignore=2;
+		ignore = 2;
+		ast_set_flag(req, SIP_PKT_IGNORE);
+		ast_set_flag(req, SIP_PKT_IGNORE_REQ);
 		if (option_debug > 2)
 			ast_log(LOG_DEBUG, "Ignoring SIP message because of retransmit (%s Seqno %d, ours %d)\n", sip_methods[p->method].text, p->icseq, seqno);
 	}
@@ -11747,7 +11759,7 @@
 			RFC 3261 - section 12.2 - and we don't want to mess with recovery  */
 		if (!p->initreq.headers && ast_test_flag(req, SIP_PKT_WITH_TOTAG)) {
 			/* If this is a first request and it got a to-tag, it is not for us */
-			if (!ignore && req->method == SIP_INVITE) {
+			if (!ast_test_flag(req, SIP_PKT_IGNORE) && req->method == SIP_INVITE) {
 				transmit_response_reliable(p, "481 Call/Transaction Does Not Exist", req);
 				/* Will cease to exist after ACK */
 			} else {
@@ -11761,37 +11773,36 @@
 	/* Handle various incoming SIP methods in requests */
 	switch (p->method) {
 	case SIP_OPTIONS:
-		res = handle_request_options(p, req, debug);
+		res = handle_request_options(p, req);
 		break;
 	case SIP_INVITE:
-		res = handle_request_invite(p, req, debug, ignore, seqno, sin, recount, e);
+		res = handle_request_invite(p, req, debug, seqno, sin, recount, e);
 		break;
 	case SIP_REFER:
 		res = handle_request_refer(p, req, debug, ignore, seqno, nounlock);
 		break;
 	case SIP_CANCEL:
-		res = handle_request_cancel(p, req, debug, ignore);
+		res = handle_request_cancel(p, req);
 		break;
 	case SIP_BYE:
-		res = handle_request_bye(p, req, debug, ignore);
+		res = handle_request_bye(p, req);
 		break;
 	case SIP_MESSAGE:
-		res = handle_request_message(p, req, debug, ignore);
+		res = handle_request_message(p, req);
 		break;
 	case SIP_SUBSCRIBE:
-		res = handle_request_subscribe(p, req, debug, ignore, sin, seqno, e);
+		res = handle_request_subscribe(p, req, sin, seqno, e);
 		break;
 	case SIP_REGISTER:
-		res = handle_request_register(p, req, debug, ignore, sin, e);
+		res = handle_request_register(p, req, sin, e);
 		break;
 	case SIP_INFO:
-		if (!ignore) {
-			if (debug)
-				ast_verbose("Receiving INFO!\n");
+		if (ast_test_flag(req, SIP_PKT_DEBUG))
+			ast_verbose("Receiving INFO!\n");
+		if (!ignore) 
 			handle_request_info(p, req);
-		} else { /* if ignoring, transmit response */
+		else  /* if ignoring, transmit response */
 			transmit_response(p, "200 OK", req);
-		}
 		break;
 	case SIP_NOTIFY:
 		/* XXX we get NOTIFY's from some servers. WHY?? Maybe we should
@@ -11829,7 +11840,7 @@
 		if (!p->lastinvite) 
 			ast_set_flag(&p->flags[0], SIP_NEEDDESTROY);	
 		} else 
-			res = handle_request_notify(p, req, debug, ignore, sin, seqno, e);
+			res = handle_request_notify(p, req, sin, seqno, e);
 		break;
 	case SIP_ACK:
 		/* Make sure we don't ignore this */

Modified: team/bweschke/polycom_acd_functions/channels/chan_skinny.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/polycom_acd_functions/channels/chan_skinny.c?rev=19217&r1=19216&r2=19217&view=diff
==============================================================================
--- team/bweschke/polycom_acd_functions/channels/chan_skinny.c (original)
+++ team/bweschke/polycom_acd_functions/channels/chan_skinny.c Tue Apr 11 09:32:03 2006
@@ -73,7 +73,6 @@
 /*************************************
  * Skinny/Asterisk Protocol Settings *
  *************************************/
-static const char desc[] = "Skinny Client Control Protocol (Skinny)";
 static const char tdesc[] = "Skinny Client Control Protocol (Skinny)";
 static const char config[] = "skinny.conf";
 
@@ -3228,7 +3227,7 @@
 	return 0;
 }
 
-void delete_devices(void)
+static void delete_devices(void)
 {
 	struct skinny_device *d, *dlast;
 	struct skinny_line *l, *llast;
@@ -3366,12 +3365,12 @@
 	return usecnt;
 }
 
-const char *key()
+const char *key(void)
 {
 	return ASTERISK_GPL_KEY;
 }
 
-const char *description()
-{
-	return (char *) desc;
-}
+const char *description(void)
+{
+	return "Skinny Client Control Protocol (Skinny)";
+}

Modified: team/bweschke/polycom_acd_functions/channels/misdn/isdn_lib.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/polycom_acd_functions/channels/misdn/isdn_lib.c?rev=19217&r1=19216&r2=19217&view=diff
==============================================================================
--- team/bweschke/polycom_acd_functions/channels/misdn/isdn_lib.c (original)
+++ team/bweschke/polycom_acd_functions/channels/misdn/isdn_lib.c Tue Apr 11 09:32:03 2006
@@ -2495,7 +2495,7 @@
 
 	if ( (frm->addr == 0) && (frm->prim == (MGR_DELLAYER|CONFIRM)) ) {
 		cb_log(2, 0, "MGMT: DELLAYER|CONFIRM Addr: 0 !\n") ;
-		free(msg);
+		free_msg(msg);
 		return 1;
 	}
 	
@@ -2505,7 +2505,7 @@
 		if (frm->prim == (MGR_DELLAYER|CONFIRM)) {
 			cb_log(2, 0, "MGMT: DELLAYER|CONFIRM Addr: %x !\n",
 					frm->addr) ;
-			free(msg);
+			free_msg(msg);
 			return 1;
 		}
 		

Modified: team/bweschke/polycom_acd_functions/res/res_agi.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/polycom_acd_functions/res/res_agi.c?rev=19217&r1=19216&r2=19217&view=diff
==============================================================================
--- team/bweschke/polycom_acd_functions/res/res_agi.c (original)
+++ team/bweschke/polycom_acd_functions/res/res_agi.c Tue Apr 11 09:32:03 2006
@@ -70,8 +70,6 @@
 
 /* Recycle some stuff from the CLI interface */
 #define fdprintf agi_debug_cli
-
-static char *tdesc = "Asterisk Gateway Interface (AGI)";
 
 static char *app = "AGI";
 
@@ -2053,7 +2051,8 @@
 
 const char *description(void)
 {
-	return tdesc;
+	return "Asterisk Gateway Interface (AGI)";
+
 }
 
 int usecount(void)
@@ -2063,7 +2062,7 @@
 	return res;
 }
 
-const char *key()
+const char *key(void)
 {
 	return ASTERISK_GPL_KEY;
 }

Modified: team/bweschke/polycom_acd_functions/res/res_clioriginate.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/polycom_acd_functions/res/res_clioriginate.c?rev=19217&r1=19216&r2=19217&view=diff
==============================================================================
--- team/bweschke/polycom_acd_functions/res/res_clioriginate.c (original)
+++ team/bweschke/polycom_acd_functions/res/res_clioriginate.c Tue Apr 11 09:32:03 2006
@@ -43,8 +43,6 @@
 #define TIMEOUT 30
 
 STANDARD_USECOUNT_DECL;
-
-static char *tdesc = "Call origination from the CLI";
 
 static char orig_help[] = 
 "  There are two ways to use this command. A call can be originated between a\n"
@@ -177,7 +175,8 @@
 
 const char *description(void)
 {
-	return tdesc;
+	return "Call origination from the CLI";
+
 }
 
 int usecount(void)
@@ -185,7 +184,7 @@
 	return 0;
 }
 
-const char *key()
+const char *key(void)
 {
 	return ASTERISK_GPL_KEY;
 }

Modified: team/bweschke/polycom_acd_functions/res/res_config_odbc.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/polycom_acd_functions/res/res_config_odbc.c?rev=19217&r1=19216&r2=19217&view=diff
==============================================================================
--- team/bweschke/polycom_acd_functions/res/res_config_odbc.c (original)
+++ team/bweschke/polycom_acd_functions/res/res_config_odbc.c Tue Apr 11 09:32:03 2006
@@ -47,8 +47,6 @@
 #include "asterisk/options.h"
 #include "asterisk/res_odbc.h"
 #include "asterisk/utils.h"
-
-static char *tdesc = "ODBC Configuration";
 
 LOCAL_USER_DECL;
 
@@ -527,7 +525,8 @@
 
 const char *description(void)
 {
-	return tdesc;
+	return "ODBC Configuration";
+
 }
 
 int usecount (void)
@@ -536,7 +535,7 @@
 	return 1;
 }
 
-const char *key()
+const char *key(void)
 {
 	return ASTERISK_GPL_KEY;
 }

Modified: team/bweschke/polycom_acd_functions/res/res_config_pgsql.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/polycom_acd_functions/res/res_config_pgsql.c?rev=19217&r1=19216&r2=19217&view=diff
==============================================================================
--- team/bweschke/polycom_acd_functions/res/res_config_pgsql.c (original)
+++ team/bweschke/polycom_acd_functions/res/res_config_pgsql.c Tue Apr 11 09:32:03 2006
@@ -40,8 +40,6 @@
 #include "asterisk/options.h"
 #include "asterisk/utils.h"
 #include "asterisk/cli.h"
-
-static char *res_config_pgsql_desc = "Postgresql RealTime Configuration Driver";
 
 AST_MUTEX_DEFINE_STATIC(pgsql_lock);
 
@@ -695,7 +693,8 @@
 
 const char *description(void)
 {
-	return res_config_pgsql_desc;
+	return "Postgresql RealTime Configuration Driver";
+
 }
 
 int usecount(void)
@@ -709,7 +708,7 @@
 	return 0;
 }
 
-const char *key()
+const char *key(void)
 {
 	return ASTERISK_GPL_KEY;
 }

Modified: team/bweschke/polycom_acd_functions/res/res_convert.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/polycom_acd_functions/res/res_convert.c?rev=19217&r1=19216&r2=19217&view=diff
==============================================================================
--- team/bweschke/polycom_acd_functions/res/res_convert.c (original)
+++ team/bweschke/polycom_acd_functions/res/res_convert.c Tue Apr 11 09:32:03 2006
@@ -40,8 +40,6 @@
 #include "asterisk/file.h"
 
 STANDARD_USECOUNT_DECL;
-
-static char *desc = "File format conversion CLI command";
 
 /*! \brief Split the filename to basename and extension */
 static int split_ext(char *filename, char **name, char **ext)
@@ -146,19 +144,18 @@
 
 const char *description(void)
 {
-	return desc;
+	return "File format conversion CLI command";
+
 }
 
 int usecount(void)
 {
 	int res;
-	
 	STANDARD_USECOUNT(res);
-
 	return res;
 }
 
-const char *key()
+const char *key(void)
 {
 	return ASTERISK_GPL_KEY;
 }

Modified: team/bweschke/polycom_acd_functions/res/res_crypto.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/polycom_acd_functions/res/res_crypto.c?rev=19217&r1=19216&r2=19217&view=diff
==============================================================================
--- team/bweschke/polycom_acd_functions/res/res_crypto.c (original)
+++ team/bweschke/polycom_acd_functions/res/res_crypto.c Tue Apr 11 09:32:03 2006
@@ -614,7 +614,7 @@
 	return 1;
 }
 
-const char *key()
+const char *key(void)
 {
 	return ASTERISK_GPL_KEY;
 }



More information about the asterisk-commits mailing list