WifiSMS
WifiSMS copied to clipboard
Duplicates because of country code
Israel's country code is +972 A local number would be (example) 052-1234567 but when called with country code, it would be 972-52-1234567, i.e the 0 will be removed (EVERY number starts with a 0 when called within the country, its like so the telecom company would know its not an international call)
The actual bug now is that (even after I set the correct country code in WifiSMS) it looks like its only taking 97 as the code and not 972, and i have the same number appear 3 times (its saved with a leading 0, wifisms removes it?) 52-1234567 2-52-1234567 972-52-1234567 (forget about the dashes, its only to make my point clear)
got that bug too,
All my number encoding are like this : +32 491 23 45 67
my prefix settings in the program are "+32" but in my left side bar, i got some duplication.
I'll got this : My contact (correct match) 491 23 45 67
For some contacts i got this : 32 491 23 45 67 032 491 23 45 67
It's probably because of the number in sms.db get different encoding. (Because before i get +32.... my contact was set by 0032, and some contact had been in 0494.... directly, etc etc)
So i think that the program need to handle all type of number, there's following : CC = Counter code (32 for belgium) 00 CC 123 45 67 89 +CC 123 45 67 89 0123 45 67 89 (no CC contact)
There's only these three possibility (i think it's the same for all countries).
So in the check for contact function, it need to verify the 3 possibility of string number.
I think we don't need to have a CC parameters, and try to handle number without this. Because some people can have different contact form different countries (for my i got french friends, and the CC is 33, but in my parameters it's 32, so it will be not handle the contact).
I think the function can get a number, then determine if there's a country code or not, then substring the number removing the CC, then we search on the contact if there's a match for the number.
Here is the algorythm : search_contact_by_num( string num ) { if(num.containCCbeginwithplus()) num =substring num and remove the "+ CC"; if(num.containCCbeginwithzerozero()) num = substring num and remove the "00 CC"; search_in_contact_db(num); }
of course the function "containCC" must be create, wich determine if "num" contain the CC, by searching in a table with all country code. This can help : http://berty.110mb.com/files/telephone_number_analyse.xls
Aren't country codes of different lengths ? Mine is 1 and yours is 33 so it wont work.
I currently remove any leading zero's and + signs, then strip leading CC (if it has one), then append the CC.
All my MSISDN are stored in international format, and I think it's really sensible thing to do in general. This application just screws my SMS database because it's not able to interpret the '+' char.
I think this is a major bug, and should be at least mentioned in the known issues at huge letters until it gets fixed ASAP.
I'm not sure why your program needs to distinguish between CC part and national numeration part, but it would be very simple to store in memory a map with the well known and finite list of world country codes.
This would be quick and easy and data is available from wikipedia. http://en.wikipedia.org/wiki/List_of_country_calling_codes
No need for regexp imo, just check for number.startsWith("+" + cc) || number.startsWith("00"+cc) and so forth.
Please comment
OK, this seems to be a showstopper for other country's than US. In my Adressbook all Numbers are in international format with e.g. "+491765024382"
Isn't it possible to push the Number "as it is" to the SMS app on the iPhone, without touching the Number it self?
e.g. I want to replay to a contact i have recieved an sms, for example the number is: +491724778332. The Numbern shown up on the webpanel is just: 1724778332 in the settings i have set up my country code, 49, so it should strap it correctly.
Then replying on the sms from mr. demo, the app sends an sms to 1724778332 instead of +491724778332. is there anything wrong in my configuration?