summaryrefslogtreecommitdiffstats
path: root/audio
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@nokia.com>2009-01-08 14:13:32 +0200
committerJohan Hedberg <johan.hedberg@nokia.com>2009-01-08 14:13:32 +0200
commit2e258fc221e00fe5ceb0f57646d578db829e3b75 (patch)
tree5278e4395f8d169c04b58a52bc99a6b4c4fc37fe /audio
parent8bbfdf782dd1633a1f78a26584ff81b858df4a61 (diff)
Fix AT+CHLD=2 behavior
Diffstat (limited to 'audio')
-rw-r--r--audio/telephony-maemo.c36
1 files changed, 34 insertions, 2 deletions
diff --git a/audio/telephony-maemo.c b/audio/telephony-maemo.c
index 42179523..64e0e409 100644
--- a/audio/telephony-maemo.c
+++ b/audio/telephony-maemo.c
@@ -391,6 +391,23 @@ static int hold_call(struct csd_call *call)
return 0;
}
+static int swap_calls(void)
+{
+ DBusMessage *msg;
+
+ msg = dbus_message_new_method_call(CSD_CALL_BUS_NAME, CSD_CALL_PATH,
+ CSD_CALL_INTERFACE,
+ "Swap");
+ if (!msg) {
+ error("Unable to allocate new D-Bus message");
+ return -ENOMEM;
+ }
+
+ g_dbus_send_message(connection, msg);
+
+ return 0;
+}
+
static int call_transfer(void)
{
DBusMessage *msg;
@@ -738,9 +755,24 @@ void telephony_call_hold_req(void *telephony_device, const char *cmd)
if (call)
err = split_call(call);
break;
+ } else {
+ struct csd_call *held, *wait;
+
+ call = find_call_with_status(CSD_CALL_STATUS_ACTIVE);
+ held = find_call_with_status(CSD_CALL_STATUS_HOLD);
+ wait = find_call_with_status(CSD_CALL_STATUS_WAITING);
+
+ if (call && (held || wait))
+ swap_calls();
+ else {
+ if (call)
+ hold_call(call);
+ if (held)
+ unhold_call(held);
+ if (wait)
+ answer_call(wait);
+ }
}
- foreach_call_with_status(CSD_CALL_STATUS_ACTIVE, hold_call);
- foreach_call_with_status(CSD_CALL_STATUS_HOLD, unhold_call);
break;
case '3':
call = find_call_with_status(CSD_CALL_STATUS_HOLD);