* [PATCH 0/2] Long dial string support @ 2010-11-16 17:39 Andras Domokos 2010-11-16 17:39 ` [RFC PATCH 1/2] common: add long " Andras Domokos 2010-11-16 17:39 ` [RFC PATCH 2/2] isimodem/voicecall: " Andras Domokos 0 siblings, 2 replies; 5+ messages in thread From: Andras Domokos @ 2010-11-16 17:39 UTC (permalink / raw) To: ofono [-- Attachment #1: Type: text/plain, Size: 888 bytes --] Dial strings can now be as long as 120 digits (not counting '+'). This feature is going to be needed by the FDN feature. An FDN may consist of a phone number plus a DTMF string. In order to have the call succeed when FDN is enabled, both parts need to be provided when making a call as a single dial string. For AT modems the long dial string can be and has to be passed as is to the modem, for ISI modems the dial string needs to be split into phone number (dest. address) and DTMF tone (post dest. address) before feeding it to the modem. Andras Domokos (2): common: add long dial string support isimodem/voicecall: add long dial string support drivers/isimodem/voicecall.c | 83 +++++++++++++++++++++++++++++++++--------- include/types.h | 2 +- src/common.c | 12 +++--- 3 files changed, 72 insertions(+), 25 deletions(-) ^ permalink raw reply [flat|nested] 5+ messages in thread
* [RFC PATCH 1/2] common: add long dial string support 2010-11-16 17:39 [PATCH 0/2] Long dial string support Andras Domokos @ 2010-11-16 17:39 ` Andras Domokos 2010-11-18 11:38 ` Arun Ravindran 2010-11-16 17:39 ` [RFC PATCH 2/2] isimodem/voicecall: " Andras Domokos 1 sibling, 1 reply; 5+ messages in thread From: Andras Domokos @ 2010-11-16 17:39 UTC (permalink / raw) To: ofono [-- Attachment #1: Type: text/plain, Size: 1568 bytes --] --- include/types.h | 2 +- src/common.c | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/types.h b/include/types.h index ba2481f..b3d2247 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 120 struct ofono_phone_number { char number[OFONO_MAX_PHONE_NUMBER_LENGTH + 1]; diff --git a/src/common.c b/src/common.c index b5b9a6f..de5a508 100644 --- a/src/common.c +++ b/src/common.c @@ -253,7 +253,7 @@ gboolean valid_phone_number_format(const char *number) if (number[i] >= '0' && number[i] <= '9') continue; - if (number[i] == '*' || number[i] == '#') + if (number[i] == '*' || number[i] == '#' || number[i] == 'p') continue; return FALSE; @@ -379,18 +379,18 @@ int mmi_service_code_to_bearer_class(int code) const char *phone_number_to_string(const struct ofono_phone_number *ph) { - static char buffer[64]; + static char buffer[(OFONO_MAX_PHONE_NUMBER_LENGTH + 1) + 1]; if (ph->type == 145 && (strlen(ph->number) > 0) && ph->number[0] != '+') { buffer[0] = '+'; - strncpy(buffer + 1, ph->number, 62); - buffer[63] = '\0'; + strncpy(buffer + 1, ph->number, sizeof(buffer) - 2); } else { - strncpy(buffer, ph->number, 63); - buffer[63] = '\0'; + strncpy(buffer, ph->number, sizeof(buffer) - 1); } + buffer[sizeof(buffer) - 1] = '\0'; + return buffer; } -- 1.7.0.4 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [RFC PATCH 1/2] common: add long dial string support 2010-11-16 17:39 ` [RFC PATCH 1/2] common: add long " Andras Domokos @ 2010-11-18 11:38 ` Arun Ravindran 2010-11-22 11:00 ` Denis Kenzior 0 siblings, 1 reply; 5+ messages in thread From: Arun Ravindran @ 2010-11-18 11:38 UTC (permalink / raw) To: ofono [-- Attachment #1: Type: text/plain, Size: 1185 bytes --] Hi Denis, Marcel, Andras, > include/types.h | 2 +- > src/common.c | 12 ++++++------ > 2 files changed, 7 insertions(+), 7 deletions(-) > > diff --git a/include/types.h b/include/types.h > index ba2481f..b3d2247 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 120 > > struct ofono_phone_number { > char number[OFONO_MAX_PHONE_NUMBER_LENGTH + 1]; > diff --git a/src/common.c b/src/common.c > index b5b9a6f..de5a508 100644 > --- a/src/common.c > +++ b/src/common.c > @@ -253,7 +253,7 @@ gboolean valid_phone_number_format(const char *number) > if (number[i]>= '0'&& number[i]<= '9') > continue; > > - if (number[i] == '*' || number[i] == '#') > + if (number[i] == '*' || number[i] == '#' || number[i] == 'p') > continue; > This function is used to check the phone number as valid in other places too. Is it right to allow sms sending to numbers with '*', '#' and 'p' in it? I think ofono should return an error for the sms case. Regards Arun ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [RFC PATCH 1/2] common: add long dial string support 2010-11-18 11:38 ` Arun Ravindran @ 2010-11-22 11:00 ` Denis Kenzior 0 siblings, 0 replies; 5+ messages in thread From: Denis Kenzior @ 2010-11-22 11:00 UTC (permalink / raw) To: ofono [-- Attachment #1: Type: text/plain, Size: 1487 bytes --] Hi Andras, On 11/18/2010 05:38 AM, Arun Ravindran wrote: > Hi Denis, Marcel, Andras, > >> include/types.h | 2 +- >> src/common.c | 12 ++++++------ >> 2 files changed, 7 insertions(+), 7 deletions(-) >> >> diff --git a/include/types.h b/include/types.h >> index ba2481f..b3d2247 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 120 >> >> struct ofono_phone_number { >> char number[OFONO_MAX_PHONE_NUMBER_LENGTH + 1]; >> diff --git a/src/common.c b/src/common.c >> index b5b9a6f..de5a508 100644 >> --- a/src/common.c >> +++ b/src/common.c >> @@ -253,7 +253,7 @@ gboolean valid_phone_number_format(const char >> *number) >> if (number[i]>= '0'&& number[i]<= '9') >> continue; >> >> - if (number[i] == '*' || number[i] == '#') >> + if (number[i] == '*' || number[i] == '#' || number[i] == 'p') >> continue; >> > This function is used to check the phone number as valid in other places > too. > > Is it right to allow sms sending to numbers with '*', '#' and 'p' in it? > I think ofono should return an error for the sms case. > Arun has nailed it, hacking valid_phone_number_format is not the right way to go. You need to separate this out a bit for the particular usecase. Regards, -Denis ^ permalink raw reply [flat|nested] 5+ messages in thread
* [RFC PATCH 2/2] isimodem/voicecall: add long dial string support 2010-11-16 17:39 [PATCH 0/2] Long dial string support Andras Domokos 2010-11-16 17:39 ` [RFC PATCH 1/2] common: add long " Andras Domokos @ 2010-11-16 17:39 ` Andras Domokos 1 sibling, 0 replies; 5+ messages in thread From: Andras Domokos @ 2010-11-16 17:39 UTC (permalink / raw) To: ofono [-- Attachment #1: Type: text/plain, Size: 4474 bytes --] --- drivers/isimodem/voicecall.c | 83 +++++++++++++++++++++++++++++++++--------- 1 files changed, 65 insertions(+), 18 deletions(-) diff --git a/drivers/isimodem/voicecall.c b/drivers/isimodem/voicecall.c index c3365f6..b0dad72 100644 --- a/drivers/isimodem/voicecall.c +++ b/drivers/isimodem/voicecall.c @@ -49,7 +49,7 @@ struct isi_call { uint8_t id, call_id, status, mode, mode_info, cause_type, cause; uint8_t addr_type, presentation; uint8_t reason; - char address[20], addr_pad[4]; + char address[OFONO_MAX_PHONE_NUMBER_LENGTH + 1], addr_pad[4]; }; struct isi_voicecall { @@ -244,6 +244,28 @@ static void isi_call_destination_address_sb_proc(struct isi_voicecall *ivc, isi_call_any_address_sb_proc(ivc, call, sb); } +static void isi_call_destination_post_address_sb_proc(struct isi_voicecall *ivc, + struct isi_call *call, + GIsiSubBlockIter const *sb) +{ + uint8_t addr_info, addr_len; + char *address; + + if (!call->address[0] || + strlen(call->address) >= OFONO_MAX_PHONE_NUMBER_LENGTH) + return; + + if (!g_isi_sb_iter_get_byte(sb, &addr_info, 2) || + !g_isi_sb_iter_get_byte(sb, &addr_len, 3) || + !g_isi_sb_iter_get_alpha_tag(sb, &address, 2 * addr_len, 4)) + return; + + strncat(call->address, address, + OFONO_MAX_PHONE_NUMBER_LENGTH - strlen(call->address)); + g_free(address); + +} + static void isi_call_mode_sb_proc(struct isi_voicecall *ivc, struct isi_call *call, GIsiSubBlockIter const *sb) @@ -371,40 +393,61 @@ static struct isi_call_req_context * isi_call_create_req(struct ofono_voicecall *ovc, uint8_t presentation, uint8_t addr_type, - char const address[21], + char const address[OFONO_MAX_PHONE_NUMBER_LENGTH + 1], ofono_voicecall_cb_t cb, void *data) { - size_t addr_len = strlen(address); - size_t sub_len = (6 + 2 * addr_len + 3) & ~3; - size_t i, offset = 3 + 4 + 8 + 6; - uint8_t req[3 + 4 + 8 + 6 + 40] = { + uint8_t req[3 + 4 + 8 + 10 + 2 * OFONO_MAX_PHONE_NUMBER_LENGTH + 4] = { CALL_CREATE_REQ, 0, /* No id */ - 3, /* Mode, Clir, Number */ + 4, /* Mode, Clir, Number, Postfix */ /* MODE SB */ CALL_MODE, 4, CALL_MODE_SPEECH, CALL_MODE_INFO_NONE, /* ORIGIN_INFO SB */ CALL_ORIGIN_INFO, 8, presentation, 0, 0, 0, 0, 0, /* DESTINATION_ADDRESS SB */ CALL_DESTINATION_ADDRESS, - sub_len, + 0, /* sub_len */ addr_type & 0x7F, 0, 0, - addr_len, - /* uint16_t addr[20] */ + 0, /* addr_len */ + /* uint16_t addr[OFONO_MAX_PHONE_NUMBER_LENGTH] */ }; - size_t rlen = 3 + 4 + 8 + sub_len; + size_t i, j, offset; - if (addr_len > 20) { - CALLBACK_WITH_FAILURE(cb, data); - return NULL; + offset = 3 + 4 + 8; + for (i = 0, j = 0; address[i]; i++, j++) { + if (i > OFONO_MAX_PHONE_NUMBER_LENGTH) + goto out; + if (address[i] != '*') + break; + req[offset + 6 + 2 * j + 1] = address[i]; } - for (i = 0; i < addr_len; i++) - req[offset + 2 * i + 1] = address[i]; + for (; address[i]; i++, j++) { + if (i > OFONO_MAX_PHONE_NUMBER_LENGTH) + goto out; + if (address[i] == '*' || address[i] == 'p' || address[i] == '#') + break; + req[offset + 6 + 2 * j + 1] = address[i]; + } + req[offset + 5] = j; + offset += (req[offset + 1] = (6 + 2 * j + 3) & ~3); + + req[offset + 0] = CALL_DESTINATION_POST_ADDRESS; + for (j = 0; address[i]; i++, j++) { + if (i > OFONO_MAX_PHONE_NUMBER_LENGTH) + goto out; + req[offset + 4 + 2 * j + 1] = address[i]; + } + req[offset + 3] = j; + offset += (req[offset + 1] = (4 + 2 * j + 3) & ~3); - return isi_call_req(ovc, req, rlen, isi_call_create_resp, cb, data); + return isi_call_req(ovc, req, offset, isi_call_create_resp, cb, data); + +out: + CALLBACK_WITH_FAILURE(cb, data); + return NULL; } static gboolean isi_call_create_resp(GIsiClient *client, @@ -477,13 +520,17 @@ static void isi_call_status_ind_cb(GIsiClient *client, isi_call_destination_address_sb_proc(ivc, call, sb); break; + case CALL_DESTINATION_POST_ADDRESS: + isi_call_destination_post_address_sb_proc(ivc, + call, sb); + break; + case CALL_ORIGIN_ADDRESS: isi_call_origin_address_sb_proc(ivc, call, sb); break; case CALL_GSM_DETAILED_CAUSE: case CALL_DESTINATION_PRE_ADDRESS: - case CALL_DESTINATION_POST_ADDRESS: case CALL_DESTINATION_SUBADDRESS: case CALL_GSM_EVENT_INFO: case CALL_NW_CAUSE: -- 1.7.0.4 ^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-11-22 11:00 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2010-11-16 17:39 [PATCH 0/2] Long dial string support Andras Domokos 2010-11-16 17:39 ` [RFC PATCH 1/2] common: add long " Andras Domokos 2010-11-18 11:38 ` Arun Ravindran 2010-11-22 11:00 ` Denis Kenzior 2010-11-16 17:39 ` [RFC PATCH 2/2] isimodem/voicecall: " Andras Domokos
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.