From 2db2d39af8cba3883756d21a0634722f37bdfef0 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Wed, 8 Oct 2008 12:15:09 +0200 Subject: Reject non-voice calls in headset.c Basicly reverts the previous commit since data calls just don't make sense with HFP. Check for proper voice call dial string and pass the number without the terminating semicolon to the telephony driver. --- audio/headset.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'audio/headset.c') diff --git a/audio/headset.c b/audio/headset.c index 31955490..a4fe84fe 100644 --- a/audio/headset.c +++ b/audio/headset.c @@ -785,7 +785,20 @@ int telephony_dial_number_rsp(void *telephony_device, cme_error_t err) static int dial_number(struct audio_device *device, const char *buf) { - telephony_dial_number_req(device, &buf[3]); + char number[BUF_SIZE]; + size_t buf_len; + + buf_len = strlen(buf); + + if (buf[buf_len - 1] != ';') { + debug("Rejecting non-voice call dial request"); + return -EINVAL; + } + + memset(number, 0, sizeof(number)); + strncpy(number, &buf[3], buf_len - 4); + + telephony_dial_number_req(device, number); return 0; } -- cgit