/** * D-Bus callback for the get call state method call * * @param msg The D-Bus message * @return TRUE on success, FALSE on failure */ static gboolean get_call_state_dbus_cb(DBusMessage *const msg) { gboolean status = FALSE; mce_log(LL_DEBUG, "Received call state get request"); /* Try to send a reply that contains the current call state and type */ if (send_call_state(msg, NULL, NULL) == FALSE) goto EXIT; status = TRUE; EXIT: return status; }
static switch_status_t skinny_api_cmd_profile_device_send_call_state_message(const char *profile_name, const char *device_name, const char *call_state, const char *line_instance, const char *call_id, switch_stream_handle_t *stream) { skinny_profile_t *profile; if ((profile = skinny_find_profile(profile_name))) { listener_t *listener = NULL; skinny_profile_find_listener_by_device_name(profile, device_name, &listener); if(listener) { send_call_state(listener, skinny_str2call_state(call_state), atoi(line_instance), atoi(call_id)); } else { stream->write_function(stream, "Listener not found!\n"); } } else { stream->write_function(stream, "Profile not found!\n"); } return SWITCH_STATUS_SUCCESS; }
/** Evaluate mce call state * * Emit signals and update data pipes as needed * * @return true if call state / type changed, false otherwise */ static bool call_state_rethink_now(void) { bool changed = false; static ofono_vcall_t previous = { .state = CALL_STATE_INVALID, .type = NORMAL_CALL, }; ofono_vcall_t combined = { .state = CALL_STATE_NONE, .type = NORMAL_CALL, }; /* consider simulated call state */ ofono_vcall_merge_vcall(&combined, &simulated); /* consider ofono modem emergency properties */ if( modems_lut ) g_hash_table_foreach(modems_lut, call_state_merge_modem_cb, &combined); /* consider ofono voice call properties */ if( vcalls_lut ) g_hash_table_foreach(vcalls_lut, call_state_merge_vcall_cb, &combined); /* skip broadcast if no change */ if( !memcmp(&previous, &combined, sizeof combined) ) goto EXIT; changed = true; previous = combined; call_state_t call_state = combined.state; call_type_t call_type = combined.type; const char *state_str = call_state_repr(call_state); const char *type_str = call_type_repr(call_type); mce_log(LL_DEBUG, "call_state=%s, call_type=%s", state_str, type_str); /* If the state changed, signal the new state; * first externally, then internally * * The reason we do it externally first is to * make sure that the camera application doesn't * grab audio, otherwise the ring tone might go missing */ // TODO: is the above legacy statement still valid? send_call_state(NULL, state_str, type_str); execute_datapipe(&call_state_pipe, GINT_TO_POINTER(call_state), USE_INDATA, CACHE_INDATA); execute_datapipe(&call_type_pipe, GINT_TO_POINTER(call_type), USE_INDATA, CACHE_INDATA); EXIT: return changed; }