Based on 24.008 section 10.5.4.7 enum called_number_type is to be used when phone number type is required. --- src/call-forwarding.c | 2 +- src/common.c | 8 ++++---- src/common.h | 10 ++++++++++ src/phonebook.c | 3 +-- 4 files changed, 16 insertions(+), 7 deletions(-)
diff --git a/src/call-forwarding.c b/src/call-forwarding.c index 512f223..b9e6633 100644 --- a/src/call-forwarding.c +++ b/src/call-forwarding.c @@ -791,7 +791,7 @@ static DBusMessage *cf_set_property(DBusConnection *conn, DBusMessage *msg, int timeout; ph.number[0] = '\0'; - ph.type = 129; + ph.type = CALLED_NUMBER_TYPE_UNKNOWN; if (dbus_message_iter_get_arg_type(&var) != DBUS_TYPE_STRING) return __ofono_error_invalid_args(msg); diff --git a/src/common.c b/src/common.c index 4d93488..44bc925 100644 --- a/src/common.c +++ b/src/common.c @@ -405,8 +405,8 @@ const char *phone_number_to_string(const struct ofono_phone_number *ph) { static char buffer[64]; - if (ph->type == 145 && (strlen(ph->number) > 0) && - ph->number[0] != '+') { + if (ph->type == CALLED_NUMBER_TYPE_INTERNATIONAL && + (strlen(ph->number) > 0) && ph->number[0] != '+') { buffer[0] = '+'; strncpy(buffer + 1, ph->number, 62); buffer[63] = '\0'; @@ -422,10 +422,10 @@ void string_to_phone_number(const char *str, struct ofono_phone_number *ph) { if (str[0] == '+') { strcpy(ph->number, str+1); - ph->type = 145; /* International */ + ph->type = CALLED_NUMBER_TYPE_INTERNATIONAL; } else { strcpy(ph->number, str); - ph->type = 129; /* Local */ + ph->type = CALLED_NUMBER_TYPE_UNKNOWN; } } diff --git a/src/common.h b/src/common.h index 5edff49..a019231 100644 --- a/src/common.h +++ b/src/common.h @@ -135,6 +135,16 @@ enum context_status { CONTEXT_STATUS_ACTIVATED = 1, }; +/* 24.008 Section 10.5.4.7 Called party BCD number */ +enum called_number_type { + CALLED_NUMBER_TYPE_UNKNOWN = 0, + CALLED_NUMBER_TYPE_INTERNATIONAL = 1, + CALLED_NUMBER_TYPE_NATIONAL = 2, + CALLED_NUMBER_TYPE_NETWORK_SPECIFIC = 3, + CALLED_NUMBER_TYPE_DEDICATED_ACCESS = 4, + CALLED_NUMBER_TYPE_RESERVED = 7 +}; + const char *telephony_error_to_str(const struct ofono_error *error); gboolean valid_phone_number_format(const char *number); diff --git a/src/phonebook.c b/src/phonebook.c index e388ac1..cf33e00 100644 --- a/src/phonebook.c +++ b/src/phonebook.c @@ -38,7 +38,6 @@ #include "common.h" #define LEN_MAX 128 -#define TYPE_INTERNATIONAL 145 #define PHONEBOOK_FLAG_CACHED 0x1 @@ -176,7 +175,7 @@ static void vcard_printf_number(GString *vcards, const char *number, int type, break; } - if ((type == TYPE_INTERNATIONAL) && (number[0] != '+')) + if ((type == CALLED_NUMBER_TYPE_INTERNATIONAL) && (number[0] != '+')) intl = "+"; snprintf(buf, sizeof(buf), "TEL;TYPE=\%s%s:\%s\%s", pref, -- 1.5.6.5 _______________________________________________ ofono mailing list ofono@ofono.org http://lists.ofono.org/listinfo/ofono