From f98e9a21932e566fcf388fd1ec74328e1ad620d8 Mon Sep 17 00:00:00 2001 From: Slava Monich Date: Mon, 23 Apr 2018 18:33:08 +0300 Subject: [PATCH] ussd: Don't ignore data from TERMINATED response Typically responses to USSD requests are coming with status zero (NOTIFY) but some are coming with status 2 (TERMINATED). If those contain data, the data should be presented to the user. [ussd] Don't ignore data from TERMINATED response. Fixes JB#41734 --- ofono/src/ussd.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/ofono/src/ussd.c b/ofono/src/ussd.c index 4ce65880..1732a621 100644 --- a/ofono/src/ussd.c +++ b/ofono/src/ussd.c @@ -417,13 +417,18 @@ void ofono_ussd_notify(struct ofono_ussd *ussd, int status, int dcs, } if (status == OFONO_USSD_STATUS_TERMINATED) { - ussd_change_state(ussd, USSD_STATE_IDLE); + if (ussd->state == USSD_STATE_ACTIVE && data && data_len > 0) { + /* Interpret that as a Notify */ + status = OFONO_USSD_STATUS_NOTIFY; + } else { + ussd_change_state(ussd, USSD_STATE_IDLE); - if (ussd->pending == NULL) - return; + if (ussd->pending == NULL) + return; - reply = __ofono_error_network_terminated(ussd->pending); - goto out; + reply = __ofono_error_network_terminated(ussd->pending); + goto out; + } } if (status == OFONO_USSD_STATUS_NOT_SUPPORTED) {