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

svn-commits at lists.digium.com svn-commits at lists.digium.com
Mon Jun 5 20:28:10 MST 2006


Author: bweschke
Date: Mon Jun  5 22:28:10 2006
New Revision: 32477

URL: http://svn.digium.com/view/asterisk?rev=32477&view=rev
Log:
 Getting there! Custom prompt filename code (part 1/2)


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=32477&r1=32476&r2=32477&view=diff
==============================================================================
--- team/bweschke/findme_followme/apps/app_followme.c (original)
+++ team/bweschke/findme_followme/apps/app_followme.c Mon Jun  5 22:28:10 2006
@@ -91,6 +91,12 @@
 	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 */
+	char callfromprompt[AST_CONFIG_MAX_PATH];
+	char norecordingprompt[AST_CONFIG_MAX_PATH];
+	char optionsprompt[AST_CONFIG_MAX_PATH];
+	char plsholdprompt[AST_CONFIG_MAX_PATH];
+	char statusprompt[AST_CONFIG_MAX_PATH];
+	char sorryprompt[AST_CONFIG_MAX_PATH];
 
 	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 */
@@ -108,6 +114,12 @@
 	struct ast_channel *outbound;
 	char takecall[20];		/*!< Digit mapping to take a call */
 	char nextindp[20];		/*!< Digit mapping to decline a call */
+	char callfromprompt[AST_CONFIG_MAX_PATH];
+	char norecordingprompt[AST_CONFIG_MAX_PATH];
+	char optionsprompt[AST_CONFIG_MAX_PATH];
+	char plsholdprompt[AST_CONFIG_MAX_PATH];
+	char statusprompt[AST_CONFIG_MAX_PATH];
+	char sorryprompt[AST_CONFIG_MAX_PATH];
 };
 
 struct findme_user {
@@ -129,7 +141,14 @@
 static int featuredigittimeout = 5000;		/*!< Feature Digit Timeout */
 static const char *defaultmoh = "default";    	/*!< Default Music-On-Hold Class */
 
-static char takecall[20] = "1", nextindp[20] = "2", nextinfmfm[20] = "", blindxferexten[20] = "", atxferexten[20] = "";
+static char takecall[20] = "1", nextindp[20] = "2";
+static char callfromprompt[AST_CONFIG_MAX_PATH] = "followme/call-from";
+static char norecordingprompt[AST_CONFIG_MAX_PATH] = "followme/no-recording";
+static char optionsprompt[AST_CONFIG_MAX_PATH] = "followme/followme-options";
+static char plsholdprompt[AST_CONFIG_MAX_PATH] = "followme/pls-hold-while-try";
+static char statusprompt[AST_CONFIG_MAX_PATH] = "followme/followme-status";
+static char sorryprompt[AST_CONFIG_MAX_PATH] = "followme/followme-sorry";
+
 
 static AST_LIST_HEAD_STATIC(followmes, ast_call_followme);
 AST_LIST_HEAD_NOLOCK(findme_user_listptr, findme_user);
@@ -169,6 +188,12 @@
 		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_copy_string(f->callfromprompt, callfromprompt, sizeof(f->callfromprompt));
+		ast_copy_string(f->norecordingprompt, norecordingprompt, sizeof(f->norecordingprompt));
+		ast_copy_string(f->optionsprompt, optionsprompt, sizeof(f->optionsprompt));
+		ast_copy_string(f->plsholdprompt, plsholdprompt, sizeof(f->plsholdprompt));
+		ast_copy_string(f->statusprompt, statusprompt, sizeof(f->statusprompt));
+		ast_copy_string(f->sorryprompt, sorryprompt, sizeof(f->sorryprompt));
 		AST_LIST_HEAD_INIT_NOLOCK(&f->numbers);
 		AST_LIST_HEAD_INIT_NOLOCK(&f->blnumbers);
 		AST_LIST_HEAD_INIT_NOLOCK(&f->wlnumbers);
@@ -186,6 +211,7 @@
    
 static void profile_set_param(struct ast_call_followme *f, const char *param, const char *val, int linenum, int failunknown)
 {
+
 	if (!strcasecmp(param, "musicclass") || !strcasecmp(param, "musiconhold") || !strcasecmp(param, "music")) 
 		ast_copy_string(f->moh, val, sizeof(f->moh));
 	else if (!strcasecmp(param, "context")) {
@@ -194,6 +220,18 @@
 		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 (!strcasecmp(param, "call-from-prompt")) {
+		ast_copy_string(f->callfromprompt, val, sizeof(f->callfromprompt));
+	} else if (!strcasecmp(param, "followme-recording-prompt")) {
+		ast_copy_string(f->norecordingprompt, val, sizeof(f->norecordingprompt));
+	} else if (!strcasecmp(param, "followme-options-prompt")) {
+		ast_copy_string(f->optionsprompt, val, sizeof(f->optionsprompt));
+	} else if (!strcasecmp(param, "followme-pls-hold-prompt")) {
+		ast_copy_string(f->plsholdprompt, val, sizeof(f->plsholdprompt));
+	} else if (!strcasecmp(param, "followme-status-prompt")) {
+		ast_copy_string(f->statusprompt, val, sizeof(f->statusprompt));
+	} else if (!strcasecmp(param, "followme-sorry-prompt")) {
+		ast_copy_string(f->sorryprompt, val, sizeof(f->sorryprompt));
 	} 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);
@@ -240,6 +278,7 @@
 	int numorder;	
 	char *takecallstr;
 	char *declinecallstr;
+	char *tmpstr;
 
 	cfg = ast_config_load("followme.conf");
 	if (!cfg) {
@@ -269,6 +308,30 @@
 	declinecallstr = ast_variable_retrieve(cfg, "general", "declinecall");
 	if (!ast_strlen_zero(declinecallstr))
 		ast_copy_string(nextindp, declinecallstr, sizeof(nextindp));
+
+	tmpstr = ast_variable_retrieve(cfg, "general", "call-from-prompt");
+	if (!ast_strlen_zero(tmpstr))
+		ast_copy_string(callfromprompt, tmpstr, sizeof(callfromprompt));
+
+	tmpstr = ast_variable_retrieve(cfg, "general", "followme-norecording-prompt");
+	if (!ast_strlen_zero(tmpstr))
+		ast_copy_string(norecordingprompt, tmpstr, sizeof(norecordingprompt));
+
+	tmpstr = ast_variable_retrieve(cfg, "general", "followme-options-prompt");
+	if (!ast_strlen_zero(tmpstr))
+		ast_copy_string(optionsprompt, tmpstr, sizeof(optionsprompt));
+
+	tmpstr = ast_variable_retrieve(cfg, "general", "followme-pls-hold-prompt");
+	if (!ast_strlen_zero(tmpstr))
+		ast_copy_string(plsholdprompt, tmpstr, sizeof(plsholdprompt));
+
+	tmpstr = ast_variable_retrieve(cfg, "general", "followme-status-prompt");
+	if (!ast_strlen_zero(tmpstr))
+		ast_copy_string(statusprompt, tmpstr, sizeof(statusprompt));
+
+	tmpstr = ast_variable_retrieve(cfg, "general", "followme-sorry-prompt");
+	if (!ast_strlen_zero(tmpstr))
+		ast_copy_string(sorryprompt, tmpstr, sizeof(sorryprompt));
 
 	/* Chug through config file */
 	cat = ast_category_browse(cfg, NULL);
@@ -409,8 +472,8 @@
 
 	/* ------------ wait_for_winner_channel start --------------- */ 
 
-	callfromname = ast_strdupa("call-from");
-	pressbuttonname = ast_strdupa("press-1-to-be-connected-or");	
+	callfromname = ast_strdupa(tpargs->callfromprompt);
+	pressbuttonname = ast_strdupa(tpargs->optionsprompt);	
 
 	if (!AST_LIST_EMPTY(findme_user_list))
 	{
@@ -702,16 +765,10 @@
 
 	/* We're going to figure out what the longest possible string of digits to collect is */
 	ynlongest = 0;
-	if (strlen(takecall) > ynlongest)
-		ynlongest = strlen(takecall);
-	if (strlen(nextindp) > ynlongest)
-		ynlongest = strlen(nextindp);
-	if (strlen(nextinfmfm) > ynlongest)
-		ynlongest = strlen(nextinfmfm);
-	if (strlen(blindxferexten) > ynlongest)
-		ynlongest = strlen(blindxferexten);
-	if (strlen(atxferexten) > ynlongest)
-		ynlongest = strlen(atxferexten);
+	if (strlen(tpargs->takecall) > ynlongest)
+		ynlongest = strlen(tpargs->takecall);
+	if (strlen(tpargs->nextindp) > ynlongest)
+		ynlongest = strlen(tpargs->nextindp);
 
 	idx = 1;
 	caller = tpargs->chan;
@@ -889,6 +946,14 @@
 				ast_mutex_lock(&f->lock);
 				targs.mohclass = ast_strdupa(f->moh);
 				ast_copy_string(targs.context, f->context, sizeof(targs.context));
+				ast_copy_string(targs.takecall, f->takecall, sizeof(targs.takecall));
+				ast_copy_string(targs.nextindp, f->nextindp, sizeof(targs.nextindp));
+				ast_copy_string(targs.callfromprompt, f->callfromprompt, sizeof(targs.callfromprompt));
+				ast_copy_string(targs.norecordingprompt, f->norecordingprompt, sizeof(targs.norecordingprompt));
+				ast_copy_string(targs.optionsprompt, f->optionsprompt, sizeof(targs.optionsprompt));
+				ast_copy_string(targs.plsholdprompt, f->plsholdprompt, sizeof(targs.plsholdprompt));
+				ast_copy_string(targs.statusprompt, f->statusprompt, sizeof(targs.statusprompt));
+				ast_copy_string(targs.sorryprompt, f->sorryprompt, sizeof(targs.sorryprompt));
 				/* Copy the numbers we're going to use into another list in case the master list should get modified 
 				   (and locked) while we're trying to do a follow-me */
 				AST_LIST_HEAD_INIT_NOLOCK(&targs.cnumbers);
@@ -902,7 +967,7 @@
 				duration = 5;
 				if (ast_play_and_record(chan, "vm-rec-name", namerecloc, 5, "sln", &duration, 128, 0, NULL) < 0)
 					goto outrun;
-				if (ast_streamfile(chan, "pls-hold-while-try", chan->language))
+				if (ast_streamfile(chan, targs.plsholdprompt, chan->language))
 					goto outrun;
 				if (ast_waitstream(chan, "") < 0)
 					goto outrun;



More information about the svn-commits mailing list