[Asterisk-code-review] res_calendar: output busy state as part of show calendar. (asterisk[master])

Jaco Kroon asteriskteam at digium.com
Thu Mar 23 04:14:10 CDT 2023


Jaco Kroon has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/20024 )


Change subject: res_calendar: output busy state as part of show calendar.
......................................................................

res_calendar: output busy state as part of show calendar.

Change-Id: I894e4ecc3e93db4ff7783d46266ba3c5e6ccda10
Signed-off-by: Jaco Kroon <jaco at uls.co.za>
---
M include/asterisk/calendar.h
M res/res_calendar.c
2 files changed, 28 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/24/20024/1

diff --git a/include/asterisk/calendar.h b/include/asterisk/calendar.h
index 4564c34..d22ae15 100644
--- a/include/asterisk/calendar.h
+++ b/include/asterisk/calendar.h
@@ -202,4 +202,7 @@
  */
 void ast_calendar_config_release(void);
 
+/*! \brief Convert a free-busy state integer value to a string.
+ */
+const char* ast_calendar_busy_state_to_str(enum ast_calendar_busy_state busy_state);
 #endif /* _ASTERISK_CALENDAR_H */
diff --git a/res/res_calendar.c b/res/res_calendar.c
index 4af1fde..428f10a 100644
--- a/res/res_calendar.c
+++ b/res/res_calendar.c
@@ -357,6 +357,20 @@
 	}
 }
 
+const char* ast_calendar_busy_state_to_str(enum ast_calendar_busy_state busy_state)
+{
+	switch (busy_state) {
+	case AST_CALENDAR_BS_FREE:
+		return "Free";
+	case AST_CALENDAR_BS_BUSY_TENTATIVE:
+		return "Busy (Tentative)";
+	case AST_CALENDAR_BS_BUSY:
+		return "Busy";
+	default:
+		return NULL;
+	}
+}
+
 static int calendar_busy_callback(void *obj, void *arg, int flags)
 {
 	struct ast_calendar_event *event = obj;
@@ -1683,6 +1697,7 @@
 		ast_cli(a->fd, FORMAT2, "Start", epoch_to_string(buf, sizeof(buf), event->start));
 		ast_cli(a->fd, FORMAT2, "End", epoch_to_string(buf, sizeof(buf), event->end));
 		ast_cli(a->fd, FORMAT2, "Alarm", epoch_to_string(buf, sizeof(buf), event->alarm));
+		ast_cli(a->fd, FORMAT2, "Busy State", ast_calendar_busy_state_to_str(event->busy_state) ?: "Unknown (Busy)");
 		ast_cli(a->fd, "\n");
 
 		event = ast_calendar_unref_event(event);

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/20024
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Change-Id: I894e4ecc3e93db4ff7783d46266ba3c5e6ccda10
Gerrit-Change-Number: 20024
Gerrit-PatchSet: 1
Gerrit-Owner: Jaco Kroon <jaco at uls.co.za>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20230323/906d9e0f/attachment-0001.html>


More information about the asterisk-code-review mailing list