From aa0f407b8bfdfa7e28edcf6489faee02d191dc0e Mon Sep 17 00:00:00 2001
From: Terry Wilson <twilson@digium.com>
Date: Mon, 8 Nov 2010 19:59:39 +0000
Subject: [PATCH] Merged revisions 294207 via svnmerge from
 https://origsvn.digium.com/svn/asterisk/branches/1.8

........
  r294207 | twilson | 2010-11-08 13:56:10 -0600 (Mon, 08 Nov 2010) | 2 lines

  Set a default waittime, and make sure to convert it to milliseconds
........


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@294208 65c4cc65-6c06-0410-ace0-fbb531ad65f3
---
 configs/calendar.conf.sample | 6 +++---
 res/res_calendar.c           | 6 +++++-
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/configs/calendar.conf.sample b/configs/calendar.conf.sample
index 359e4d9d6d..ad3ce09834 100644
--- a/configs/calendar.conf.sample
+++ b/configs/calendar.conf.sample
@@ -31,7 +31,7 @@
 ;app = Playback          ; Application to execute on answer (instead of context/extension)
 ;appdata = tt-weasels    ; Data part of application to execute on answer
 ;
-;waittime = 30            ; How long to wait for an answer
+;waittime = 30            ; How long to wait for an answer, defaults to 30 seconds
 
 ;[calendar2]
 ; Note: Support for Exchange Server 2003 
@@ -76,7 +76,7 @@
 ;app = Playback          ; Application to execute on answer (instead of context/extension)
 ;appdata = tt-weasels    ; Data part of application to execute on answer
 ;
-;waittime = 30            ; How long to wait for an answer
+;waittime = 30            ; How long to wait for an answer, defaults to 30 seconds
 
 ;[calendar4]
 ;type = caldav            ;  type of calendar--currently supported: ical, caldav, exchange, or ews
@@ -99,4 +99,4 @@
 ;app = Playback          ; Application to execute on answer (instead of context/extension)
 ;appdata = tt-weasels    ; Data part of application to execute on answer
 ;
-;waittime = 30            ; How long to wait for an answer
+;waittime = 30            ; How long to wait for an answer, defaults to 30 seconds
diff --git a/res/res_calendar.c b/res/res_calendar.c
index 183b408453..5457f86f89 100644
--- a/res/res_calendar.c
+++ b/res/res_calendar.c
@@ -369,6 +369,7 @@ static struct ast_calendar *build_calendar(struct ast_config *cfg, const char *c
 
 	cal->refresh = 3600;
 	cal->timeframe = 60;
+	cal->notify_waittime = 30000;
 
 	for (v = ast_variable_browse(cfg, cat); v; v = v->next) {
 		if (!strcasecmp(v->name, "autoreminder")) {
@@ -380,7 +381,10 @@ static struct ast_calendar *build_calendar(struct ast_config *cfg, const char *c
 		} else if (!strcasecmp(v->name, "extension")) {
 			ast_string_field_set(cal, notify_extension, v->value);
 		} else if (!strcasecmp(v->name, "waittime")) {
-			cal->notify_waittime = atoi(v->value);
+			int i = atoi(v->value);
+			if (i > 0) {
+				cal->notify_waittime = 1000 * i;
+			}
 		} else if (!strcasecmp(v->name, "app")) {
 			ast_string_field_set(cal, notify_app, v->value);
 		} else if (!strcasecmp(v->name, "appdata")) {
-- 
GitLab