File amd_stats-18.patch of Package asterisk

--- asterisk-18.17.1/apps/app_amd.c	2023-04-03 11:47:51.000000000 -0400
+++ asterisk-18.17.1-new/apps/app_amd.c	2023-04-04 16:41:22.471799723 -0400
@@ -185,7 +185,7 @@
 	int iWordsCount = 0;
 	int currentState = STATE_IN_WORD;
 	int consecutiveVoiceDuration = 0;
-	char amdCause[256] = "", amdStatus[256] = "";
+	char amdCause[256] = "", amdStatus[256] = "", amdStats[256] = "";
 	char *parse = ast_strdupa(data);
 
 	/* Let's set the initial values of the variables that will control the algorithm.
@@ -476,9 +476,16 @@
 		sprintf(amdCause , "TOOLONG-%d", iTotalTime);
 	}
 
-	/* Set the status and cause on the channel */
+	/* gather the stats */
+	sprintf( amdStats, "%d-%d-%d-%d-%d-%d-%d-%d-%d",
+		iTotalTime, silenceDuration, initialSilence,
+		afterGreetingSilence, voiceDuration, consecutiveVoiceDuration,
+		greeting, iWordsCount, maximumNumberOfWords);
+
+	/* Set the status, cause, and stats on the channel */
 	pbx_builtin_setvar_helper(chan , "AMDSTATUS" , amdStatus);
 	pbx_builtin_setvar_helper(chan , "AMDCAUSE" , amdCause);
+	pbx_builtin_setvar_helper(chan , "AMDSTATS" , amdStats);
 
 	/* Restore channel read format */
 	if (readFormat && ast_set_read_format(chan, readFormat))
openSUSE Build Service is sponsored by