[asterisk-commits] oej: branch oej/codename-pineapple r45296 - in /team/oej/codename-pineapple/c...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Mon Oct 16 23:49:07 MST 2006


Author: oej
Date: Tue Oct 17 01:49:06 2006
New Revision: 45296

URL: http://svn.digium.com/view/asterisk?rev=45296&view=rev
Log:
Not a backport, but a sideport :-)

Modified:
    team/oej/codename-pineapple/channels/chan_sip3.c
    team/oej/codename-pineapple/channels/sip3/sip3core.h
    team/oej/codename-pineapple/channels/sip3/sip3funcs.h

Modified: team/oej/codename-pineapple/channels/chan_sip3.c
URL: http://svn.digium.com/view/asterisk/team/oej/codename-pineapple/channels/chan_sip3.c?rev=45296&r1=45295&r2=45296&view=diff
==============================================================================
--- team/oej/codename-pineapple/channels/chan_sip3.c (original)
+++ team/oej/codename-pineapple/channels/chan_sip3.c Tue Oct 17 01:49:06 2006
@@ -567,7 +567,7 @@
 /*------Request handling functions */
 static int handle_request(struct sip_pvt *p, struct sip_request *req, struct sockaddr_in *sin, int *recount, int *nounlock);
 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_refer(struct sip_pvt *p, struct sip_request *req, int debug, 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);
@@ -584,8 +584,8 @@
 static void handle_response_invite(struct sip_pvt *p, int resp, char *rest, struct sip_request *req, int seqno);
 static void handle_response_refer(struct sip_pvt *p, int resp, char *rest, struct sip_request *req, int seqno);
 static void handle_response_peerpoke(struct sip_pvt *p, int resp, struct sip_request *req);
-static int handle_response_register(struct sip_pvt *p, int resp, char *rest, struct sip_request *req, int ignore, int seqno);
-static void handle_response(struct sip_pvt *p, int resp, char *rest, struct sip_request *req, int ignore, int seqno);
+static int handle_response_register(struct sip_pvt *p, int resp, char *rest, struct sip_request *req, int seqno);
+static void handle_response(struct sip_pvt *p, int resp, char *rest, struct sip_request *req, int seqno);
 
 /*----- RTP interface functions */
 static int sip_get_codec(struct ast_channel *chan);
@@ -9364,7 +9364,7 @@
 }
 
 /*! \brief Handle responses on REGISTER to services */
-static int handle_response_register(struct sip_pvt *p, int resp, char *rest, struct sip_request *req, int ignore, int seqno)
+static int handle_response_register(struct sip_pvt *p, int resp, char *rest, struct sip_request *req, int seqno)
 {
 	int expires, expires_ms;
 	struct sip_registry *r;
@@ -9532,7 +9532,7 @@
 
 /*! \brief Handle SIP response in dialogue */
 /* XXX only called by handle_request */
-static void handle_response(struct sip_pvt *p, int resp, char *rest, struct sip_request *req, int ignore, int seqno)
+static void handle_response(struct sip_pvt *p, int resp, char *rest, struct sip_request *req, int seqno)
 {
 	struct ast_channel *owner;
 	int sipmethod;
@@ -9603,7 +9603,7 @@
 						ast_set_flag(&p->flags[0], SIP_NEEDDESTROY); 
 				}
 			} else if (sipmethod == SIP_REGISTER) 
-				res = handle_response_register(p, resp, rest, req, ignore, seqno);
+				res = handle_response_register(p, resp, rest, req, seqno);
 			else if (sipmethod == SIP_BYE)		/* Ok, we're ready to go */
 				ast_set_flag(&p->flags[0], SIP_NEEDDESTROY); 
 			break;
@@ -9617,7 +9617,7 @@
 			else if (sipmethod == SIP_REFER)
 				handle_response_refer(p, resp, rest, req, seqno);
 			else if (p->registry && sipmethod == SIP_REGISTER)
-				res = handle_response_register(p, resp, rest, req, ignore, seqno);
+				res = handle_response_register(p, resp, rest, req, seqno);
 			else {
 				ast_log(LOG_WARNING, "Got authentication request (401) on unknown %s to '%s'\n", sip_method2txt(sipmethod), get_header(req, "To"));
 				ast_set_flag(&p->flags[0], SIP_NEEDDESTROY);	
@@ -9627,7 +9627,7 @@
 			if (sipmethod == SIP_INVITE)
 				handle_response_invite(p, resp, rest, req, seqno);
 			else if (p->registry && sipmethod == SIP_REGISTER) 
-				res = handle_response_register(p, resp, rest, req, ignore, seqno);
+				res = handle_response_register(p, resp, rest, req, seqno);
 			else {
 				ast_log(LOG_WARNING, "Forbidden - maybe wrong password on authentication for %s\n", msg);
 				ast_set_flag(&p->flags[0], SIP_NEEDDESTROY);	
@@ -9635,7 +9635,7 @@
 			break;
 		case 404: /* Not found */
 			if (p->registry && sipmethod == SIP_REGISTER)
-				res = handle_response_register(p, resp, rest, req, ignore, seqno);
+				res = handle_response_register(p, resp, rest, req, seqno);
 			else if (sipmethod == SIP_INVITE)
 				handle_response_invite(p, resp, rest, req, seqno);
 			else if (owner)
@@ -9647,7 +9647,7 @@
 			else if (sipmethod == SIP_REFER)
 				handle_response_refer(p, resp, rest, req, seqno);
 			else if (p->registry && sipmethod == SIP_REGISTER)
-				res = handle_response_register(p, resp, rest, req, ignore, seqno);
+				res = handle_response_register(p, resp, rest, req, seqno);
 			else if (sipmethod == SIP_BYE) {
 				if (ast_strlen_zero(p->authname))
 					ast_log(LOG_WARNING, "Asked to authenticate %s, to %s:%d but we have no matching peer!\n",
@@ -10377,7 +10377,7 @@
 			ast_log(LOG_DEBUG, "SIP transfer: Invite Replace incoming channel should replace and hang up channel %s (one call leg)\n", replacecall->name); 
 	}
 
-	if (ignore) {
+	if (ast_test_flag(req, SIP_PKT_IGNORE)) {
 		ast_log(LOG_NOTICE, "Ignoring this INVITE with replaces in a stupid way.\n");
 		/* We should answer something here. If we are here, the
 			call we are replacing exists, so an accepted 
@@ -11164,7 +11164,7 @@
 	We can't destroy dialogs, since we want the call to continue.
 	
 	*/
-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_refer(struct sip_pvt *p, struct sip_request *req, int debug, int seqno, int *nounlock)
 {
 	struct sip_dual current;	/* Chan1: Call between asterisk and transferer */
 					/* Chan2: Call between asterisk and transferee */
@@ -11198,7 +11198,7 @@
 		return 0;
 	}
 
-	if(!ignore && ast_test_flag(&p->flags[0], SIP_GOTREFER)) {
+	if(!ast_test_flag(req, SIP_PKT_IGNORE) && ast_test_flag(&p->flags[0], SIP_GOTREFER)) {
 		/* Already have a pending REFER */	
 		transmit_response(p, "491 Request pending", req);
 		append_history(p, "Xfer", "Refer failed. Request pending.");
@@ -11259,7 +11259,7 @@
 	
 	/* Is this a repeat of a current request? Ignore it */
 	/* Don't know what else to do right now. */
-	if (ignore) 
+	if (ast_test_flag(req, SIP_PKT_IGNORE)) 
 		return res;
 
 	/* If this is a blind transfer, we have the following
@@ -11876,7 +11876,6 @@
 	const char *useragent;
 	int seqno;
 	int len;
-	int ignore = FALSE;
 	int respid;
 	int res = 0;
 	int debug = sip_debug_test_pvt(p);
@@ -11929,7 +11928,6 @@
 		} else if (p->ocseq && (p->ocseq != seqno)) {
 			/* ignore means "don't do anything with it" but still have to 
 			   respond appropriately  */
-			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");
@@ -11942,7 +11940,7 @@
 			/* More SIP ridiculousness, we have to ignore bogus contacts in 100 etc responses */
 			if ((respid == 200) || ((respid >= 300) && (respid <= 399)))
 				extract_uri(p, req);
-			handle_response(p, respid, e + len, req, ignore, seqno);
+			handle_response(p, respid, e + len, req, seqno);
 		}
 		return 0;
 	}
@@ -11968,7 +11966,6 @@
 		/* 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;
 		ast_set_flag(req, SIP_PKT_IGNORE);
 		ast_set_flag(req, SIP_PKT_IGNORE_REQ);
 		if (option_debug > 2)
@@ -12015,7 +12012,7 @@
 		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);
+		res = handle_request_refer(p, req, debug, seqno, nounlock);
 		break;
 	case SIP_CANCEL:
 		res = handle_request_cancel(p, req);
@@ -12035,7 +12032,7 @@
 	case SIP_INFO:
 		if (ast_test_flag(req, SIP_PKT_DEBUG))
 			ast_verbose("Receiving INFO!\n");
-		if (!ignore) 
+		if (!ast_test_flag(req, SIP_PKT_IGNORE)) 
 			handle_request_info(p, req);
 		else  /* if ignoring, transmit response */
 			transmit_response(p, "200 OK", req);

Modified: team/oej/codename-pineapple/channels/sip3/sip3core.h
URL: http://svn.digium.com/view/asterisk/team/oej/codename-pineapple/channels/sip3/sip3core.h?rev=45296&r1=45295&r2=45296&view=diff
==============================================================================
--- team/oej/codename-pineapple/channels/sip3/sip3core.h (original)
+++ team/oej/codename-pineapple/channels/sip3/sip3core.h Tue Oct 17 01:49:06 2006
@@ -306,8 +306,8 @@
 extern void handle_response_invite(struct sip_pvt *p, int resp, char *rest, struct sip_request *req, int seqno);
 extern void handle_response_refer(struct sip_pvt *p, int resp, char *rest, struct sip_request *req, int seqno);
 extern int handle_response_peerpoke(struct sip_pvt *p, int resp, struct sip_request *req);
-extern int handle_response_register(struct sip_pvt *p, int resp, char *rest, struct sip_request *req, int ignore, int seqno);
-extern void handle_response(struct sip_pvt *p, int resp, char *rest, struct sip_request *req, int ignore, int seqno);
+extern int handle_response_register(struct sip_pvt *p, int resp, char *rest, struct sip_request *req, int seqno);
+extern void handle_response(struct sip_pvt *p, int resp, char *rest, struct sip_request *req, int seqno);
 
 /*----- RTP interface functions */
 extern int sip_set_rtp_peer(struct ast_channel *chan, struct ast_rtp *rtp, struct ast_rtp *vrtp, int codecs, int nat_active);

Modified: team/oej/codename-pineapple/channels/sip3/sip3funcs.h
URL: http://svn.digium.com/view/asterisk/team/oej/codename-pineapple/channels/sip3/sip3funcs.h?rev=45296&r1=45295&r2=45296&view=diff
==============================================================================
--- team/oej/codename-pineapple/channels/sip3/sip3funcs.h (original)
+++ team/oej/codename-pineapple/channels/sip3/sip3funcs.h Tue Oct 17 01:49:06 2006
@@ -56,6 +56,8 @@
 GNURK void sipnet_unlock(void);		/*!< Unlock netlock mutex */
 GNURK int sipsocket_open(void);		/* Open network socket for SIP */
 GNURK int sipsocket_initialized(void);		/* Check if we have network socket open */
+/* XXX these (including retrans_pkt) may not belong here in the future,
+   they involve the transaction states  and need to handle various transports (UDP, TCP) */
 GNURK int send_response(struct sip_pvt *p, struct sip_request *req, enum xmittype reliable, int seqno);
 GNURK int send_request(struct sip_pvt *p, struct sip_request *req, enum xmittype reliable, int seqno);
 



More information about the asterisk-commits mailing list