* [ussd-mmi PATCH 0/4] @ 2010-10-06 14:52 Pekka.Pessi 2010-10-06 14:52 ` [ussd-mmi PATCH 1/4] Fix valid_ussd_string() Pekka.Pessi 0 siblings, 1 reply; 9+ messages in thread From: Pekka.Pessi @ 2010-10-06 14:52 UTC (permalink / raw) To: ofono [-- Attachment #1: Type: text/plain, Size: 180 bytes --] Hi all, Here is a patch for MMI checking of USSD strings, now mentioning 22.030. At the same time I also took liberty to streamline the stk voicecall interface. --Pekka ^ permalink raw reply [flat|nested] 9+ messages in thread
* [ussd-mmi PATCH 1/4] Fix valid_ussd_string() 2010-10-06 14:52 [ussd-mmi PATCH 0/4] Pekka.Pessi @ 2010-10-06 14:52 ` Pekka.Pessi 2010-10-06 14:52 ` [ussd-mmi PATCH 2/4] Check stk requests in __ofono_voicecall_is_busy() Pekka.Pessi 2010-10-10 11:08 ` [ussd-mmi PATCH 1/4] Fix valid_ussd_string() Denis Kenzior 0 siblings, 2 replies; 9+ messages in thread From: Pekka.Pessi @ 2010-10-06 14:52 UTC (permalink / raw) To: ofono [-- Attachment #1: Type: text/plain, Size: 4603 bytes --] From: Pekka Pessi <Pekka.Pessi@nokia.com> The valid_ussd_string() returns now true if MMI input is to be sent as USSD. The comment about USSD routing is removed, it is out of scope of oFono. The cellular network routes the USSD requests based on the rules laid out in the 22.090, however, any string that can be encoded according to the rules of 23.038 is valid USSD. --- src/common.c | 44 +++++++++++++++++++------------------------- src/common.h | 2 +- src/ussd.c | 13 ++++++++++++- 3 files changed, 32 insertions(+), 27 deletions(-) diff --git a/src/common.c b/src/common.c index 55c4b40..13acd53 100644 --- a/src/common.c +++ b/src/common.c @@ -393,7 +393,7 @@ void string_to_phone_number(const char *str, struct ofono_phone_number *ph) } } -int valid_ussd_string(const char *str) +gboolean valid_ussd_string(const char *str, gboolean call_in_progress) { int len = strlen(str); @@ -401,37 +401,31 @@ int valid_ussd_string(const char *str) return FALSE; /* - * It is hard to understand exactly what constitutes a valid USSD string - * According to 22.090: - * Case a - 1, 2 or 3 digits from the set (*, #) followed by 1X(Y), - * where X=any number 0���4, Y=any number 0���9, then, optionally "* - * followed by any number of any characters", and concluding with #SEND + * Return true if an MMI input string is to be sent as USSD. * - * Case b - 1, 2 or 3 digits from the set (*, #) followed by 1X(Y), - * where X=any number 5���9, Y=any number 0���9, then, optionally "* - * followed by any number of any characters", and concluding with #SEND + * According to 3GPP TS 22.030, after checking the well-known + * supplementary service control, SIM control and manufacturer + * defined control codes, the terminal should check if the input + * should be sent as USSD according to the following rules: * - * Case c - 7(Y) SEND, where Y=any number 0���9 + * 1) Terminated by '#' + * 2) A short string of 1 or 2 digits * - * Case d - All other formats - * - * According to 22.030 Figure 3.5.3.2 USSD strings can be: - * - * Supplementary service control - * SIM control - * Manufacturer defined - * Terminated by '#' - * Short String - This can be any 2 digit short string. If the string - * starts with a '1' and no calls are in progress then - * this string is treated as a call setup request - * - * Everything else is not a valid USSD string + * As an exception, if a 2 digit string starts with a '1' and + * there are no calls in progress then this string is treated as + * a call setup request instead. */ - if (len != 2 && str[len-1] != '#') + if (str[len-1] == '#') + return TRUE; + + if (!call_in_progress && len == 2 && str[0] != '1') return FALSE; - return TRUE; + if (len <= 2) + return TRUE; + + return FALSE; } const char *ss_control_type_to_string(enum ss_control_type type) diff --git a/src/common.h b/src/common.h index c43e46d..8b5798a 100644 --- a/src/common.h +++ b/src/common.h @@ -130,7 +130,7 @@ void string_to_phone_number(const char *str, struct ofono_phone_number *ph); int mmi_service_code_to_bearer_class(int code); -gboolean valid_ussd_string(const char *str); +gboolean valid_ussd_string(const char *str, gboolean call_in_progress); gboolean parse_ss_control_string(char *str, int *ss_type, char **sc, char **sia, diff --git a/src/ussd.c b/src/ussd.c index aad7d32..90df632 100644 --- a/src/ussd.c +++ b/src/ussd.c @@ -545,6 +545,9 @@ static DBusMessage *ussd_initiate(DBusConnection *conn, DBusMessage *msg, void *data) { struct ofono_ussd *ussd = data; + struct ofono_modem *modem = __ofono_atom_get_modem(ussd->atom); + struct ofono_atom *vca; + gboolean call_in_progress; const char *str; int dcs = 0x0f; unsigned char buf[160]; @@ -564,8 +567,16 @@ static DBusMessage *ussd_initiate(DBusConnection *conn, DBusMessage *msg, if (recognized_control_string(ussd, str, msg)) return NULL; + vca = __ofono_modem_find_atom(modem, OFONO_ATOM_TYPE_VOICECALL); + if (vca) + call_in_progress = __ofono_voicecall_is_busy( + __ofono_atom_get_data(vca), + OFONO_VOICECALL_INTERACTION_NONE); + else + call_in_progress = FALSE; + DBG("No.., checking if this is a USSD string"); - if (!valid_ussd_string(str)) + if (!valid_ussd_string(str, call_in_progress)) return __ofono_error_invalid_format(msg); if (!ussd_encode(str, &num_packed, buf)) -- 1.7.0.4 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* [ussd-mmi PATCH 2/4] Check stk requests in __ofono_voicecall_is_busy() 2010-10-06 14:52 ` [ussd-mmi PATCH 1/4] Fix valid_ussd_string() Pekka.Pessi @ 2010-10-06 14:52 ` Pekka.Pessi 2010-10-06 14:52 ` [ussd-mmi PATCH 3/4] voicecall: remove dial_request_finish() cb param Pekka.Pessi 2010-10-10 11:08 ` [ussd-mmi PATCH 2/4] Check stk requests in __ofono_voicecall_is_busy() Denis Kenzior 2010-10-10 11:08 ` [ussd-mmi PATCH 1/4] Fix valid_ussd_string() Denis Kenzior 1 sibling, 2 replies; 9+ messages in thread From: Pekka.Pessi @ 2010-10-06 14:52 UTC (permalink / raw) To: ofono [-- Attachment #1: Type: text/plain, Size: 1282 bytes --] From: Pekka Pessi <Pekka.Pessi@nokia.com> Return true if a call is being dialed by stk. Use __ofono_voicecall_is_busy() in __ofono_voicecall_dial(). --- src/voicecall.c | 9 ++------- 1 files changed, 2 insertions(+), 7 deletions(-) diff --git a/src/voicecall.c b/src/voicecall.c index 2833e64..e072be8 100644 --- a/src/voicecall.c +++ b/src/voicecall.c @@ -2171,7 +2171,7 @@ int ofono_voicecall_get_next_callid(struct ofono_voicecall *vc) ofono_bool_t __ofono_voicecall_is_busy(struct ofono_voicecall *vc, enum ofono_voicecall_interaction type) { - if (vc->pending) + if (vc->pending || vc->dial_req) return TRUE; switch (type) { @@ -2272,7 +2272,7 @@ int __ofono_voicecall_dial(struct ofono_voicecall *vc, vc->driver->release_all_active == NULL) return -ENOSYS; - if (vc->dial_req || vc->pending) + if (__ofono_voicecall_is_busy(vc, interaction) == TRUE) return -EBUSY; /* @@ -2293,11 +2293,6 @@ int __ofono_voicecall_dial(struct ofono_voicecall *vc, vc->dial_req = req; - if (__ofono_voicecall_is_busy(vc, interaction) == TRUE) { - dial_request_finish(vc, FALSE); - return -EBUSY; - } - switch (interaction) { case OFONO_VOICECALL_INTERACTION_NONE: dial_request(vc); -- 1.7.0.4 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* [ussd-mmi PATCH 3/4] voicecall: remove dial_request_finish() cb param 2010-10-06 14:52 ` [ussd-mmi PATCH 2/4] Check stk requests in __ofono_voicecall_is_busy() Pekka.Pessi @ 2010-10-06 14:52 ` Pekka.Pessi 2010-10-06 14:52 ` [ussd-mmi PATCH 4/4] voicecall: check g_try_new0 return value Pekka.Pessi 2010-10-10 11:09 ` [ussd-mmi PATCH 3/4] voicecall: remove dial_request_finish() cb param Denis Kenzior 2010-10-10 11:08 ` [ussd-mmi PATCH 2/4] Check stk requests in __ofono_voicecall_is_busy() Denis Kenzior 1 sibling, 2 replies; 9+ messages in thread From: Pekka.Pessi @ 2010-10-06 14:52 UTC (permalink / raw) To: ofono [-- Attachment #1: Type: text/plain, Size: 2658 bytes --] From: Pekka Pessi <Pekka.Pessi@nokia.com> There is no need for callback param anymore. --- src/voicecall.c | 18 +++++++++--------- 1 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/voicecall.c b/src/voicecall.c index e072be8..8be7487 100644 --- a/src/voicecall.c +++ b/src/voicecall.c @@ -213,11 +213,11 @@ static unsigned int voicecalls_num_connecting(struct ofono_voicecall *vc) return r; } -static void dial_request_finish(struct ofono_voicecall *vc, gboolean callback) +static void dial_request_finish(struct ofono_voicecall *vc) { struct dial_request *dial_req = vc->dial_req; - if (callback && dial_req->cb) + if (dial_req->cb) dial_req->cb(dial_req->call ? dial_req->call->call : NULL, dial_req->user_data); @@ -338,7 +338,7 @@ static void dial_request_user_cancel(struct ofono_voicecall *vc, return; if (!call || call == vc->dial_req->call) - dial_request_finish(vc, TRUE); + dial_request_finish(vc); } static DBusMessage *voicecall_hangup(DBusConnection *conn, @@ -577,12 +577,12 @@ static void voicecall_set_call_status(struct voicecall *call, int status) ×tr); if (call->vc->dial_req && call == call->vc->dial_req->call) - dial_request_finish(call->vc, TRUE); + dial_request_finish(call->vc); } if (status == CALL_STATUS_DISCONNECTED && call->vc->dial_req && call == call->vc->dial_req->call) - dial_request_finish(call->vc, TRUE); + dial_request_finish(call->vc); } static void voicecall_set_call_lineid(struct voicecall *v, @@ -1970,7 +1970,7 @@ static void voicecall_unregister(struct ofono_atom *atom) } if (vc->dial_req) - dial_request_finish(vc, TRUE); + dial_request_finish(vc); for (l = vc->call_list; l; l = l->next) voicecall_dbus_unregister(vc, l->data); @@ -2207,7 +2207,7 @@ static void dial_request_cb(const struct ofono_error *error, void *data) &need_to_emit); if (v == NULL) { - dial_request_finish(vc, TRUE); + dial_request_finish(vc); return; } @@ -2225,7 +2225,7 @@ static void dial_request_cb(const struct ofono_error *error, void *data) v->untracked = TRUE; if (v->call->status == CALL_STATUS_ACTIVE) - dial_request_finish(vc, TRUE); + dial_request_finish(vc); if (need_to_emit) voicecalls_emit_call_added(vc, v); @@ -2242,7 +2242,7 @@ static void dial_req_disconnect_cb(const struct ofono_error *error, void *data) struct ofono_voicecall *vc = data; if (error->type != OFONO_ERROR_TYPE_NO_ERROR) { - dial_request_finish(vc, TRUE); + dial_request_finish(vc); return; } -- 1.7.0.4 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* [ussd-mmi PATCH 4/4] voicecall: check g_try_new0 return value 2010-10-06 14:52 ` [ussd-mmi PATCH 3/4] voicecall: remove dial_request_finish() cb param Pekka.Pessi @ 2010-10-06 14:52 ` Pekka.Pessi 2010-10-10 11:09 ` Denis Kenzior 2010-10-10 11:09 ` [ussd-mmi PATCH 3/4] voicecall: remove dial_request_finish() cb param Denis Kenzior 1 sibling, 1 reply; 9+ messages in thread From: Pekka.Pessi @ 2010-10-06 14:52 UTC (permalink / raw) To: ofono [-- Attachment #1: Type: text/plain, Size: 548 bytes --] From: Pekka Pessi <Pekka.Pessi@nokia.com> --- src/voicecall.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/src/voicecall.c b/src/voicecall.c index 8be7487..7b5fe3b 100644 --- a/src/voicecall.c +++ b/src/voicecall.c @@ -2281,6 +2281,9 @@ int __ofono_voicecall_dial(struct ofono_voicecall *vc, */ req = g_try_new0(struct dial_request, 1); + if (req == NULL) + return -ENOMEM; + req->message = g_strdup(message); req->icon_id = icon_id; req->interaction = interaction; -- 1.7.0.4 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [ussd-mmi PATCH 4/4] voicecall: check g_try_new0 return value 2010-10-06 14:52 ` [ussd-mmi PATCH 4/4] voicecall: check g_try_new0 return value Pekka.Pessi @ 2010-10-10 11:09 ` Denis Kenzior 0 siblings, 0 replies; 9+ messages in thread From: Denis Kenzior @ 2010-10-10 11:09 UTC (permalink / raw) To: ofono [-- Attachment #1: Type: text/plain, Size: 268 bytes --] Hi Pekka, On 10/06/2010 09:52 AM, Pekka.Pessi(a)nokia.com wrote: > From: Pekka Pessi <Pekka.Pessi@nokia.com> > > --- > src/voicecall.c | 3 +++ > 1 files changed, 3 insertions(+), 0 deletions(-) > Patch has been applied, thanks. Regards, -Denis ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [ussd-mmi PATCH 3/4] voicecall: remove dial_request_finish() cb param 2010-10-06 14:52 ` [ussd-mmi PATCH 3/4] voicecall: remove dial_request_finish() cb param Pekka.Pessi 2010-10-06 14:52 ` [ussd-mmi PATCH 4/4] voicecall: check g_try_new0 return value Pekka.Pessi @ 2010-10-10 11:09 ` Denis Kenzior 1 sibling, 0 replies; 9+ messages in thread From: Denis Kenzior @ 2010-10-10 11:09 UTC (permalink / raw) To: ofono [-- Attachment #1: Type: text/plain, Size: 331 bytes --] Hi Pekka, On 10/06/2010 09:52 AM, Pekka.Pessi(a)nokia.com wrote: > From: Pekka Pessi <Pekka.Pessi@nokia.com> > > There is no need for callback param anymore. > --- > src/voicecall.c | 18 +++++++++--------- > 1 files changed, 9 insertions(+), 9 deletions(-) > Patch has been applied, thanks. Regards, -Denis ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [ussd-mmi PATCH 2/4] Check stk requests in __ofono_voicecall_is_busy() 2010-10-06 14:52 ` [ussd-mmi PATCH 2/4] Check stk requests in __ofono_voicecall_is_busy() Pekka.Pessi 2010-10-06 14:52 ` [ussd-mmi PATCH 3/4] voicecall: remove dial_request_finish() cb param Pekka.Pessi @ 2010-10-10 11:08 ` Denis Kenzior 1 sibling, 0 replies; 9+ messages in thread From: Denis Kenzior @ 2010-10-10 11:08 UTC (permalink / raw) To: ofono [-- Attachment #1: Type: text/plain, Size: 387 bytes --] Hi Pekka, On 10/06/2010 09:52 AM, Pekka.Pessi(a)nokia.com wrote: > From: Pekka Pessi <Pekka.Pessi@nokia.com> > > Return true if a call is being dialed by stk. > > Use __ofono_voicecall_is_busy() in __ofono_voicecall_dial(). > --- > src/voicecall.c | 9 ++------- > 1 files changed, 2 insertions(+), 7 deletions(-) Patch has been applied, thanks. Regards, -Denis ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [ussd-mmi PATCH 1/4] Fix valid_ussd_string() 2010-10-06 14:52 ` [ussd-mmi PATCH 1/4] Fix valid_ussd_string() Pekka.Pessi 2010-10-06 14:52 ` [ussd-mmi PATCH 2/4] Check stk requests in __ofono_voicecall_is_busy() Pekka.Pessi @ 2010-10-10 11:08 ` Denis Kenzior 1 sibling, 0 replies; 9+ messages in thread From: Denis Kenzior @ 2010-10-10 11:08 UTC (permalink / raw) To: ofono [-- Attachment #1: Type: text/plain, Size: 871 bytes --] Hi Pekka, On 10/06/2010 09:52 AM, Pekka.Pessi(a)nokia.com wrote: > From: Pekka Pessi <Pekka.Pessi@nokia.com> > > The valid_ussd_string() returns now true if MMI input is to be sent as > USSD. > > The comment about USSD routing is removed, it is out of scope of oFono. > The cellular network routes the USSD requests based on the rules laid > out in the 22.090, however, any string that can be encoded according to > the rules of 23.038 is valid USSD. > --- > src/common.c | 44 +++++++++++++++++++------------------------- > src/common.h | 2 +- > src/ussd.c | 13 ++++++++++++- > 3 files changed, 32 insertions(+), 27 deletions(-) > Somehow this patch got mangled, so I had to be creative when trying to apply it. I broke it up into two patches and fixed up the style slightly. Patch has been applied, thanks. Regards, -Denis ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2010-10-10 11:09 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2010-10-06 14:52 [ussd-mmi PATCH 0/4] Pekka.Pessi 2010-10-06 14:52 ` [ussd-mmi PATCH 1/4] Fix valid_ussd_string() Pekka.Pessi 2010-10-06 14:52 ` [ussd-mmi PATCH 2/4] Check stk requests in __ofono_voicecall_is_busy() Pekka.Pessi 2010-10-06 14:52 ` [ussd-mmi PATCH 3/4] voicecall: remove dial_request_finish() cb param Pekka.Pessi 2010-10-06 14:52 ` [ussd-mmi PATCH 4/4] voicecall: check g_try_new0 return value Pekka.Pessi 2010-10-10 11:09 ` Denis Kenzior 2010-10-10 11:09 ` [ussd-mmi PATCH 3/4] voicecall: remove dial_request_finish() cb param Denis Kenzior 2010-10-10 11:08 ` [ussd-mmi PATCH 2/4] Check stk requests in __ofono_voicecall_is_busy() Denis Kenzior 2010-10-10 11:08 ` [ussd-mmi PATCH 1/4] Fix valid_ussd_string() Denis Kenzior
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.