Skip to content
Snippets Groups Projects
Commit 66c4ff56 authored by Tristan Matthews's avatar Tristan Matthews
Browse files
parents 39a2eb3f ae8c4c31
No related branches found
No related tags found
No related merge requests found
...@@ -748,7 +748,7 @@ calltree_update_call_recursive(calltab_t* tab, callable_obj_t * c, GtkTreeIter * ...@@ -748,7 +748,7 @@ calltree_update_call_recursive(calltab_t* tab, callable_obj_t * c, GtkTreeIter *
void calltree_update_call(calltab_t* tab, callable_obj_t * c) void calltree_update_call(calltab_t* tab, callable_obj_t * c)
{ {
return calltree_update_call_recursive(tab, c, NULL); calltree_update_call_recursive(tab, c, NULL);
} }
void calltree_add_call(calltab_t* tab, callable_obj_t * c, GtkTreeIter *parent) void calltree_add_call(calltab_t* tab, callable_obj_t * c, GtkTreeIter *parent)
......
...@@ -145,13 +145,21 @@ incoming_message_cb(DBusGProxy *proxy UNUSED, const gchar* callID UNUSED, const ...@@ -145,13 +145,21 @@ incoming_message_cb(DBusGProxy *proxy UNUSED, const gchar* callID UNUSED, const
im_widget_add_message(IM_WIDGET(*widget), from, msg, 0); im_widget_add_message(IM_WIDGET(*widget), from, msg, 0);
} }
static void /**
call_state_cb(DBusGProxy *proxy UNUSED, const gchar* callID, const gchar* state, * Perform the right sflphone action based on the requested state
void * foo UNUSED) */
static void process_existant_call_state_change(callable_obj_t *c, const gchar *state)
{ {
callable_obj_t *c = calllist_get_call(current_calls_tab, callID); if(c == NULL) {
ERROR("Pointer to call is NULL in %s\n", __func__);
return;
}
if(state == NULL) {
ERROR("Pointer to state is NULL in %s\n", __func__);
return;
}
if (c) {
if (g_strcmp0(state, "HUNGUP") == 0) { if (g_strcmp0(state, "HUNGUP") == 0) {
if (c->_state == CALL_STATE_CURRENT) { if (c->_state == CALL_STATE_CURRENT) {
time(&c->_time_stop); time(&c->_time_stop);
...@@ -178,8 +186,30 @@ call_state_cb(DBusGProxy *proxy UNUSED, const gchar* callID, const gchar* state, ...@@ -178,8 +186,30 @@ call_state_cb(DBusGProxy *proxy UNUSED, const gchar* callID, const gchar* state,
} else if (g_strcmp0(state, "BUSY") == 0) { } else if (g_strcmp0(state, "BUSY") == 0) {
sflphone_busy(c); sflphone_busy(c);
} }
} else {
ERROR("DBUS: Error: Call is NULL in %s", __func__); return;
}
/**
* This function process call state changes in case the call have not been created yet.
* This mainly occurs when anotehr SFLphone client takes actions.
*/
static void process_inexistant_call_state_change(const gchar *callID, const gchar *state)
{
if(callID == NULL) {
ERROR("Pointer to call id is NULL in %s\n", __func__);
return;
}
if(state == NULL) {
ERROR("Pointer to state is NULL in %s\n", __func__);
return;
}
// Could occur if a user picked up the phone and hung up without making a call
if(g_strcmp0(state, "HUNGUP") == 0)
return;
// The callID is unknow, threat it like a new call // The callID is unknow, threat it like a new call
// If it were an incoming call, we won't be here // If it were an incoming call, we won't be here
...@@ -202,6 +232,24 @@ call_state_cb(DBusGProxy *proxy UNUSED, const gchar* callID, const gchar* state, ...@@ -202,6 +232,24 @@ call_state_cb(DBusGProxy *proxy UNUSED, const gchar* callID, const gchar* state,
update_actions(); update_actions();
calltree_display(current_calls_tab); calltree_display(current_calls_tab);
} }
}
/**
* Callback called when a
*/
static void
call_state_cb(DBusGProxy *proxy UNUSED, const gchar* callID, const gchar* state,
void * foo UNUSED)
{
callable_obj_t *c = calllist_get_call(current_calls_tab, callID);
if (c) {
process_existant_call_state_change(c, state);
} else {
WARN("DBUS: Call does not exist in %s", __func__);
process_inexistant_call_state_change(callID, state);
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment