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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sun Jul 22 21:46:20 CDT 2007


Author: rizzo
Date: Sun Jul 22 21:46:19 2007
New Revision: 76459

URL: http://svn.digium.com/view/asterisk?view=rev&rev=76459
Log:
more merge from 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=76459&r1=76458&r2=76459
==============================================================================
--- team/rizzo/astobj2/channels/chan_sip.c (original)
+++ team/rizzo/astobj2/channels/chan_sip.c Sun Jul 22 21:46:19 2007
@@ -4878,8 +4878,7 @@
 }
 
 
-/*!
- * Allocate SIP_PVT structure, set defaults and store in the container.
+/*! \brief Allocate sip_pvt structure, set defaults and link in the container.
  * Returns a reference to the object so whoever uses it later must
  * remember to release the reference.
  */
@@ -5098,7 +5097,7 @@
 
 /*!
  * Connect incoming SIP message to current dialog or create new dialog structure
- * Returns a reference to the sip_pvt object, remember to give it back once done (done)
+ * Returns a reference to the sip_pvt object, remember to give it back once done.
  *	Called by handle_request, sipsock_read
  */
 static struct sip_pvt *find_call(struct sip_request *req, struct sockaddr_in *sin, const int intended_method)
@@ -8063,8 +8062,7 @@
 	return map_x_s(regstatestrings, regstate, "Unknown");
 }
 
-/*!
- * Update registration with SIP Proxy.
+/*! Update registration with SIP Proxy.
  * Called from the scheduler when the previous registration expires,
  * so we don't have to cancel the pending event.
  * We assume the reference so the sip_registry is valid, since it
@@ -10660,8 +10658,9 @@
 	regex_t regexbuf;
 	int havepattern = FALSE;
 
-#define FORMAT2 "%-25.25s  %-15.15s %-3.3s %-3.3s %-3.3s %-8s %-10s %-10s\n"
-#define FORMAT  "%-25.25s  %-15.15s %-3.3s %-3.3s %-3.3s %-8d %-10s %-10s\n"
+/* the last argument is left-aligned, so we don't need a size anyways */
+#define FORMAT2 "%-25.25s  %-15.15s %-3.3s %-3.3s %-3.3s %-8s %-10s %s\n"
+#define FORMAT  "%-25.25s  %-15.15s %-3.3s %-3.3s %-3.3s %-8d %-10s %s\n"
 
 	char name[256];
 	int total_peers = 0;
@@ -11637,6 +11636,14 @@
 	return &subscription_types[0];
 }
 
+/*
+ * We try to structure all functions that loop on data structures as
+ * a handler for individual entries, and a mainloop that iterates
+ * on the main data structure. This way, moving the code to containers
+ * that support iteration through callbacks will be a lot easier.
+ */
+
+/*! \brief argument for the 'show channels|subscriptions' callback. */
 struct __show_chan_arg {
 	int fd;
 	int subscriptions;
@@ -11646,6 +11653,8 @@
 #define FORMAT3 "%-15.15s  %-10.10s  %-11.11s  %-15.15s  %-13.13s  %-15.15s %-10.10s\n"
 #define FORMAT2 "%-15.15s  %-10.10s  %-11.11s  %-11.11s  %-4.4s  %-7.7s  %-15.15s\n"
 #define FORMAT  "%-15.15s  %-10.10s  %-11.11s  %5.5d/%5.5d  %-4.4s  %-3.3s %-3.3s  %-15.15s %-10.10s\n"
+
+/*! \brief callback for show channel|subscription */
 static int show_channels_cb(void *__cur, void *__arg, int flags)
 {
 	struct sip_pvt *cur = __cur;
@@ -11726,7 +11735,11 @@
 #undef FORMAT3
 }
 
-/*! \brief Support routine for 'sip show channel' CLI */
+/*! \brief Support routine for 'sip show channel' and 'sip show history' CLI
+ * This is in charge of generating all strings that match a prefix in the
+ * given position. As many functions of this kind, each invokation has
+ * O(state) time complexity so be careful in using it.
+ */
 static char *complete_sipch(const char *line, const char *word, int pos, int state)
 {
 	int which=0;
@@ -12884,7 +12897,7 @@
 		e = strchr(s, '/');
 		if (e)
 			*e = '\0';
-		ast_debug(1, "Found promiscuous redirection to 'SIP/%s'\n", s);
+		ast_debug(2, "Found promiscuous redirection to 'SIP/%s'\n", s);
 		if (p->owner)
 			ast_string_field_build(p->owner, call_forward, "SIP/%s", s);
 	} else {
@@ -12899,6 +12912,7 @@
 		e = strchr(tmp, '/');	/* WHEN do we hae a forward slash in the URI? */
 		if (e)
 			*e = '\0';
+
 		if (!strncasecmp(s, "sip:", 4))
 			s += 4;
 		e = strchr(s, ';');	/* And username ; parameters? */
@@ -12926,7 +12940,7 @@
 		ast_clear_flag(&p->flags[0], SIP_PENDINGBYE);	
 		sip_scheddestroy(p, DEFAULT_TRANS_TIMEOUT);
 	} else if (ast_test_flag(&p->flags[0], SIP_NEEDREINVITE)) {
-		ast_debug(1, "Sending pending reinvite on '%s'\n", p->callid);
+		ast_debug(2, "Sending pending reinvite on '%s'\n", p->callid);
 		/* Didn't get to reinvite yet, so do it now */
 		transmit_reinvite_with_sdp(p, FALSE);
 		ast_clear_flag(&p->flags[0], SIP_NEEDREINVITE);	




More information about the asterisk-commits mailing list