* [PATCH 0/2] Long phone numbers
@ 2011-01-25 14:02 Rafael Ignacio Zurita
2011-01-25 14:02 ` [PATCH 1/2] types: extend OFONO_MAX_PHONE_NUMBER_LENGTH Rafael Ignacio Zurita
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Rafael Ignacio Zurita @ 2011-01-25 14:02 UTC (permalink / raw)
To: ofono
[-- Attachment #1: Type: text/plain, Size: 532 bytes --]
This set of patches extends OFONO_MAX_PHONE_NUMBER_LENGTH, splits
common:valid_phone_number_format(), and adapts voicecall to valid
the 80 character limit for outgoing calls.
Rafael Ignacio Zurita (2):
types: change OFONO_MAX_PHONE_NUMBER_LENGTH value to 80
common: split valid_phone_number_format and adapt voicecall
include/types.h | 2 +-
src/common.c | 20 ++++++++++++++++++--
src/common.h | 2 ++
src/voicecall.c | 2 +-
4 files changed, 22 insertions(+), 4 deletions(-)
--
1.7.2.3
^ permalink raw reply [flat|nested] 4+ messages in thread* [PATCH 1/2] types: extend OFONO_MAX_PHONE_NUMBER_LENGTH 2011-01-25 14:02 [PATCH 0/2] Long phone numbers Rafael Ignacio Zurita @ 2011-01-25 14:02 ` Rafael Ignacio Zurita 2011-01-25 14:02 ` [PATCH 2/2] common: add function to validate long numbers Rafael Ignacio Zurita 2011-01-25 20:13 ` [PATCH 0/2] Long phone numbers Denis Kenzior 2 siblings, 0 replies; 4+ messages in thread From: Rafael Ignacio Zurita @ 2011-01-25 14:02 UTC (permalink / raw) To: ofono [-- Attachment #1: Type: text/plain, Size: 450 bytes --] --- include/types.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/include/types.h b/include/types.h index 7963e0f..71d0988 100644 --- a/include/types.h +++ b/include/types.h @@ -76,7 +76,7 @@ struct ofono_error { int error; }; -#define OFONO_MAX_PHONE_NUMBER_LENGTH 20 +#define OFONO_MAX_PHONE_NUMBER_LENGTH 80 #define OFONO_MAX_CALLER_NAME_LENGTH 80 struct ofono_phone_number { -- 1.7.2.3 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] common: add function to validate long numbers 2011-01-25 14:02 [PATCH 0/2] Long phone numbers Rafael Ignacio Zurita 2011-01-25 14:02 ` [PATCH 1/2] types: extend OFONO_MAX_PHONE_NUMBER_LENGTH Rafael Ignacio Zurita @ 2011-01-25 14:02 ` Rafael Ignacio Zurita 2011-01-25 20:13 ` [PATCH 0/2] Long phone numbers Denis Kenzior 2 siblings, 0 replies; 4+ messages in thread From: Rafael Ignacio Zurita @ 2011-01-25 14:02 UTC (permalink / raw) To: ofono [-- Attachment #1: Type: text/plain, Size: 2616 bytes --] Also, adapt voicecall to use the new function for outgoing calls. --- src/common.c | 20 ++++++++++++++++++-- src/common.h | 2 ++ src/voicecall.c | 2 +- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/src/common.c b/src/common.c index 4d93488..8bf9dbb 100644 --- a/src/common.c +++ b/src/common.c @@ -234,7 +234,7 @@ struct error_entry ceer_errors[] = { { 127, "Interworking, unspecified" }, }; -gboolean valid_phone_number_format(const char *number) +gboolean valid_number_format(const char *number, int length) { int len = strlen(number); int begin = 0; @@ -246,7 +246,7 @@ gboolean valid_phone_number_format(const char *number) if (number[0] == '+') begin = 1; - if ((len - begin) > OFONO_MAX_PHONE_NUMBER_LENGTH) + if ((len - begin) > length) return FALSE; for (i = begin; i < len; i++) { @@ -262,6 +262,22 @@ gboolean valid_phone_number_format(const char *number) return TRUE; } +/* + * According to 3GPP TS 24.011 or 3GPP TS 31.102, some + * addresses (or numbers), like Service Centre address, + * Destination address, or EFADN (Abbreviated dialling numbers), + * are up 20 digits. + */ +gboolean valid_phone_number_format(const char *number) +{ + return valid_number_format(number, 20); +} + +gboolean valid_long_phone_number_format(const char *number) +{ + return valid_number_format(number, OFONO_MAX_PHONE_NUMBER_LENGTH); +} + gboolean valid_cdma_phone_number_format(const char *number) { int len = strlen(number); diff --git a/src/common.h b/src/common.h index 5edff49..09f2deb 100644 --- a/src/common.h +++ b/src/common.h @@ -137,7 +137,9 @@ enum context_status { const char *telephony_error_to_str(const struct ofono_error *error); +gboolean valid_number_format(const char *number, int length); gboolean valid_phone_number_format(const char *number); +gboolean valid_long_phone_number_format(const char *number); const char *phone_number_to_string(const struct ofono_phone_number *ph); void string_to_phone_number(const char *str, struct ofono_phone_number *ph); diff --git a/src/voicecall.c b/src/voicecall.c index 7e2b3f0..e6bfe04 100644 --- a/src/voicecall.c +++ b/src/voicecall.c @@ -1304,7 +1304,7 @@ static DBusMessage *manager_dial(DBusConnection *conn, DBUS_TYPE_INVALID) == FALSE) return __ofono_error_invalid_args(msg); - if (!valid_phone_number_format(number)) + if (!valid_long_phone_number_format(number)) return __ofono_error_invalid_format(msg); if (clir_string_to_clir(clirstr, &clir) == FALSE) -- 1.7.2.3 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 0/2] Long phone numbers 2011-01-25 14:02 [PATCH 0/2] Long phone numbers Rafael Ignacio Zurita 2011-01-25 14:02 ` [PATCH 1/2] types: extend OFONO_MAX_PHONE_NUMBER_LENGTH Rafael Ignacio Zurita 2011-01-25 14:02 ` [PATCH 2/2] common: add function to validate long numbers Rafael Ignacio Zurita @ 2011-01-25 20:13 ` Denis Kenzior 2 siblings, 0 replies; 4+ messages in thread From: Denis Kenzior @ 2011-01-25 20:13 UTC (permalink / raw) To: ofono [-- Attachment #1: Type: text/plain, Size: 675 bytes --] Hi Rafael, On 01/25/2011 08:02 AM, Rafael Ignacio Zurita wrote: > This set of patches extends OFONO_MAX_PHONE_NUMBER_LENGTH, splits > common:valid_phone_number_format(), and adapts voicecall to valid > the 80 character limit for outgoing calls. > > Rafael Ignacio Zurita (2): > types: change OFONO_MAX_PHONE_NUMBER_LENGTH value to 80 > common: split valid_phone_number_format and adapt voicecall > > include/types.h | 2 +- > src/common.c | 20 ++++++++++++++++++-- > src/common.h | 2 ++ > src/voicecall.c | 2 +- > 4 files changed, 22 insertions(+), 4 deletions(-) > Both patches have been applied, thanks. Regards, -Denis ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-01-25 20:13 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2011-01-25 14:02 [PATCH 0/2] Long phone numbers Rafael Ignacio Zurita 2011-01-25 14:02 ` [PATCH 1/2] types: extend OFONO_MAX_PHONE_NUMBER_LENGTH Rafael Ignacio Zurita 2011-01-25 14:02 ` [PATCH 2/2] common: add function to validate long numbers Rafael Ignacio Zurita 2011-01-25 20:13 ` [PATCH 0/2] Long phone numbers Denis Kenzior
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox