diff options
author | Luiz Augusto von Dentz <luiz.dentz-von@nokia.com> | 2011-01-05 17:59:38 +0200 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@nokia.com> | 2011-01-07 00:35:32 +0200 |
commit | 1097cfd46e906ddfd8a827ce683c1eddf2d98499 (patch) | |
tree | cc5c2a9648c8ffda7bee1f77f5cf716ce8b0546c | |
parent | 3fd5fa3890e3db3857f212ef6a187f7744d07cba (diff) | |
download | bluez-1097cfd46e906ddfd8a827ce683c1eddf2d98499.tar.gz |
telephony-ofono: notify alerting calls when headset connects
-rw-r--r-- | audio/telephony-ofono.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/audio/telephony-ofono.c b/audio/telephony-ofono.c index 00c3f6ed3..babf38f53 100644 --- a/audio/telephony-ofono.c +++ b/audio/telephony-ofono.c @@ -128,9 +128,32 @@ static struct voice_call *find_vc_with_status(int status) return NULL; } +static int number_type(const char *number) +{ + if (number == NULL) + return NUMBER_TYPE_TELEPHONY; + + if (number[0] == '+' || strncmp(number, "00", 2) == 0) + return NUMBER_TYPE_INTERNATIONAL; + + return NUMBER_TYPE_TELEPHONY; +} + void telephony_device_connected(void *telephony_device) { + struct voice_call *coming; + DBG("telephony-ofono: device %p connected", telephony_device); + + coming = find_vc_with_status(CALL_STATUS_ALERTING); + if (coming) { + if (find_vc_with_status(CALL_STATUS_ACTIVE)) + telephony_call_waiting_ind(coming->number, + number_type(coming->number)); + else + telephony_incoming_call_ind(coming->number, + number_type(coming->number)); + } } void telephony_device_disconnected(void *telephony_device) |