33
33
#include "callable_obj.h"
34
#include "str_utils.h"
35
36
#include "sflphone_const.h"
36
37
#include "logger.h"
37
38
#include "calltab.h"
38
39
#include "calllist.h"
40
conference_obj_t *create_new_conference(conference_state_t state, const gchar* const confID)
42
create_new_conference(conference_state_t state, const gchar* const confID)
42
44
if (confID == NULL) {
43
ERROR("Conference: Error: Conference ID is NULL while creating new conference");
45
ERROR("Conference ID is NULL while creating new conference");
47
DEBUG("Conference: Create new conference %s", confID);
49
DEBUG("Create new conference %s", confID);
50
52
conference_obj_t *new_conf = g_new0(conference_obj_t, 1);
53
ERROR("Conference: Error: Could not allocate data ");
58
55
new_conf->_state = state;
81
78
gchar *state_str = g_hash_table_lookup(details, "CONF_STATE");
83
if (g_strcasecmp(state_str, "ACTIVE_ATTACHED") == 0)
80
if (utf8_case_equal(state_str, "ACTIVE_ATTACHED"))
84
81
new_conf->_state = CONFERENCE_STATE_ACTIVE_ATTACHED;
85
else if (g_strcasecmp(state_str, "ACTIVE_ATTACHED_REC") == 0)
82
else if (utf8_case_equal(state_str, "ACTIVE_ATTACHED_REC"))
86
83
new_conf->_state = CONFERENCE_STATE_ACTIVE_ATTACHED_RECORD;
87
else if (g_strcasecmp(state_str, "ACTIVE_DETACHED") == 0)
84
else if (utf8_case_equal(state_str, "ACTIVE_DETACHED"))
88
85
new_conf->_state = CONFERENCE_STATE_ACTIVE_DETACHED;
89
else if (g_strcasecmp(state_str, "ACTIVE_DETACHED_REC") == 0)
86
else if (utf8_case_equal(state_str, "ACTIVE_DETACHED_REC"))
90
87
new_conf->_state = CONFERENCE_STATE_ACTIVE_DETACHED_RECORD;
91
else if (g_strcasecmp(state_str, "HOLD") == 0)
88
else if (utf8_case_equal(state_str, "HOLD"))
92
89
new_conf->_state = CONFERENCE_STATE_HOLD;
93
else if (g_strcasecmp(state_str, "HOLD_REC") == 0)
90
else if (utf8_case_equal(state_str, "HOLD_REC"))
94
91
new_conf->_state = CONFERENCE_STATE_HOLD_RECORD;
113
110
callable_obj_t *call = calllist_get_call(current_calls_tab, call_id);
116
ERROR("Conference: Error: Could not find %s", call_id);
113
ERROR("Could not find %s", call_id);
124
121
void conference_add_participant(const gchar* call_id, conference_obj_t* conf)
126
DEBUG("Conference: Conference %s, adding participant %s", conf->_confID, call_id);
123
DEBUG("Conference %s, adding participant %s", conf->_confID, call_id);
128
125
// store the new participant list after appending participant id
129
126
conf->participant_list = g_slist_append(conf->participant_list, (gpointer) g_strdup(call_id));
142
139
void conference_participant_list_update(gchar** participants, conference_obj_t* conf)
144
DEBUG("Conference: Participant list update");
147
ERROR("Conference: Error: Conference is NULL");
142
ERROR("Conference is NULL");
151
for (gchar **part = participants; part && *part; ++part) {
152
gchar *call_id = (gchar *) (*part);
153
callable_obj_t *call = calllist_get_call(current_calls_tab, call_id);
155
if (call->_confID != NULL) {
156
g_free(call->_confID);
157
call->_confID = NULL;
161
146
if (conf->participant_list) {
162
147
g_slist_free(conf->participant_list);
163
148
conf->participant_list = NULL;
166
151
for (gchar **part = participants; part && *part; ++part) {
167
152
gchar *call_id = (gchar *) (*part);
168
153
callable_obj_t *call = calllist_get_call(current_calls_tab, call_id);
169
call->_confID = g_strdup(conf->_confID);
155
restore_call(call_id);
156
call = calllist_get_call(current_calls_tab, call_id);
170
158
conference_add_participant(call_id, conf);