From dad897cf02dba92acbfe00897fc2043d2d72dbdb Mon Sep 17 00:00:00 2001
From: Yalu Zhang <yalu.zhang@iopsys.eu>
Date: Mon, 18 Nov 2024 16:43:08 +0100
Subject: [PATCH] Move the definition of enum call_action to voice-types.h to
 be shared with dectmngr

---
 libvoice/voice-types.h | 15 +++++++++++++++
 line.h                 | 14 --------------
 ubus.c                 |  2 ++
 3 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/libvoice/voice-types.h b/libvoice/voice-types.h
index ae80241..ccdac78 100644
--- a/libvoice/voice-types.h
+++ b/libvoice/voice-types.h
@@ -29,6 +29,7 @@ enum VOICE_CODEC {
 	VOICE_CODEC_G726,
 	VOICE_CODEC_G729,
 };
+
 enum voice_dtmf_mode {
 	VOICE_DTMF_NONE,
 	VOICE_DTMF_RFC_4733,
@@ -51,6 +52,20 @@ struct config_update_struct {
 	// add more if needed
 };
 
+// In UBUS request to voicemngr we need to define what this request is about
+enum call_action {
+	CALL_DEFAULT0,          // answer/release the call for PCM_0
+	CALL_DEFAULT1,          // answer/release the call for PCM_1
+	CALL_DIGIT_PRESSED,     // DTMF pressed
+	CALL_TOGGLE,            // Switch in Call Waiting
+	CALL_CONFERENCE,        // Join - start Call Conference
+	CALL_DECT_UNAVAILABLE,  // No DECT handset available for call
+	CALL_REJECT,            // indicate for call_reject event, upper 16 bits for pcm_id when using
+	CALL_MODE_SINGLE,       // indicate the Single Call Mode has been set for DECT line
+	CALL_MODE_MULTIPLE,     // indicate the Multiple Call Mode has been set for DECT line
+	CALL_LAST
+};
+
 /*
  * UBUS related definitions
  */
diff --git a/line.h b/line.h
index bc44dd7..64a212d 100644
--- a/line.h
+++ b/line.h
@@ -17,20 +17,6 @@ enum line_action_t {
 	ACTION_RINGING_STOP
 };
 
-// In UBUS request to voicemngr we need to define what this request is about
-enum call_action {
-	CALL_DEFAULT0,          // answer/release the call for PCM_0
-	CALL_DEFAULT1,          // answer/release the call for PCM_1
-	CALL_DIGIT_PRESSED,     // DTMF pressed
-	CALL_TOGGLE,            // Switch in Call Waiting
-	CALL_CONFERENCE,        // Join - start Call Conference
-	CALL_DECT_UNAVAILABLE,  // No DECT handset available for call
-	CALL_REJECT,            // indicate for call_reject event, upper 16 bits for pcm_id when using
-	CALL_MODE_SINGLE,       // indicate the Single Call Mode has been set for DECT line
-	CALL_MODE_MULTIPLE,     // indicate the Multiple Call Mode has been set for DECT line
-	CALL_LAST
-};
-
 // Event sent with UBUS when something has happened with a phone line
 struct line_event_t {
 	const char *name; // String communicated with Asterisk
diff --git a/ubus.c b/ubus.c
index e023885..1412839 100644
--- a/ubus.c
+++ b/ubus.c
@@ -737,8 +737,10 @@ static int ubus_request_status(struct ubus_context *uctx, struct ubus_object *ob
 		for(line = 0; line < totEndpoints; line++) {
 			void  *tbl;
 			tbl = blobmsg_open_table(&blob, NULL);
+
 			blobmsg_add_u32(&blob, "line", line);
 			blobmsg_add_u32(&blob, "offhook", voice_line_is_offhook(line + unpopulatedDectEndpoints));
+
 			blobmsg_close_table(&blob, tbl);
 		}
 
-- 
GitLab