json_t *event_queue = NULL;
+char *voicecallmanager_path = NULL;
+
#define MAX_POLL_ELEMENTS 100
struct pollfd pollfds[100];
int count_pollfds = 0;
return 0;
}
+void
+dial_reply(void *data, DBusMessage *reply, DBusError *error)
+{
+ if (dbus_error_is_set(error)) {
+ fprintf(stderr, "Error: %s - %s\n", error->name, error->message);
+ return;
+ }
+}
+
+
/* libwebsocket callback for 'protocol-app-list' based websockets */
static int
callback_dialer(struct libwebsocket_context *context,
*/
case LWS_CALLBACK_ESTABLISHED:
if (in) {
- printf("About to broadcast:\n%s\n", (char *) in);
unsigned char *b = malloc(LWS_SEND_BUFFER_PRE_PADDING +
strlen((char *)in) +
LWS_SEND_BUFFER_POST_PADDING);
return;
ecore_exe_run(json_string_value(exec), NULL);
+ } else if (strncmp(cmd, "makeCall", 8) == 0 &&
+ (tmp = json_object_get(o, "remotePartyId"))) {
+ const char *remotePartyId = json_string_value(tmp);
+ const char *hideCallerId = "";
+
+ DBusMessage *msg;
+ msg = dbus_message_new_method_call(
+ "org.ofono",
+ voicecallmanager_path,
+ "org.ofono.VoiceCallManager",
+ "Dial"
+ );
+ dbus_message_append_args(msg,
+ DBUS_TYPE_STRING, &remotePartyId,
+ DBUS_TYPE_INVALID);
+ dbus_message_append_args(msg,
+ DBUS_TYPE_STRING, &hideCallerId,
+ DBUS_TYPE_INVALID);
+ e_dbus_message_send(bus, msg, dial_reply, -1, NULL);
+ } else if (strncmp(cmd, "end", 3) == 0) {
+ DBusMessage *msg;
+ msg = dbus_message_new_method_call(
+ "org.ofono",
+ voicecallmanager_path,
+ "org.ofono.VoiceCallManager",
+ "HangupAll"
+ );
+ e_dbus_message_send(bus, msg, dial_reply, -1, NULL);
+
}
}
dbus_message_iter_get_basic(&value, &v);
- printf("Call changed: %s=%s\n", property, v);
-
object = json_object();
json_object_set(object, property, json_string(v));
dump = json_dumps(object, 0);
dbus_message_iter_next(&iter);
dbus_message_iter_recurse(&iter, &properties);
- printf("%s :", path);
while (dbus_message_iter_get_arg_type(&properties) == DBUS_TYPE_DICT_ENTRY) {
DBusMessageIter entry, value;
const char *key, *v;
dbus_message_iter_get_basic(&value, &v);
- printf(" %s=%s ", key, v);
json_object_set(object, key, json_string(v));
dbus_message_iter_next(&properties);
}
- printf("\n");
e_dbus_signal_handler_add(bus,
"org.ofono",
{
DBusMessageIter iter, entry;
if (dbus_error_is_set(error)) {
- printf("Error: %s - %s\n", error->name, error->message);
+ fprintf(stderr, "Error: %s - %s\n", error->name, error->message);
return;
}
dbus_message_iter_get_basic(&interfaces, &iface);
if (!strcasecmp(iface, "org.ofono.VoiceCallManager")) {
- printf("Listening for calls on %s\n", path);
+ if (voicecallmanager_path)
+ free(voicecallmanager_path);
+ voicecallmanager_path = strdup(path);
+
e_dbus_signal_handler_add(bus, "org.ofono",
path, iface, "CallAdded",
call_added_cb, NULL);