[asterisk-commits] trunk r16690 - /trunk/channels/chan_sip.c
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Fri Mar 31 08:19:05 MST 2006
Author: oej
Date: Fri Mar 31 09:19:04 2006
New Revision: 16690
URL: http://svn.digium.com/view/asterisk?rev=16690&view=rev
Log:
Make REG_STATE_* enum
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=16690&r1=16689&r2=16690&view=diff
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Fri Mar 31 09:19:04 2006
@@ -228,6 +228,19 @@
PROXY_AUTH,
WWW_AUTH,
};
+
+/* States for outbound registrations (with register= lines in sip.conf */
+enum sipregistrystate {
+ REG_STATE_UNREGISTERED = 0, /*!< We are not registred */
+ REG_STATE_REGSENT, /*!< Registration request sent */
+ REG_STATE_AUTHSENT, /*!< We have tried to authenticate */
+ REG_STATE_REGISTERED, /*!< Registred and done */
+ REG_STATE_REJECTED, /*!< Registration rejected */
+ REG_STATE_TIMEOUT, /*!< Registration timed out */
+ REG_STATE_NOAUTH, /*!< We have no accepted credentials */
+ REG_STATE_FAILED, /*!< Registration failed after several tries */
+};
+
/*! XXX Note that sip_methods[i].id == i must hold or the code breaks */
static const struct cfsip_methods {
@@ -852,16 +865,6 @@
};
-/* States for outbound registrations (with register= lines in sip.conf */
-#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_FAILED 7 /*!< Registration failed after several tries */
-
/*! \brief Registrations with other SIP proxies */
struct sip_registry {
@@ -887,7 +890,7 @@
int timeout; /*!< sched id of sip_reg_timeout */
int refresh; /*!< How often to refresh */
struct sip_pvt *call; /*!< create a sip_pvt structure for each outbound "registration dialog" in progress */
- int regstate; /*!< Registration state (see above) */
+ enum sipregistrystate regstate; /*!< Registration state (see above) */
int callid_valid; /*!< 0 means we haven't chosen callid for this registry yet. */
unsigned int ocseq; /*!< Sequence number we got to for REGISTERs for this registry */
struct sockaddr_in us; /*!< Who the server thinks we are */
@@ -5453,7 +5456,7 @@
}
/*! \build Convert registration state status to string */
-static char *regstate2str(int regstate)
+static char *regstate2str(enum sipregistrystate regstate)
{
switch(regstate) {
case REG_STATE_FAILED:
@@ -5732,7 +5735,7 @@
ast_verbose("REGISTER %d headers, %d lines\n", p->initreq.headers, p->initreq.lines);
}
determine_firstline_parts(&p->initreq);
- r->regstate=auth?REG_STATE_AUTHSENT:REG_STATE_REGSENT;
+ r->regstate = auth ? REG_STATE_AUTHSENT : REG_STATE_REGSENT;
r->regattempts++; /* Another attempt */
if (option_debug > 3)
ast_verbose("REGISTER attempt %d to %s@%s\n", r->regattempts, r->username, r->hostname);
@@ -9926,7 +9929,7 @@
return 0;
}
- r->regstate=REG_STATE_REGISTERED;
+ r->regstate = REG_STATE_REGISTERED;
manager_event(EVENT_FLAG_SYSTEM, "Registry", "Channel: SIP\r\nDomain: %s\r\nStatus: %s\r\n", r->hostname, regstate2str(r->regstate));
r->regattempts = 0;
ast_log(LOG_DEBUG, "Registration successful\n");
More information about the asterisk-commits
mailing list