[asterisk-commits] mmichelson: branch group/CCSS r231056 - /team/group/CCSS/channels/chan_sip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Nov 24 10:53:23 CST 2009


Author: mmichelson
Date: Tue Nov 24 10:53:21 2009
New Revision: 231056

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=231056
Log:
* Mark a couple of unused functions with __attribute__((unused)) so the compiler
  will shut up already! GOSH!
* Mark the SIP_PUBLISH method as unallowed in handle_response_publish if we get a 405 or 501
* Call handle_response_publish for all replies to PUBLISH instead of adding fifty million
  invocations for each specific response code.
* I ate some pretzels while coding this, but I don't think I'll mention it in the commit message.


Modified:
    team/group/CCSS/channels/chan_sip.c

Modified: team/group/CCSS/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/group/CCSS/channels/chan_sip.c?view=diff&rev=231056&r1=231055&r2=231056
==============================================================================
--- team/group/CCSS/channels/chan_sip.c (original)
+++ team/group/CCSS/channels/chan_sip.c Tue Nov 24 10:53:21 2009
@@ -1759,7 +1759,7 @@
 	return backend ? backend->static_data : NULL;
 }
 
-static struct sip_epa_entry *create_epa_entry(const char * const event_package, const char * const destination)
+static __attribute__((unused)) struct sip_epa_entry *create_epa_entry (const char * const event_package, const char * const destination)
 {
 	struct sip_epa_entry *epa_entry;
 	const struct epa_static_data *static_data;
@@ -2879,7 +2879,7 @@
 static void transmit_fake_auth_response(struct sip_pvt *p, int sipmethod, struct sip_request *req, enum xmittype reliable);
 static int transmit_request(struct sip_pvt *p, int sipmethod, int inc, enum xmittype reliable, int newbranch);
 static int transmit_request_with_auth(struct sip_pvt *p, int sipmethod, int seqno, enum xmittype reliable, int newbranch);
-static int transmit_publish(struct sip_epa_entry *epa_entry, enum sip_publish_type publish_type, const char * body);
+static __attribute__((unused)) int transmit_publish(struct sip_epa_entry *epa_entry, enum sip_publish_type publish_type, const char * body);
 static int transmit_invite(struct sip_pvt *p, int sipmethod, int sdp, int init);
 static int transmit_reinvite_with_sdp(struct sip_pvt *p, int t38version, int oldsdp);
 static int transmit_info_with_digit(struct sip_pvt *p, const char digit, unsigned int duration);
@@ -11744,6 +11744,8 @@
 
 	initreqprep(&req, pvt, SIP_PUBLISH);
 
+	ast_set_flag(&pvt->flags[0], SIP_OUTGOING);
+
 	if (pvt->options && pvt->options->auth) {
 		add_header(&req, pvt->options->authheader, pvt->options->auth);
 	}
@@ -18883,7 +18885,12 @@
 		}
 	}
 
+	if (resp == 501 || resp == 405) {
+		mark_method_unallowed(&p->allowed_methods, SIP_PUBLISH);
+	}
+
 	if (resp == 200) {
+		p->authtries = 0;
 		/* If I've read section 6, item 6 of RFC 3903 correctly,
 		 * an ESC will only generate a new etag when it sends a 200 OK
 		 */
@@ -19784,6 +19791,11 @@
 		   need to hang around for something more "definitive" */
 		if (resp != 100)
 			handle_response_peerpoke(p, resp, req);
+	} else if (sipmethod == SIP_PUBLISH) {
+		/* SIP PUBLISH transcends this morass of doodoo and instead
+		 * we just always call the response handler. Good gravy!
+		 */
+		handle_response_publish(p, resp, rest, req, seqno);
 	} else if (ast_test_flag(&p->flags[0], SIP_OUTGOING)) {
 		switch(resp) {
 		case 100:	/* 100 Trying */




More information about the asterisk-commits mailing list