[asterisk-commits] rizzo: branch rizzo/astobj2 r47914 - /team/rizzo/astobj2/channels/chan_sip.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Wed Nov 22 01:49:39 MST 2006


Author: rizzo
Date: Wed Nov 22 02:49:39 2006
New Revision: 47914

URL: http://svn.digium.com/view/asterisk?view=rev&rev=47914
Log:
remove the 'sipmethod' argument from transmit_register(),
as it is now it is a constant.


Modified:
    team/rizzo/astobj2/channels/chan_sip.c

Modified: team/rizzo/astobj2/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/rizzo/astobj2/channels/chan_sip.c?view=diff&rev=47914&r1=47913&r2=47914
==============================================================================
--- team/rizzo/astobj2/channels/chan_sip.c (original)
+++ team/rizzo/astobj2/channels/chan_sip.c Wed Nov 22 02:49:39 2006
@@ -1191,6 +1191,10 @@
 /*! \brief States for outbound registrations (with register= lines in sip.conf */
 enum sipregistrystate {
 	REG_STATE_UNREGISTERED = 0,	/*!< We are not registred */
+		/* Initial state. We should have r->expire > -1 to indicate
+		 * a scheduled transmission of the initial registration request.
+		 * When the timeout fires, we transmit the request and move to ...
+		 */
 	REG_STATE_REGSENT,	/*!< Registration request sent */
 	REG_STATE_AUTHSENT,	/*!< We have tried to authenticate */
 	REG_STATE_REGISTERED,	/*!< Registred and done */
@@ -1341,7 +1345,7 @@
 static int transmit_refer(struct sip_pvt *p, const char *dest);
 static int transmit_notify_with_mwi(struct sip_pvt *p, int newmsgs, int oldmsgs, char *vmexten);
 static int transmit_notify_with_sipfrag(struct sip_pvt *p, int cseq, char *message, int terminate);
-static int transmit_register(struct sip_registry *r, int sipmethod, const char *auth, const char *authheader);
+static int transmit_register(struct sip_registry *r, const char *auth, const char *authheader);
 static int send_response(struct sip_pvt *p, struct sip_request *req, enum xmittype reliable, int seqno);
 static int send_request(struct sip_pvt *p, struct sip_request *req, enum xmittype reliable, int seqno);
 static void copy_request(struct sip_request *dst, const struct sip_request *src);
@@ -7372,7 +7376,7 @@
 		ast_log(LOG_NOTICE, "   -- Re-registration for  %s@%s\n", r->username, r->hostname);
 
 	r->expire = -1;
-	transmit_register(r, SIP_REGISTER, NULL, NULL);
+	transmit_register(r, NULL, NULL);
 	unref_registry(r);
 	return 0;
 }
@@ -7413,7 +7417,7 @@
 	} else {
 		r->regstate = REG_STATE_UNREGISTERED;
 		r->timeout = -1;
-		res=transmit_register(r, SIP_REGISTER, NULL, NULL);
+		res=transmit_register(r, NULL, NULL);
 	}
 	manager_event(EVENT_FLAG_SYSTEM, "Registry", "ChannelDriver: SIP\r\nUsername: %s\r\nDomain: %s\r\nStatus: %s\r\n", r->username, r->hostname, regstate2str(r->regstate));
 	unref_registry(r);
@@ -7421,7 +7425,7 @@
 }
 
 /*! \brief Transmit register to SIP proxy or UA */
-static int transmit_register(struct sip_registry *r, int sipmethod, const char *auth, const char *authheader)
+static int transmit_register(struct sip_registry *r, const char *auth, const char *authheader)
 {
 	struct sip_request req;
 	char from[256];
@@ -7546,10 +7550,10 @@
 
 	p->branch ^= ast_random();
 
-	init_req(&req, sipmethod, addr);
+	init_req(&req, SIP_REGISTER, addr);
 
 	/* Add to CSEQ */
-	snprintf(tmp, sizeof(tmp), "%u %s", ++r->ocseq, sip_methods[sipmethod].text);
+	snprintf(tmp, sizeof(tmp), "%u %s", ++r->ocseq, sip_methods[SIP_REGISTER].text);
 	p->ocseq = r->ocseq;
 
 	build_via(p);
@@ -7578,7 +7582,7 @@
 		p->noncecount = r->noncecount++;
 
 		memset(digest,0,sizeof(digest));
-		if(!build_reply_digest(p, sipmethod, digest, sizeof(digest)))
+		if(!build_reply_digest(p, SIP_REGISTER, digest, sizeof(digest)))
 			add_header(&req, "Authorization", digest);
 		else
 			ast_log(LOG_NOTICE, "No authorization available for authentication of registration to %s@%s\n", r->username, r->hostname);
@@ -11455,7 +11459,7 @@
 		append_history(p, "RegistryAuth", "Try: %d", p->authtries);
  	if (sip_debug_test_pvt(p) && p->registry)
  		ast_verbose("Responding to challenge, registration to domain/host name %s\n", p->registry->hostname);
-	return transmit_register(p->registry, SIP_REGISTER, digest, respheader); 
+	return transmit_register(p->registry, digest, respheader); 
 }
 
 /*! \brief Add authentication on outbound SIP packet */
@@ -12359,7 +12363,7 @@
 			r->regstate = REG_STATE_REJECTED;
 		} else {
 			r->regstate = REG_STATE_UNREGISTERED;
-			transmit_register(r, SIP_REGISTER, NULL, NULL);
+			transmit_register(r, NULL, NULL);
 		}
 		manager_event(EVENT_FLAG_SYSTEM, "Registry", "Channel: SIP\r\nUsername: %s\r\nDomain: %s\r\nStatus: %s\r\n", r->username, r->hostname, regstate2str(r->regstate));
 		break;



More information about the asterisk-commits mailing list