[asterisk-commits] juggie: branch juggie/NoLossCDR r78565 - in /team/juggie/NoLossCDR: ./ apps/ ...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Aug 7 20:53:11 CDT 2007


Author: juggie
Date: Tue Aug  7 20:53:11 2007
New Revision: 78565

URL: http://svn.digium.com/view/asterisk?view=rev&rev=78565
Log:
Merged revisions 78527,78544,78561,78563-78564 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/team/group/CDRfix5

................
r78527 | automerge | 2007-08-07 18:29:43 -0400 (Tue, 07 Aug 2007) | 1 line

automerge commit
................
r78544 | automerge | 2007-08-07 19:26:08 -0400 (Tue, 07 Aug 2007) | 1 line

automerge cancel
................
r78561 | murf | 2007-08-07 20:19:50 -0400 (Tue, 07 Aug 2007) | 1 line

Set the cdr app fields when entering dial
................
r78563 | murf | 2007-08-07 21:09:35 -0400 (Tue, 07 Aug 2007) | 12 lines

Merged revisions 78541 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/trunk

........
r78541 | russell | 2007-08-07 17:04:01 -0600 (Tue, 07 Aug 2007) | 4 lines

Add another big set of doxygen documentation improvements from snuffy.
(closes issue #9892)
(closes issue #10395)

........

................
r78564 | murf | 2007-08-07 21:10:54 -0400 (Tue, 07 Aug 2007) | 1 line

oops. set the automerge again
................

Modified:
    team/juggie/NoLossCDR/   (props changed)
    team/juggie/NoLossCDR/apps/app_dial.c
    team/juggie/NoLossCDR/include/asterisk/features.h
    team/juggie/NoLossCDR/include/asterisk/manager.h
    team/juggie/NoLossCDR/main/manager.c
    team/juggie/NoLossCDR/main/pbx.c
    team/juggie/NoLossCDR/main/sha1.c
    team/juggie/NoLossCDR/pbx/pbx_spool.c
    team/juggie/NoLossCDR/res/res_crypto.c
    team/juggie/NoLossCDR/res/res_features.c
    team/juggie/NoLossCDR/utils/smsq.c

Propchange: team/juggie/NoLossCDR/
------------------------------------------------------------------------------
    automerge = *

Propchange: team/juggie/NoLossCDR/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Tue Aug  7 20:53:11 2007
@@ -1,1 +1,1 @@
-/team/group/CDRfix5:1-78522
+/team/group/CDRfix5:1-78564

Modified: team/juggie/NoLossCDR/apps/app_dial.c
URL: http://svn.digium.com/view/asterisk/team/juggie/NoLossCDR/apps/app_dial.c?view=diff&rev=78565&r1=78564&r2=78565
==============================================================================
--- team/juggie/NoLossCDR/apps/app_dial.c (original)
+++ team/juggie/NoLossCDR/apps/app_dial.c Tue Aug  7 20:53:11 2007
@@ -1257,6 +1257,9 @@
 
 	if (ast_test_flag64(&opts, OPT_RESETCDR) && chan->cdr)
 		ast_cdr_reset(chan->cdr, NULL);
+	if (chan->cdr)
+		ast_cdr_setapp(chan->cdr, "Dial", data);
+	
 	if (ast_test_flag64(&opts, OPT_PRIVACY) && ast_strlen_zero(opt_args[OPT_ARG_PRIVACY]))
 		opt_args[OPT_ARG_PRIVACY] = ast_strdupa(chan->exten);
 

Modified: team/juggie/NoLossCDR/include/asterisk/features.h
URL: http://svn.digium.com/view/asterisk/team/juggie/NoLossCDR/include/asterisk/features.h?view=diff&rev=78565&r1=78564&r2=78565
==============================================================================
--- team/juggie/NoLossCDR/include/asterisk/features.h (original)
+++ team/juggie/NoLossCDR/include/asterisk/features.h Tue Aug  7 20:53:11 2007
@@ -48,31 +48,37 @@
 
 
 
-/*! \brief Park a call and read back parked location 
- *  \param chan the channel to actually be parked
-    \param host the channel which will have the parked location read to
-	Park the channel chan, and read back the parked location to the
-	host.  If the call is not picked up within a specified period of
-	time, then the call will return to the last step that it was in 
-	(in terms of exten, priority and context)
-	\param timeout is a timeout in milliseconds
-	\param extout is a parameter to an int that will hold the parked location, or NULL if you want
+/*!
+ * \brief Park a call and read back parked location 
+ * \param chan the channel to actually be parked
+ * \param host the channel which will have the parked location read to.
+ * \param timeout is a timeout in milliseconds
+ * \param extout is a parameter to an int that will hold the parked location, or NULL if you want
+ * Park the channel chan, and read back the parked location to the host. 
+ * If the call is not picked up within a specified period of time, 
+ * then the call will return to the last step that it was in 
+ * (in terms of exten, priority and context)
+ * \retval 0 on success.
+ * \retval -1 on failure.
 */
 int ast_park_call(struct ast_channel *chan, struct ast_channel *host, int timeout, int *extout);
 
-/*! \brief Park a call via a masqueraded channel
- *  \param rchan the real channel to be parked
-    \param host the channel to have the parking read to
-	Masquerade the channel rchan into a new, empty channel which is then
-	parked with ast_park_call
-	\param timeout is a timeout in milliseconds
-	\param extout is a parameter to an int that will hold the parked location, or NULL if you want
+/*! 
+ * \brief Park a call via a masqueraded channel
+ * \param rchan the real channel to be parked
+ * \param host the channel to have the parking read to.
+ * \param timeout is a timeout in milliseconds
+ * \param extout is a parameter to an int that will hold the parked location, or NULL if you want
+ * Masquerade the channel rchan into a new, empty channel which is then parked with ast_park_call
+ * \retval 0 on success.
+ * \retval -1 on failure.
 */
 int ast_masq_park_call(struct ast_channel *rchan, struct ast_channel *host, int timeout, int *extout);
 
-/*! \brief Determine system parking extension
- *  Returns the call parking extension for drivers that provide special
-    call parking help */
+/*! 
+ * \brief Determine system parking extension
+ * \returns the call parking extension for drivers that provide special call parking help 
+*/
 const char *ast_parking_ext(void);
 
 /*! \brief Determine system call pickup extension */

Modified: team/juggie/NoLossCDR/include/asterisk/manager.h
URL: http://svn.digium.com/view/asterisk/team/juggie/NoLossCDR/include/asterisk/manager.h?view=diff&rev=78565&r1=78564&r2=78565
==============================================================================
--- team/juggie/NoLossCDR/include/asterisk/manager.h (original)
+++ team/juggie/NoLossCDR/include/asterisk/manager.h Tue Aug  7 20:53:11 2007
@@ -113,7 +113,7 @@
 	/*! Function to be called */
 	int (*func)(struct mansession *s, const struct message *m);
 	/*! For easy linking */
-	struct manager_action *next;
+	AST_RWLIST_ENTRY(manager_action) list;
 };
 
 /* External routines may register/unregister manager callbacks this way */

Modified: team/juggie/NoLossCDR/main/manager.c
URL: http://svn.digium.com/view/asterisk/team/juggie/NoLossCDR/main/manager.c?view=diff&rev=78565&r1=78564&r2=78565
==============================================================================
--- team/juggie/NoLossCDR/main/manager.c (original)
+++ team/juggie/NoLossCDR/main/manager.c Tue Aug  7 20:53:11 2007
@@ -188,9 +188,9 @@
 static AST_RWLIST_HEAD_STATIC(users, ast_manager_user);
 
 /*! \brief list of actions registered */
-static struct manager_action *first_action;
-AST_RWLOCK_DEFINE_STATIC(actionlock);
-
+static AST_RWLIST_HEAD_STATIC(actions, manager_action);
+
+/*! \brief list of hooks registered */
 static AST_RWLIST_HEAD_STATIC(manager_hooks, manager_custom_hook);
 
 /*! \brief Add a custom hook to be called when an event is fired */
@@ -412,14 +412,14 @@
 	int l = strlen(word), which = 0;
 	char *ret = NULL;
 
-	ast_rwlock_rdlock(&actionlock);
-	for (cur = first_action; cur; cur = cur->next) { /* Walk the list of actions */
+	AST_RWLIST_RDLOCK(&actions);
+	AST_RWLIST_TRAVERSE(&actions, cur, list) {
 		if (!strncasecmp(word, cur->action, l) && ++which > state) {
 			ret = ast_strdup(cur->action);
 			break;	/* make sure we exit even if ast_strdup() returns NULL */
 		}
 	}
-	ast_rwlock_unlock(&actionlock);
+	AST_RWLIST_UNLOCK(&actions);
 
 	return ret;
 }
@@ -500,8 +500,8 @@
 	if (argc != 4)
 		return RESULT_SHOWUSAGE;
 
-	ast_rwlock_rdlock(&actionlock);
-	for (cur = first_action; cur; cur = cur->next) { /* Walk the list of actions */
+	AST_RWLIST_RDLOCK(&actions);
+	AST_RWLIST_TRAVERSE(&actions, cur, list) {
 		for (num = 3; num < argc; num++) {
 			if (!strcasecmp(cur->action, argv[num])) {
 				ast_cli(fd, "Action: %s\nSynopsis: %s\nPrivilege: %s\n%s\n",
@@ -511,7 +511,7 @@
 			}
 		}
 	}
-	ast_rwlock_unlock(&actionlock);
+	AST_RWLIST_UNLOCK(&actions);
 
 	return RESULT_SUCCESS;
 }
@@ -612,10 +612,10 @@
 	ast_cli(fd, format, "Action", "Privilege", "Synopsis");
 	ast_cli(fd, format, "------", "---------", "--------");
 
-	ast_rwlock_rdlock(&actionlock);
-	for (cur = first_action; cur; cur = cur->next) /* Walk the list of actions */
+	AST_RWLIST_RDLOCK(&actions);
+	AST_RWLIST_TRAVERSE(&actions, cur, list)
 		ast_cli(fd, format, cur->action, authority_to_str(cur->authority, &authority), cur->synopsis);
-	ast_rwlock_unlock(&actionlock);
+	AST_RWLIST_UNLOCK(&actions);
 
 	return RESULT_SUCCESS;
 }
@@ -1439,7 +1439,7 @@
 	struct ast_str *temp = ast_str_alloca(BUFSIZ); /* XXX very large ? */
 
 	astman_start_ack(s, m);
-	for (cur = first_action; cur; cur = cur->next) { /* Walk the list of actions */
+	AST_RWLIST_TRAVERSE(&actions, cur, list) {
 		if ((s->writeperm & cur->authority) == cur->authority)
 			astman_append(s, "%s: %s (Priv: %s)\r\n",
 				cur->action, cur->synopsis, authority_to_str(cur->authority, &temp));
@@ -2361,8 +2361,8 @@
 		}
 	}
 
-	ast_rwlock_rdlock(&actionlock);	
-	for (tmp = first_action ; tmp; tmp = tmp->next) {
+	AST_RWLIST_RDLOCK(&actions);
+	AST_RWLIST_TRAVERSE(&actions, tmp, list) {
 		if (strcasecmp(action, tmp->action))
 			continue;
 		if ((s->writeperm & tmp->authority) == tmp->authority)
@@ -2371,7 +2371,8 @@
 			astman_send_error(s, m, "Permission denied");
 		break;
 	}
-	ast_rwlock_unlock(&actionlock);
+	AST_RWLIST_UNLOCK(&actions);
+
 	if (!tmp) {
 		ast_mutex_lock(&s->__lock);
 		astman_send_error(s, m, "Invalid/unknown command. Use Action: ListCommands to show available commands.");
@@ -2670,21 +2671,20 @@
  */
 int ast_manager_unregister(char *action)
 {
-	struct manager_action *cur, *prev;
-
-	ast_rwlock_wrlock(&actionlock);
-	for (cur = first_action, prev = NULL; cur; prev = cur, cur = cur->next) {
+	struct manager_action *cur;
+
+	AST_RWLIST_WRLOCK(&actions);
+	AST_RWLIST_TRAVERSE_SAFE_BEGIN(&actions, cur, list) {
 		if (!strcasecmp(action, cur->action)) {
-			if (prev)
-				prev->next = cur->next;
-			else
-				first_action = cur->next;
+			AST_RWLIST_REMOVE_CURRENT(&actions, list);
 			ast_free(cur);
 			ast_verb(2, "Manager unregistered action %s\n", action);
 			break;
 		}
 	}
-	ast_rwlock_unlock(&actionlock);
+	AST_RWLIST_TRAVERSE_SAFE_END
+	AST_RWLIST_UNLOCK(&actions);
+
 	return 0;
 }
 
@@ -2701,27 +2701,30 @@
 static int ast_manager_register_struct(struct manager_action *act)
 {
 	struct manager_action *cur, *prev = NULL;
-	int ret;
-
-	ast_rwlock_wrlock(&actionlock);
-	for (cur = first_action; cur; prev = cur, cur = cur->next) {
-		ret = strcasecmp(cur->action, act->action);
+
+	AST_RWLIST_WRLOCK(&actions);
+	AST_RWLIST_TRAVERSE(&actions, cur, list) {
+		int ret = strcasecmp(cur->action, act->action);
 		if (ret == 0) {
 			ast_log(LOG_WARNING, "Manager: Action '%s' already registered\n", act->action);
-			ast_rwlock_unlock(&actionlock);
+			AST_RWLIST_UNLOCK(&actions);
 			return -1;
 		}
-		if (ret > 0)	/* Insert these alphabetically */
+		if (ret > 0) { /* Insert these alphabetically */
+			prev = cur;
 			break;
-	}
-	if (prev)
-		prev->next = act;
+		}
+	}
+	
+	if (prev)	
+		AST_RWLIST_INSERT_AFTER(&actions, prev, act, list);
 	else
-		first_action = act;
-	act->next = cur;
+		AST_RWLIST_INSERT_HEAD(&actions, act, list);
 
 	ast_verb(2, "Manager registered action %s\n", act->action);
-	ast_rwlock_unlock(&actionlock);
+
+	AST_RWLIST_UNLOCK(&actions);
+
 	return 0;
 }
 
@@ -2729,10 +2732,9 @@
 	the preferred way to register a manager command */
 int ast_manager_register2(const char *action, int auth, int (*func)(struct mansession *s, const struct message *m), const char *synopsis, const char *description)
 {
-	struct manager_action *cur;
-
-	cur = ast_malloc(sizeof(*cur));
-	if (!cur)
+	struct manager_action *cur = NULL;
+
+	if (!(cur = ast_calloc(1, sizeof(*cur))))
 		return -1;
 
 	cur->action = action;
@@ -2740,7 +2742,6 @@
 	cur->func = func;
 	cur->synopsis = synopsis;
 	cur->description = description;
-	cur->next = NULL;
 
 	ast_manager_register_struct(cur);
 

Modified: team/juggie/NoLossCDR/main/pbx.c
URL: http://svn.digium.com/view/asterisk/team/juggie/NoLossCDR/main/pbx.c?view=diff&rev=78565&r1=78564&r2=78565
==============================================================================
--- team/juggie/NoLossCDR/main/pbx.c (original)
+++ team/juggie/NoLossCDR/main/pbx.c Tue Aug  7 20:53:11 2007
@@ -771,21 +771,24 @@
  * third argument to extension_match_core.
  */
 enum ext_match_t {
-	E_MATCHMORE = 	0x00,	/* extension can match but only with more 'digits' */
-	E_CANMATCH =	0x01,	/* extension can match with or without more 'digits' */
-	E_MATCH =	0x02,	/* extension is an exact match */
-	E_MATCH_MASK =	0x03,	/* mask for the argument to extension_match_core() */
-	E_SPAWN =	0x12,	/* want to spawn an extension. Requires exact match */
-	E_FINDLABEL =	0x22	/* returns the priority for a given label. Requires exact match */
+	E_MATCHMORE = 	0x00,	/*!< extension can match but only with more 'digits' */
+	E_CANMATCH =	0x01,	/*!< extension can match with or without more 'digits' */
+	E_MATCH =	0x02,	/*!< extension is an exact match */
+	E_MATCH_MASK =	0x03,	/*!< mask for the argument to extension_match_core() */
+	E_SPAWN =	0x12,	/*!< want to spawn an extension. Requires exact match */
+	E_FINDLABEL =	0x22	/*!< returns the priority for a given label. Requires exact match */
 };
 
-/*
- * Internal function for ast_extension_{match|close}
- * return 0 on no-match, 1 on match, 2 on early match.
+/*!
+ * \internal
+ * \brief used ast_extension_{match|close}
  * mode is as follows:
  *	E_MATCH		success only on exact match
  *	E_MATCHMORE	success only on partial match (i.e. leftover digits in pattern)
  *	E_CANMATCH	either of the above.
+ * \retval 0 on no-match
+ * \retval 1 on match
+ * \retval 2 on early match.
  */
 
 static int _extension_match_core(const char *pattern, const char *data, enum ext_match_t mode)
@@ -940,7 +943,7 @@
 	return ast_extension_match(cidpattern, callerid);
 }
 
-/* request and result for pbx_find_extension */
+/*! request and result for pbx_find_extension */
 struct pbx_find_info {
 #if 0
 	const char *context;
@@ -1078,8 +1081,9 @@
 	return NULL;
 }
 
-/*! \brief extract offset:length from variable name.
- * Returns 1 if there is a offset:length part, which is
+/*! 
+ * \brief extract offset:length from variable name.
+ * \return 1 if there is a offset:length part, which is
  * trimmed off (values go into variables)
  */
 static int parse_variable_name(char *var, int *offset, int *length, int *isfunc)
@@ -1104,12 +1108,15 @@
 	return 0;
 }
 
-/*! \brief takes a substring. It is ok to call with value == workspace.
- *
- * offset < 0 means start from the end of the string and set the beginning
+/*! 
+ *\brief takes a substring. It is ok to call with value == workspace.
+ * \param value
+ * \param offset < 0 means start from the end of the string and set the beginning
  *   to be that many characters back.
- * length is the length of the substring.  A value less than 0 means to leave
+ * \param length is the length of the substring, a value less than 0 means to leave
  * that many off the end.
+ * \param workspace
+ * \param workspace_len
  * Always return a copy in workspace.
  */
 static char *substring(const char *value, int offset, int length, char *workspace, size_t workspace_len)
@@ -1726,7 +1733,9 @@
  * E_FINDLABEL maps the label to a priority, and returns
  *	the priority on success, ... XXX
  * E_SPAWN, spawn an application,
- *	and return 0 on success, -1 on failure.
+ *	
+ * \retval 0 on success.
+ * \retval  -1 on failure.
  */
 static int pbx_extension_helper(struct ast_channel *c, struct ast_context *con,
 	const char *context, const char *exten, int priority,
@@ -1832,7 +1841,7 @@
 	}
 }
 
-/*! \brief  ast_hint_extension: Find hint for given extension in context */
+/*! \brief Find hint for given extension in context */
 static struct ast_exten *ast_hint_extension(struct ast_channel *c, const char *context, const char *exten)
 {
 	struct ast_exten *e;
@@ -1845,7 +1854,7 @@
 	return e;
 }
 
-/*! \brief  ast_extensions_state2: Check state of extension by using hints */
+/*! \brief Check state of extension by using hints */
 static int ast_extension_state2(struct ast_exten *e)
 {
 	char hint[AST_MAX_EXTENSION];
@@ -1930,7 +1939,7 @@
 	return AST_EXTENSION_NOT_INUSE;
 }
 
-/*! \brief  ast_extension_state2str: Return extension_state as string */
+/*! \brief Return extension_state as string */
 const char *ast_extension_state2str(int extension_state)
 {
 	int i;
@@ -1942,7 +1951,7 @@
 	return "Unknown";
 }
 
-/*! \brief  ast_extension_state: Check extension state for an extension by using hint */
+/*! \brief Check extension state for an extension by using hint */
 int ast_extension_state(struct ast_channel *c, const char *context, const char *exten)
 {
 	struct ast_exten *e;
@@ -2038,7 +2047,7 @@
 	return NULL;
 }
 
-/*! \brief  ast_extension_state_add: Add watcher for extension states */
+/*! \brief  Add watcher for extension states */
 int ast_extension_state_add(const char *context, const char *exten,
 			    ast_state_cb_type callback, void *data)
 {
@@ -2113,7 +2122,7 @@
 	return cblist->id;
 }
 
-/*! \brief  ast_extension_state_del: Remove a watcher from the callback list */
+/*! \brief Remove a watcher from the callback list */
 int ast_extension_state_del(int id, ast_state_cb_type callback)
 {
 	struct ast_state_cb **p_cur = NULL;	/* address of pointer to us */
@@ -2150,7 +2159,7 @@
 	return ret;
 }
 
-/*! \brief  ast_add_hint: Add hint to hint list, check initial extension state */
+/*! \brief Add hint to hint list, check initial extension state */
 static int ast_add_hint(struct ast_exten *e)
 {
 	struct ast_hint *hint;
@@ -2184,7 +2193,7 @@
 	return 0;
 }
 
-/*! \brief  ast_change_hint: Change hint for an extension */
+/*! \brief Change hint for an extension */
 static int ast_change_hint(struct ast_exten *oe, struct ast_exten *ne)
 {
 	struct ast_hint *hint;
@@ -2203,7 +2212,7 @@
 	return res;
 }
 
-/*! \brief  ast_remove_hint: Remove hint from extension */
+/*! \brief Remove hint from extension */
 static int ast_remove_hint(struct ast_exten *e)
 {
 	/* Cleanup the Notifys if hint is removed */
@@ -2238,7 +2247,7 @@
 }
 
 
-/*! \brief  ast_get_hint: Get hint for channel */
+/*! \brief Get hint for channel */
 int ast_get_hint(char *hint, int hintsize, char *name, int namesize, struct ast_channel *c, const char *context, const char *exten)
 {
 	struct ast_exten *e = ast_hint_extension(c, context, exten);
@@ -2286,7 +2295,7 @@
 	return pbx_extension_helper(c, NULL, context, exten, priority, NULL, callerid, E_SPAWN);
 }
 
-/* helper function to set extension and priority */
+/*! helper function to set extension and priority */
 static void set_ext_pri(struct ast_channel *c, const char *exten, int pri)
 {
 	ast_copy_string(c->exten, exten, sizeof(c->exten));
@@ -2294,9 +2303,10 @@
 }
 
 /*!
- * \brief collect digits from the channel into the buffer,
- * return -1 on error, 0 on timeout or done.
- */
+ * \brief collect digits from the channel into the buffer.
+ * \retval 0 on timeout or done.
+ * \retval -1 on error.
+*/
 static int collect_digits(struct ast_channel *c, int waittime, char *buf, int buflen, int pos)
 {
 	int digit;
@@ -2510,7 +2520,11 @@
 	return 0;
 }
 
-/* Returns 0 on success, non-zero if a configured limit (maxcalls, maxload, minmemfree) was reached */
+/*! 
+ * \brief Increase call count for channel
+ * \retval 0 on success
+ * \retval non-zero if a configured limit (maxcalls, maxload, minmemfree) was reached 
+*/
 static int increase_call_count(const struct ast_channel *c)
 {
 	int failed = 0;
@@ -2640,9 +2654,11 @@
 	return oldval;
 }
 
-/* lookup for a context with a given name,
- * return with conlock held if found, NULL if not found
- */
+/*!
+ * \brief lookup for a context with a given name,
+ * \retval with conlock held if found.
+ * \retval NULL if not found.
+*/
 static struct ast_context *find_context_locked(const char *context)
 {
 	struct ast_context *c = NULL;
@@ -2657,11 +2673,12 @@
 	return NULL;
 }
 
-/*
+/*!
+ * \brief Remove included contexts.
  * This function locks contexts list by &conlist, search for the right context
  * structure, leave context list locked and call ast_context_remove_include2
  * which removes include, unlock contexts list and return ...
- */
+*/
 int ast_context_remove_include(const char *context, const char *include, const char *registrar)
 {
 	int ret = -1;
@@ -2675,13 +2692,14 @@
 	return ret;
 }
 
-/*
+/*!
+ * \brief Locks context, remove included contexts, unlocks context.
  * When we call this function, &conlock lock must be locked, because when
  * we giving *con argument, some process can remove/change this context
  * and after that there can be segfault.
  *
- * This function locks given context, removes include, unlock context and
- * return.
+ * \retval 0 on success.
+ * \retval -1 on failure.
  */
 int ast_context_remove_include2(struct ast_context *con, const char *include, const char *registrar)
 {
@@ -4649,9 +4667,11 @@
 	return count;
 }
 
-/*! \brief add the extension in the priority chain.
- * returns 0 on success, -1 on failure
- */
+/*! 
+ * \brief add the extension in the priority chain.
+ * \retval 0 on success.
+ * \retval -1 on failure.
+*/
 static int add_pri(struct ast_context *con, struct ast_exten *tmp,
 	struct ast_exten *el, struct ast_exten *e, int replace)
 {
@@ -4929,11 +4949,40 @@
 	return NULL;
 }
 
+/*! 
+ * \brief Function to post an empty cdr after a spool call fails.
+ * \note This function posts an empty cdr for a failed spool call
+*/
+static int ast_pbx_outgoing_cdr_failed(void)
+{
+	/* allocate a channel */
+	struct ast_channel *chan = ast_channel_alloc(0, AST_STATE_DOWN, 0, 0, "", "", "", 0, 0);
+
+	if (!chan)
+		return -1;  /* failure */
+
+	if (!chan->cdr) {
+		/* allocation of the cdr failed */
+		ast_channel_free(chan);   /* free the channel */
+		return -1;                /* return failure */
+	}
+
+	/* allocation of the cdr was successful */
+	ast_cdr_init(chan->cdr, chan);  /* initialize our channel's cdr */
+	ast_cdr_start(chan->cdr);       /* record the start and stop time */
+	ast_cdr_end(chan->cdr);
+	ast_cdr_failed(chan->cdr);      /* set the status to failed */
+	ast_cdr_detach(chan->cdr);      /* post and free the record */
+	ast_channel_free(chan);         /* free the channel */
+
+	return 0;  /* success */
+}
+
 int ast_pbx_outgoing_exten(const char *type, int format, void *data, int timeout, const char *context, const char *exten, int priority, int *reason, int sync, const char *cid_num, const char *cid_name, struct ast_variable *vars, const char *account, struct ast_channel **channel)
 {
 	struct ast_channel *chan;
 	struct async_stat *as;
-	int res = -1;
+	int res = -1, cdr_res = -1;
 	struct outgoing_helper oh;
 
 	if (sync) {
@@ -4981,6 +5030,13 @@
 			} else {
 				ast_verb(4, "Channel %s was never answered.\n", chan->name);
 
+				if (chan->cdr) { /* update the cdr */
+					/* here we update the status of the call, which sould be busy.
+			  		 * if that fails then we set the status to failed */
+					if (ast_cdr_disposition(chan->cdr, chan->hangupcause))
+		 			ast_cdr_failed(chan->cdr);
+ 	  	  		}
+
 				if (channel) {
 					*channel = NULL;
 					ast_channel_unlock(chan);
@@ -4990,6 +5046,14 @@
 		}
 
 		if (res < 0) { /* the call failed for some reason */
+			if (*reason == 0) { /* if the call failed (not busy or no answer)
+					     * update the cdr with the failed message */
+	  	  		cdr_res = ast_pbx_outgoing_cdr_failed();
+				if (cdr_res != 0) {
+	  	  			res = cdr_res;
+	  	  			goto outgoing_exten_cleanup;
+	  	  		}
+			}
 
 			/* create a fake channel and execute the "failed" extension (if it exists) within the requested context */
 			/* check if "failed" exists */
@@ -5074,7 +5138,7 @@
 {
 	struct ast_channel *chan;
 	struct app_tmp *tmp;
-	int res = -1;
+	int res = -1, cdr_res = -1;
 	struct outgoing_helper oh;
 
 	memset(&oh, 0, sizeof(oh));
@@ -5126,7 +5190,24 @@
 				}
 			} else {
 				ast_verb(4, "Channel %s was never answered.\n", chan->name);
+				if (chan->cdr) { /* update the cdr */
+					/* here we update the status of the call, which sould be busy.
+			  	  	* if that fails then we set the status to failed */
+					if (ast_cdr_disposition(chan->cdr, chan->hangupcause))
+						ast_cdr_failed(chan->cdr);
+				}
 				ast_hangup(chan);
+			}
+		}
+
+		if (res < 0) { /* the call failed for some reason */
+			if (*reason == 0) { /* if the call failed (not busy or no answer)
+				 	    * update the cdr with the failed message */
+	  			cdr_res = ast_pbx_outgoing_cdr_failed();
+				if (cdr_res != 0) {
+	  	 			res = cdr_res;
+	  				goto outgoing_app_cleanup;
+	  			}
 			}
 		}
 

Modified: team/juggie/NoLossCDR/main/sha1.c
URL: http://svn.digium.com/view/asterisk/team/juggie/NoLossCDR/main/sha1.c?view=diff&rev=78565&r1=78564&r2=78565
==============================================================================
--- team/juggie/NoLossCDR/main/sha1.c (original)
+++ team/juggie/NoLossCDR/main/sha1.c Tue Aug  7 20:53:11 2007
@@ -1,6 +1,6 @@
-/*
- *
- * Based on the RFC 3174
+/*! \file
+ *
+ * \brief Based on the RFC 3174
  * 
  * Full Copyright Statement
  *
@@ -63,9 +63,7 @@
 
 #include "asterisk/sha1.h"
 
-/*
- *  Define the SHA1 circular left shift macro
- */
+/*! Define the SHA1 circular left shift macro */
 #define SHA1CircularShift(bits,word) \
 		         (((word) << (bits)) | ((word) >> (32-(bits))))
 
@@ -73,20 +71,12 @@
 void SHA1PadMessage(SHA1Context *);
 void SHA1ProcessMessageBlock(SHA1Context *);
 
-/*
- *  SHA1Reset
- *
- *  Description:
- *	  This function will initialize the SHA1Context in preparation
- *	  for computing a new SHA1 message digest.
- *
- *  Parameters:
- *	  context: [in/out]
- *		   The context to reset.
- *
- *  Returns:
- *	  sha Error Code.
- *
+/*!
+ * \brief SHA1Reset
+ * \param context the context to be reset
+ * This function will initialize the SHA1Context in preparation
+ * for computing a new SHA1 message digest.
+ * \return sha Error Code.
  */
 int SHA1Reset(SHA1Context *context)
 {
@@ -110,24 +100,15 @@
 	return shaSuccess;
 }
 
-/*
- *  SHA1Result
- *
- *  Description:
- *	  This function will return the 160-bit message digest into the
- *	  Message_Digest array  provided by the caller.
- *	  NOTE: The first octet of hash is stored in the 0th element,
- *		     the last octet of hash in the 19th element.
- *
- *  Parameters:
- *	  context: [in/out]
- *		   The context to use to calculate the SHA-1 hash.
- *	  Message_Digest: [out]
- *		   Where the digest is returned.
- *
- *  Returns:
- *	  sha Error Code.
- *
+/*!
+ * \brief SHA1Result
+ * \param context [in/out] The context to use to calculate the SHA-1 hash.
+ * \param Message_Digest [out] Where the digest is returned.
+ *  This function will return the 160-bit message digest into the
+ *  Message_Digest array  provided by the caller.
+ * \note The first octet of hash is stored in the 0th element, 
+ * 	the last octet of hash in the 19th element.
+ * \return sha Error Code.
  */
 int SHA1Result( SHA1Context *context,
 		         uint8_t Message_Digest[SHA1HashSize])
@@ -160,25 +141,15 @@
 	return shaSuccess;
 }
 
-/*
- *  SHA1Input
- *
- *  Description:
- *	  This function accepts an array of octets as the next portion
- *	  of the message.
- *
- *  Parameters:
- *	  context: [in/out]
- *		   The SHA context to update
- *	  message_array: [in]
- *		   An array of characters representing the next portion of
+/*!
+ *  \brief SHA1Input
+ * \param context [in/out] The SHA context to update
+ * \param message_array [in] An array of characters representing the next portion of
  *		   the message.
- *	  length: [in]
- *		   The length of the message in message_array
- *
- *  Returns:
- *	  sha Error Code.
- *
+ * \param length [in] The length of the message in message_array
+ *  This function accepts an array of octets as the next portion
+ *  of the message.
+ * \return sha Error Code.
  */
 int SHA1Input(SHA1Context *context, const uint8_t *message_array, unsigned length)
 {
@@ -221,25 +192,13 @@
 	return shaSuccess;
 }
 
-/*
- *  SHA1ProcessMessageBlock
- *
- *  Description:
- *	  This function will process the next 512 bits of the message
- *	  stored in the Message_Block array.
- *
- *  Parameters:
- *	  None.
- *
- *  Returns:
- *	  Nothing.
- *
- *  Comments:
- *	  Many of the variable names in this code, especially the
+/*!
+ * \brief Process the next 512 bits of the message stored in the Message_Block array.
+ * \param context [in/out] The SHA context to update
+ * \note  Many of the variable names in this code, especially the
  *	  single character names, were used because those were the
  *	  names used in the publication.
- *
- *
+ * \returns nothing.
  */
 void SHA1ProcessMessageBlock(SHA1Context *context)
 {
@@ -320,27 +279,20 @@
 }
 
 
-/*
- *  SHA1PadMessage
- *
- *  Description:
- *	  According to the standard, the message must be padded to an even
- *	  512 bits.  The first padding bit must be a '1'.  The last 64
- *	  bits represent the length of the original message.  All bits in
- *	  between should be 0.  This function will pad the message
- *	  according to those rules by filling the Message_Block array
- *	  accordingly.  It will also call the ProcessMessageBlock function
- *	  provided appropriately.  When it returns, it can be assumed that
- *	  the message digest has been computed.
- *
- *  Parameters:
- *	  context: [in/out]
- *		   The context to pad
- *	  ProcessMessageBlock: [in]
- *		   The appropriate SHA*ProcessMessageBlock function
- *  Returns:
- *	  Nothing.
- *
+/*!
+ * \brief Pad message to be 512 bits.
+ * \param context [in/out]  The context to pad
+ * 
+ * According to the standard, the message must be padded to an even
+ *  512 bits.  The first padding bit must be a '1'.  The last 64
+ *  bits represent the length of the original message.  All bits in
+ *  between should be 0.  This function will pad the message
+ *  according to those rules by filling the Message_Block array
+ *  accordingly.  It will also call the ProcessMessageBlock function
+ *  provided appropriately.  When it returns, it can be assumed that
+ *  the message digest has been computed.
+ *
+ * \returns nothing.
  */
 
 void SHA1PadMessage(SHA1Context *context)

Modified: team/juggie/NoLossCDR/pbx/pbx_spool.c
URL: http://svn.digium.com/view/asterisk/team/juggie/NoLossCDR/pbx/pbx_spool.c?view=diff&rev=78565&r1=78564&r2=78565
==============================================================================
--- team/juggie/NoLossCDR/pbx/pbx_spool.c (original)
+++ team/juggie/NoLossCDR/pbx/pbx_spool.c Tue Aug  7 20:53:11 2007
@@ -68,18 +68,18 @@
 
 struct outgoing {
 	char fn[256];
-	/* Current number of retries */
+	/*! Current number of retries */
 	int retries;
-	/* Maximum number of retries permitted */
+	/*! Maximum number of retries permitted */
 	int maxretries;
-	/* How long to wait between retries (in seconds) */
+	/*! How long to wait between retries (in seconds) */
 	int retrytime;
-	/* How long to wait for an answer */
+	/*! How long to wait for an answer */
 	int waittime;
-	/* PID which is currently calling */
+	/*! PID which is currently calling */
 	long callingpid;
 	
-	/* What to connect to outgoing */
+	/*! What to connect to outgoing */
 	char tech[256];
 	char dest[256];
 	
@@ -96,16 +96,16 @@
 	char cid_num[256];
 	char cid_name[256];
 
-	/* account code */
+	/*! account code */
 	char account[AST_MAX_ACCOUNT_CODE];
 
-	/* Variables and Functions */
+	/*! Variables and Functions */
 	struct ast_variable *vars;
 	
-	/* Maximum length of call */
+	/*! Maximum length of call */
 	int maxlen;
 
-	/* options */
+	/*! options */
 	struct ast_flags options;
 };
 

Modified: team/juggie/NoLossCDR/res/res_crypto.c
URL: http://svn.digium.com/view/asterisk/team/juggie/NoLossCDR/res/res_crypto.c?view=diff&rev=78565&r1=78564&r2=78565
==============================================================================
--- team/juggie/NoLossCDR/res/res_crypto.c (original)
+++ team/juggie/NoLossCDR/res/res_crypto.c Tue Aug  7 20:53:11 2007
@@ -93,6 +93,16 @@
 };
 
 static AST_RWLIST_HEAD_STATIC(keys, ast_key);
+
+/*!
+ * \brief setting of priv key
+ * \param buf
+ * \param size
+ * \param rwflag
+ * \param userdata
+ * \return length of string,-1 on failure
+*/
+
 
 /*!
  * \brief setting of priv key
@@ -283,6 +293,10 @@
  * \brief signs outgoing message with public key
  * \see ast_sign_bin
 */
+/*!
+ * \brief signs outgoing message with public key
+ * \see ast_sign_bin
+*/
 static int __ast_sign_bin(struct ast_key *key, const char *msg, int msglen, unsigned char *dsig)
 {
 	unsigned char digest[20];

Modified: team/juggie/NoLossCDR/res/res_features.c
URL: http://svn.digium.com/view/asterisk/team/juggie/NoLossCDR/res/res_features.c?view=diff&rev=78565&r1=78564&r2=78565
==============================================================================
--- team/juggie/NoLossCDR/res/res_features.c (original)
+++ team/juggie/NoLossCDR/res/res_features.c Tue Aug  7 20:53:11 2007
@@ -197,7 +197,10 @@
 
 
 
-/*! \brief store context, priority and extension */
+/*!
+ * \brief store context, extension and priority 
+ * \param chan, context, ext, pri
+*/
 static void set_c_e_p(struct ast_channel *chan, const char *context, const char *ext, int pri)
 {
 	ast_copy_string(chan->context, context, sizeof(chan->context));
@@ -205,6 +208,13 @@
 	chan->priority = pri;
 }
 
+/*!
+ * \brief Check goto on transfer
+ * \param chan
+ * Check if channel has 'GOTO_ON_BLINDXFR' set, if not exit.
+ * When found make sure the types are compatible. Check if channel is valid
+ * if so start the new channel else hangup the call. 
+*/
 static void check_goto_on_transfer(struct ast_channel *chan) 
 {
 	struct ast_channel *xferchan;
@@ -243,7 +253,13 @@
 
 static struct ast_channel *ast_feature_request_and_dial(struct ast_channel *caller, struct ast_channel *transferee, const char *type, int format, void *data, int timeout, int *outstate, const char *cid_num, const char *cid_name, int igncallerstate);
 
-
+/*!
+ * \brief bridge the call 
+ * \param data thread bridge 
+ * Set Last Data for respective channels, reset cdr for channels
+ * bridge call, check if we're going back to dialplan
+ * if not hangup both legs of the call
+*/
 static void *ast_bridge_call_thread(void *data) 
 {
 	struct ast_bridge_thread_obj *tobj = data;
@@ -281,6 +297,11 @@
 	return NULL;
 }
 
+/*!
+ * \brief create thread for the parked call
+ * \param data
+ * Create thread and attributes, call ast_bridge_call_thread
+*/
 static void ast_bridge_call_thread_launch(void *data) 
 {
 	pthread_t thread;
@@ -295,6 +316,14 @@
 	pthread_setschedparam(thread, SCHED_RR, &sched);
 }
 
+/*!
+ * \brief Announce call parking by ADSI
+ * \param chan
+ * \param parkingexten
+ * Create message to show for ADSI, display message.
+ * \retval 0 on success.
+ * \retval -1 on failure.
+*/
 static int adsi_announce_park(struct ast_channel *chan, char *parkingexten)
 {
 	int res;
@@ -340,9 +369,7 @@
 	return AST_DEVICE_INUSE;
 }
 
-/*! \brief Park a call 
- 	\note We put the user in the parking list, then wake up the parking thread to be sure it looks
-	after these channels too */
+/* Park a call */
 int ast_park_call(struct ast_channel *chan, struct ast_channel *peer, int timeout, int *extout)
 {
 	struct parkeduser *pu, *cur;
@@ -470,6 +497,7 @@
 	return 0;
 }
 
+/* Park call via masquraded channel */
 int ast_masq_park_call(struct ast_channel *rchan, struct ast_channel *peer, int timeout, int *extout)
 {
 	struct ast_channel *chan;
@@ -510,9 +538,11 @@
 #define FEATURE_SENSE_CHAN	(1 << 0)
 #define FEATURE_SENSE_PEER	(1 << 1)
 
-/*! \brief
- * set caller and callee according to the direction
- */
+/*! 
+ * \brief set caller and callee according to the direction 
+ * \param caller, callee, peer, chan, sense
+ * Detect who triggered feature and set callee/caller variables accordingly
+*/
 static void set_peers(struct ast_channel **caller, struct ast_channel **callee,
 	struct ast_channel *peer, struct ast_channel *chan, int sense)
 {
@@ -525,7 +555,16 @@
 	}
 }
 
-/*! \brief support routing for one touch call parking */
+/*! 
+ * \brief support routing for one touch call parking
+ * \param chan channel parking call
+ * \param peer channel to be parked
+ * \param config unsed
+ * \param code unused
+ * \param sense feature options 
+ * Setup channel, set return exten,priority to 's,1'
+ * answer chan, sleep chan, park call
+*/
 static int builtin_parkcall(struct ast_channel *chan, struct ast_channel *peer, struct ast_bridge_config *config, char *code, int sense)
 {
 	struct ast_channel *parker;
@@ -559,6 +598,18 @@
 
 }
 
+/*!
+ * \brief Monitor a channel by DTMF
+ * \param chan channel requesting monitor
+ * \param peer channel to be monitored
+ * \param config
+ * \param code
+ * \param sense
+ * Check monitor app enabled, setup channels, both caller/callee chans not null
+ * get TOUCH_MONITOR variable for filename if exists, exec monitor app.
+ * \retval FEATURE_RETURN_SUCCESS on success.
+ * \retval -1 on error.
+*/
 static int builtin_automonitor(struct ast_channel *chan, struct ast_channel *peer, struct ast_bridge_config *config, char *code, int sense)
 {
 	char *caller_chan_id = NULL, *callee_chan_id = NULL, *args = NULL, *touch_filename = NULL;
@@ -654,7 +705,13 @@
         return ast_autoservice_stop(chan);
 }
 
-/*! \brief Find the context for the transfer */
+/*!
+ * \brief Find the context for the transfer
+ * \param transferer
+ * \param transferee
+ * Grab the TRANSFER_CONTEXT, if fails try grabbing macrocontext.
+ * \return a context string
+*/
 static const char *real_ctx(struct ast_channel *transferer, struct ast_channel *transferee)
 {
         const char *s = pbx_builtin_getvar_helper(transferer, "TRANSFER_CONTEXT");
@@ -667,6 +724,18 @@
         return s;  
 }
 
+/*!
+ * \brief Blind transfer user to another extension
+ * \param chan channel initiated blind transfer
+ * \param peer channel to be transfered
+ * \param config
+ * \param code
+ * \param sense
+ * Place peer on hold, check if tranfered to parkinglot extension,
+ * otherwise check extension exists and transfer caller.
+ * \retval FEATURE_RETURN_SUCCESS.
+ * \retval -1 on failure.
+*/
 static int builtin_blindtransfer(struct ast_channel *chan, struct ast_channel *peer, struct ast_bridge_config *config, char *code, int sense)
 {
 	struct ast_channel *transferer;
@@ -754,6 +823,13 @@
 	return FEATURE_RETURN_SUCCESS;
 }
 
+/*!
+ * \brief make channels compatible
+ * \param c
+ * \param newchan
+ * \retval 0 on success.
+ * \retval -1 on failure.
+*/
 static int check_compat(struct ast_channel *c, struct ast_channel *newchan)
 {
 	if (ast_channel_make_compatible(c, newchan) < 0) {
@@ -765,6 +841,18 @@
 	return 0;
 }
 
+/*!
+ * \brief Attended transfer
+ * \param chan
+ * \param peer
+ * \param config
+ * \param code
+ * \param sense
+ * Get extension to transfer to, if you cannot generate channel (or find extension) 
+ * return to host channel. After called channel answered wait for hangup of transferer,
+ * bridge call between transfer peer (taking them off hold) to attended transfer channel.
+ * \return -1 means what failure/success both?
+*/
 static int builtin_atxfer(struct ast_channel *chan, struct ast_channel *peer, struct ast_bridge_config *config, char *code, int sense)
 {
 	struct ast_channel *transferer;
@@ -1025,7 +1113,12 @@
 	ast_verb(2, "Registered Feature '%s'\n",feature->sname);
 }
 

[... 338 lines stripped ...]



More information about the asterisk-commits mailing list