[svn-commits] branch bweschke/findme_followme r32406 - /team/bweschke/findme_followme/apps/

svn-commits at lists.digium.com svn-commits at lists.digium.com
Mon Jun 5 13:36:18 MST 2006


Author: bweschke
Date: Mon Jun  5 15:36:18 2006
New Revision: 32406

URL: http://svn.digium.com/view/asterisk?rev=32406&view=rev
Log:
 takecall/definecall logic


Modified:
    team/bweschke/findme_followme/apps/app_followme.c

Modified: team/bweschke/findme_followme/apps/app_followme.c
URL: http://svn.digium.com/view/asterisk/team/bweschke/findme_followme/apps/app_followme.c?rev=32406&r1=32405&r2=32406&view=diff
==============================================================================
--- team/bweschke/findme_followme/apps/app_followme.c (original)
+++ team/bweschke/findme_followme/apps/app_followme.c Mon Jun  5 15:36:18 2006
@@ -89,6 +89,8 @@
 	char moh[AST_MAX_CONTEXT];	/*!< Music On Hold Class to be used */
 	char context[AST_MAX_CONTEXT];  /*!< Context to dial from */
 	unsigned int active;		/*!< Profile is active (1), or disabled (0). */
+	char takecall[20];		/*!< Digit mapping to take a call */
+	char nextindp[20];		/*!< Digit mapping to decline a call */
 
 	AST_LIST_HEAD_NOLOCK(numbers, number) numbers;	   /*!< Head of the list of follow-me numbers */
 	AST_LIST_HEAD_NOLOCK(blnumbers, number) blnumbers; /*!< Head of the list of black-listed numbers */
@@ -104,6 +106,8 @@
 	char context[AST_MAX_CONTEXT];
 	char namerecloc[AST_MAX_CONTEXT];
 	struct ast_channel *outbound;
+	char takecall[20];		/*!< Digit mapping to take a call */
+	char nextindp[20];		/*!< Digit mapping to decline a call */
 };
 
 struct findme_user {
@@ -163,6 +167,8 @@
 		ast_copy_string(f->name, fmname, sizeof(f->name));
 		ast_copy_string(f->moh, "", sizeof(f->moh));
 		ast_copy_string(f->context, "", sizeof(f->context));
+		ast_copy_string(f->takecall, takecall, sizeof(f->takecall));
+		ast_copy_string(f->nextindp, nextindp, sizeof(f->nextindp));
 		AST_LIST_HEAD_INIT_NOLOCK(&f->numbers);
 		AST_LIST_HEAD_INIT_NOLOCK(&f->blnumbers);
 		AST_LIST_HEAD_INIT_NOLOCK(&f->wlnumbers);
@@ -184,6 +190,10 @@
 		ast_copy_string(f->moh, val, sizeof(f->moh));
 	else if (!strcasecmp(param, "context")) {
 		ast_copy_string(f->context, val, sizeof(f->context));
+	} else if (!strcasecmp(param, "takecall")) {
+		ast_copy_string(f->takecall, val, sizeof(f->takecall));
+	} else if (!strcasecmp(param, "declinecall")) {
+		ast_copy_string(f->nextindp, val, sizeof(f->nextindp));
 	} else if (failunknown) {
 		if (linenum >= 0)
 			ast_log(LOG_WARNING, "Unknown keyword in profile '%s': %s at line %d of followme.conf\n", f->name, param, linenum);
@@ -228,6 +238,8 @@
 	int timeout;
 	char *timeoutstr;
 	int numorder;	
+	char *takecallstr;
+	char *declinecallstr;
 
 	cfg = ast_config_load("followme.conf");
 	if (!cfg) {
@@ -249,8 +261,15 @@
 	if (!ast_strlen_zero(featuredigittostr)) 
 		if (!scanf("%d", &featuredigittimeout))
 			featuredigittimeout = 5000;
-	
-	
+
+	takecallstr = ast_variable_retrieve(cfg, "general", "takecall");
+	if (!ast_strlen_zero(takecallstr))
+		ast_copy_string(takecall, takecallstr, sizeof(takecall));
+	
+	declinecallstr = ast_variable_retrieve(cfg, "general", "declinecall");
+	if (!ast_strlen_zero(declinecallstr))
+		ast_copy_string(nextindp, declinecallstr, sizeof(nextindp));
+
 	/* Chug through config file */
 	cat = ast_category_browse(cfg, NULL);
 	while(cat) {
@@ -372,7 +391,7 @@
 
 
 
-static struct ast_channel *wait_for_winner(struct findme_user_listptr *findme_user_list, struct number *nm, struct ast_channel *caller, char *namerecloc, int *status) 
+static struct ast_channel *wait_for_winner(struct findme_user_listptr *findme_user_list, struct number *nm, struct ast_channel *caller, char *namerecloc, int *status, struct fm_args *tpargs) 
 {
 	struct ast_channel *watchers[256];
 	int pos;
@@ -597,37 +616,16 @@
 						if (tmpuser->ynidx >= ynlongest) {
 							if (option_debug)
 								ast_log(LOG_DEBUG, "reached longest possible match - doing evals\n");
-							if (!strcmp(tmpuser->yn, takecall)) {
+							if (!strcmp(tmpuser->yn, tpargs->takecall)) {
 								if (option_debug)
 									ast_log(LOG_DEBUG, "Match to take the call!\n");
 								free(to);
 								return tmpuser->ochan;	
 							}
-							if (!strcmp(tmpuser->yn, nextindp)) {
+							if (!strcmp(tmpuser->yn, tpargs->nextindp)) {
 								if (option_debug)
 									ast_log(LOG_DEBUG, "Next in dial plan step requested.\n");
 								*status = 1;
-								free(to);
-								return NULL;
-							}	
-							if (!strcmp(tmpuser->yn, nextinfmfm)) {
-								if (option_debug)
-									ast_log(LOG_DEBUG, "Next in find me/follow me step requested.\n");
-								*status = 2;
-								free(to);
-								return NULL;
-							}	
-							if (!strcmp(tmpuser->yn, blindxferexten)) {
-								if (option_debug)
-									ast_log(LOG_DEBUG, "Blind Transfer requested.\n");
-								*status = 3;
-								free(to);
-								return NULL;
-							}	
-							if (!strcmp(tmpuser->yn, atxferexten)) {
-								if (option_debug)
-									ast_log(LOG_DEBUG, "Attended Transfer requested.\n");
-								*status = 4;
 								free(to);
 								return NULL;
 							}	
@@ -794,7 +792,7 @@
 				
 		status = 0;	
 		if (!AST_LIST_EMPTY(findme_user_list))
-			winner = wait_for_winner(findme_user_list, nm, caller, tpargs->namerecloc, &status);
+			winner = wait_for_winner(findme_user_list, nm, caller, tpargs->namerecloc, &status, tpargs);
 		
 					
 		AST_LIST_TRAVERSE_SAFE_BEGIN(findme_user_list, fmuser, entry) {



More information about the svn-commits mailing list