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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Jul 20 11:17:04 CDT 2007


Author: rizzo
Date: Fri Jul 20 11:17:03 2007
New Revision: 76053

URL: http://svn.digium.com/view/asterisk?view=rev&rev=76053
Log:
documentation and other quasi-whitespace changes to
reduce diffs wrt trunk


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=76053&r1=76052&r2=76053
==============================================================================
--- team/rizzo/astobj2/channels/chan_sip.c (original)
+++ team/rizzo/astobj2/channels/chan_sip.c Fri Jul 20 11:17:03 2007
@@ -171,7 +171,7 @@
 /* guard min must be < 1000, and should be >= 250 */
 #define EXPIRY_GUARD_SECS       15                /*!< How long before expiry do we reregister */
 #define EXPIRY_GUARD_LIMIT      30                /*!< Below here, we use EXPIRY_GUARD_PCT instead of 
-                                                   EXPIRY_GUARD_SECS */
+                                                        EXPIRY_GUARD_SECS */
 #define EXPIRY_GUARD_MIN        500                /*!< This is the minimum guard time applied. If 
                                                    GUARD_PCT turns out to be lower than this, it 
                                                    will use this time instead.
@@ -214,7 +214,7 @@
 /*! \brief Global jitterbuffer configuration - by default, jb is disabled */
 static struct ast_jb_conf default_jbconf =
 {
-        .flags = 0,
+	.flags = 0,
 	.max_size = -1,
 	.resync_threshold = -1,
 	.impl = ""
@@ -444,7 +444,7 @@
 	{ SIP_OPT_EVENTLIST,	NOT_SUPPORTED,	"eventlist" },
 	/* GRUU: Globally Routable User Agent URI's */
 	{ SIP_OPT_GRUU,		NOT_SUPPORTED,	"gruu" },
-	/* Target-dialog: Target-dialog */
+	/* RFC4538: Target-dialog */
 	{ SIP_OPT_TARGET_DIALOG,NOT_SUPPORTED,	"tdialog" },
 	/* Disable the REFER subscription, RFC 4488 */
 	{ SIP_OPT_NOREFERSUB,	NOT_SUPPORTED,	"norefersub" },
@@ -498,6 +498,7 @@
 #define DEFAULT_PEDANTIC	FALSE
 #define DEFAULT_AUTOCREATEPEER	FALSE
 #define DEFAULT_QUALIFY		FALSE
+#define DEFAULT_REGEXTENONQUALIFY	FALSE
 #define DEFAULT_T1MIN		100		/*!< 100 MS for minimal roundtrip time */
 #define DEFAULT_MAX_CALL_BITRATE (384)		/*!< Max bitrate for video */
 #ifndef DEFAULT_USERAGENT
@@ -749,51 +750,57 @@
 	struct sip_auth *next;          /*!< Next auth structure in list */
 };
 
-/*--- Various flags for the flags field in the pvt structure */
-#define SIP_ALREADYGONE		(1 << 0)	/*!< Whether or not we've already been destroyed by our peer */
-#define SIP_NEEDDESTROY		(1 << 1)	/*!< if we need to be destroyed by the monitor thread */
-#define SIP_NOVIDEO		(1 << 2)	/*!< Didn't get video in invite, don't offer */
-#define SIP_RINGING		(1 << 3)	/*!< Have sent 180 ringing */
-#define SIP_PROGRESS_SENT	(1 << 4)	/*!< Have sent 183 message progress */
-#define SIP_NEEDREINVITE	(1 << 5)	/*!< Do we need to send another reinvite? */
-#define SIP_PENDINGBYE		(1 << 6)	/*!< Need to send bye after we ack? */
-#define SIP_GOTREFER		(1 << 7)	/*!< Got a refer? */
-#define SIP_PROMISCREDIR	(1 << 8)	/*!< Promiscuous redirection */
-#define SIP_TRUSTRPID		(1 << 9)	/*!< Trust RPID headers? */
-#define SIP_USEREQPHONE		(1 << 10)	/*!< Add user=phone to numeric URI. Default off */
-#define SIP_REALTIME		(1 << 11)	/*!< Flag for realtime users */
-#define SIP_USECLIENTCODE	(1 << 12)	/*!< Trust X-ClientCode info message */
-#define SIP_OUTGOING		(1 << 13)	/*!< Direction of the last transaction in this dialog */
+/*--- Various flags for the flags field in the pvt structure
+       Trying to sort these up:
+       D: Dialog only
+       DP: Dialog and peer/user
+       P: Peer/user only, not dialog
+       G: Global flag only
+*/
+#define SIP_ALREADYGONE		(1 << 0)	/*!< D: Whether or not we've already been destroyed by our peer */
+#define SIP_NEEDDESTROY		(1 << 1)	/*!< D: if we need to be destroyed by the monitor thread */
+#define SIP_NOVIDEO		(1 << 2)	/*!< D: Didn't get video in invite, don't offer */
+#define SIP_RINGING		(1 << 3)	/*!< D: Have sent 180 ringing */
+#define SIP_PROGRESS_SENT	(1 << 4)	/*!< D: Have sent 183 message progress */
+#define SIP_NEEDREINVITE	(1 << 5)	/*!< D: Do we need to send another reinvite? */
+#define SIP_PENDINGBYE		(1 << 6)	/*!< D: Need to send bye after we ack? */
+#define SIP_GOTREFER		(1 << 7)	/*!< D: Got a refer? */
+#define SIP_PROMISCREDIR	(1 << 8)	/*!< DP: Promiscuous redirection */
+#define SIP_TRUSTRPID		(1 << 9)	/*!< DP: Trust RPID headers? */
+#define SIP_USEREQPHONE		(1 << 10)	/*!< DP: Add user=phone to numeric URI. Default off */
+#define SIP_REALTIME		(1 << 11)	/*!< P: Flag for realtime users */
+#define SIP_USECLIENTCODE	(1 << 12)	/*!< DP: Trust X-ClientCode info message */
+#define SIP_OUTGOING		(1 << 13)	/*!< D: Direction of the last transaction in this dialog */
 #define SIP_FREE_BIT		(1 << 14)	/*!< ---- */
-#define SIP_DEFER_BYE_ON_TRANSFER	(1 << 15)	/*!< Do not hangup at first ast_hangup */
+#define SIP_DEFER_BYE_ON_TRANSFER	(1 << 15)	/*!< D: Do not hangup at first ast_hangup */
 
 /* DTMF flags - see str2dtmfmode() and dtmfmode2str() */
-#define SIP_DTMF		(3 << 16)	/*!< DTMF Support: four settings, uses two bits */
-#define SIP_DTMF_RFC2833	(0 << 16)	/*!< DTMF Support: RTP DTMF - "rfc2833" */
-#define SIP_DTMF_INBAND		(1 << 16)	/*!< DTMF Support: Inband audio, only for ULAW/ALAW - "inband" */
-#define SIP_DTMF_INFO		(2 << 16)	/*!< DTMF Support: SIP Info messages - "info" */
-#define SIP_DTMF_AUTO		(3 << 16)	/*!< DTMF Support: AUTO switch between rfc2833 and in-band DTMF */
+#define SIP_DTMF		(3 << 16)	/*!< DP: DTMF Support: four settings, uses two bits */
+#define SIP_DTMF_RFC2833	(0 << 16)	/*!< DP: DTMF Support: RTP DTMF - "rfc2833" */
+#define SIP_DTMF_INBAND		(1 << 16)	/*!< DP: DTMF Support: Inband audio, only for ULAW/ALAW - "inband" */
+#define SIP_DTMF_INFO		(2 << 16)	/*!< DP: DTMF Support: SIP Info messages - "info" */
+#define SIP_DTMF_AUTO		(3 << 16)	/*!< DP: DTMF Support: AUTO switch between rfc2833 and in-band DTMF */
 
 /* NAT settings */
-#define SIP_NAT			(3 << 18)	/*!< four settings, uses two bits */
-#define SIP_NAT_NEVER		(0 << 18)	/*!< No nat support */
-#define SIP_NAT_RFC3581		(1 << 18)	/*!< NAT RFC3581 */
-#define SIP_NAT_ROUTE		(2 << 18)	/*!< NAT Only ROUTE */
-#define SIP_NAT_ALWAYS		(3 << 18)	/*!< NAT Both ROUTE and RFC3581 */
+#define SIP_NAT			(3 << 18)	/*!< DP: four settings, uses two bits */
+#define SIP_NAT_NEVER		(0 << 18)	/*!< DP: No nat support */
+#define SIP_NAT_RFC3581		(1 << 18)	/*!< DP: NAT RFC3581 */
+#define SIP_NAT_ROUTE		(2 << 18)	/*!< DP: NAT Only ROUTE */
+#define SIP_NAT_ALWAYS		(3 << 18)	/*!< DP: NAT Both ROUTE and RFC3581 */
 
 /* re-INVITE related settings */
-#define SIP_REINVITE		(7 << 20)	/*!< three bits used */
-#define SIP_CAN_REINVITE	(1 << 20)	/*!< allow peers to be reinvited to send media directly p2p */
-#define SIP_CAN_REINVITE_NAT	(2 << 20)	/*!< allow media reinvite when new peer is behind NAT */
-#define SIP_REINVITE_UPDATE	(4 << 20)	/*!< use UPDATE (RFC3311) when reinviting this peer */
+#define SIP_REINVITE		(7 << 20)	/*!< DP: three bits used */
+#define SIP_CAN_REINVITE	(1 << 20)	/*!< DP: allow peers to be reinvited to send media directly p2p */
+#define SIP_CAN_REINVITE_NAT	(2 << 20)	/*!< DP: allow media reinvite when new peer is behind NAT */
+#define SIP_REINVITE_UPDATE	(4 << 20)	/*!< DP: use UPDATE (RFC3311) when reinviting this peer */
 
 /* "insecure" settings, see insecure2str() */
-#define SIP_INSECURE		(3 << 23)	/*!< two bits used */
-#define SIP_INSECURE_PORT	(1 << 23)	/*!< don't require matching port for incoming requests */
-#define SIP_INSECURE_INVITE	(1 << 24)	/*!< don't require authentication for incoming INVITEs */
+#define SIP_INSECURE		(3 << 23)	/*!< DP: two bits used */
+#define SIP_INSECURE_PORT	(1 << 23)	/*!< DP: don't require matching port for incoming requests */
+#define SIP_INSECURE_INVITE	(1 << 24)	/*!< DP: don't require authentication for incoming INVITEs */
 
 /* Sending PROGRESS in-band settings */
-#define SIP_PROG_INBAND		(3 << 25)	/*!< three settings, uses two bits */
+#define SIP_PROG_INBAND		(3 << 25)	/*!< DP: three settings, uses two bits */
 #define SIP_PROG_INBAND_NEVER	(0 << 25)
 #define SIP_PROG_INBAND_NO	(1 << 25)
 #define SIP_PROG_INBAND_YES	(2 << 25)
@@ -1367,13 +1374,14 @@
 /*! \brief A per-thread temporary pvt structure */
 AST_THREADSTORAGE_CUSTOM(ts_temp_pvt, temp_pvt_init, temp_pvt_cleanup);
 
-/*! \todo Move the sip_auth list to AST_LIST */
-static struct sip_auth *authl = NULL;		/*!< Authentication list for realm authentication */
+/*! \brief Authentication list for realm authentication
+ * \todo Move the sip_auth list to AST_LIST */
+static struct sip_auth *authl = NULL;
 
 
 /* --- Sockets and networking --------------*/
 
-/*!
+/*! \brief Main socket for SIP communication.
  * sipsock is shared between the manager thread (which handles reload
  * requests), the io handler (sipsock_read()) and the user routines that
  * issue writes (using __sip_xmit()).
@@ -2007,7 +2015,6 @@
 	ast_set_flag(&dialog->flags[0], SIP_ALREADYGONE);
 }
 
-
 /*! Resolve DNS srv name or host name in a sip_proxy structure */
 static int proxy_update(struct sip_proxy *proxy)
 {
@@ -2029,13 +2036,12 @@
 static struct sip_proxy *proxy_allocate(char *name, char *port, int force)
 {
 	struct sip_proxy *proxy;
-	proxy = ast_calloc(1, sizeof(struct sip_proxy));
+	proxy = ast_calloc(1, sizeof(*proxy));
 	if (!proxy)
 		return NULL;
 	proxy->force = force;
 	ast_copy_string(proxy->name, name, sizeof(proxy->name));
-	if (!ast_strlen_zero(port))
-		proxy->ip.sin_port = htons(atoi(port));
+	proxy->ip.sin_port = htons((!ast_strlen_zero(port) ? atoi(port) : STANDARD_SIP_PORT));
 	proxy_update(proxy);
 	return proxy;
 }




More information about the asterisk-commits mailing list