PINE64
Importing vcf, country prefix problem workaround - Printable Version

+- PINE64 (https://forum.pine64.org)
+-- Forum: PinePhone (https://forum.pine64.org/forumdisplay.php?fid=120)
+--- Forum: General Discussion on PinePhone (https://forum.pine64.org/forumdisplay.php?fid=127)
+--- Thread: Importing vcf, country prefix problem workaround (/showthread.php?tid=12265)



Importing vcf, country prefix problem workaround - p1trson - 11-22-2020

Hello folks, finally I have started to test the PP with my separate SIM card I've bought just for PP. To test the calls etc. I have firstly wanted to import my contacts from daily driver phone (iPhone in this case). I've used 3rd party app in iPhone to export all my contacts to .vcf format which I then did send to my email. Using Geary I did save the .vcf to my pinephone.

I have then followed https://wiki.mobian-project.org/doku.php?id=tweaks&s[]=contacts to import the contacts via Evolution. There the problem started.

All the contacts have been imported successfully, but calling them via Contacts didn't work. Why? For some reason every contact I don't have saved with prefix (format +<country specific prefix>) in tel. number (it's not like that in my iPhone either btw so it's not import problem) was called with prefix+10 using Contacts app. If you would ask why don't I have all the contacts saved with prefix for phone number, it's because sometimes I was lazy, and when calling Slovak mobile phones in Slovakia I don't have to use any prefix.

To explain in better, example:
- contact imported via vcf, phone number imported: 0910 123 456 (this is a standard Slovak mobile phone number). Displayed as 0910 123 456  in Contacts as well, everything looks good.
- calling the above number via Contacts results into calling: +10 910 123 456 which obviously fails (Slovakia has +421 prefix) instead of calling either 0910 123 456 or +421 910 123 456
- interestingly Contacts is at least clever enough not to ad a prefix for numbers which already have it

I couldn't find any setting in Contacts to change it, to stop adding prefix on its own, so I had to come up with my own workaround I wanted to share ^^. This is applicable for contacts imported via Evolution (vcf) tested on Phosh pmOS and Mobian.

1) take a backup of your vcf
2) check whether you need to modify anything in vcf:

Code:
pitrpp:~/Documents$ egrep "^TEL;|^item" MyContacts-2020-11-21-133432-124.vcf | grep -v "+" | egrep "CELL|TEL|HOME"
item1.TEL;CHARSET=UTF-8:0911 11 1111
TEL;CHARSET=UTF-8;TYPE=CELL:0922 222 222
...



2) modify your vcf as desired
Code:
pitrpp:~/Documents$ sed -i 's/:09/:+421 9/g' MyContacts-2020-11-21-133432-124.vcf

-> in this case when checking the vcf structure I have discovered that it's enough to change every entry <:09> to <:+421 9> (again Slovakia specific so adjust to your country code) 
-> this is an in place edit with sed, if you want just to test and see omit the -i option
-> be sure that with the expression you choose, you don't change anything else unintentionally (but only the phone numbers)

OPTIONAL
-> if you have already imported the vcf with phone numbers without prefix do the following BEFORE you import the "corrected" vcf:
1) take the backup of current contact database:
Code:
cp /home/<user>/.local/share/evolution/addressbook/system/contacts.db /home/<user>/Documents/

2) delete the contact database
Code:
rm /home/<user>/.local/share/evolution/addressbook/system/contacts.db

3) reboot the phone
4) import the corrected vcf using e.g https://wiki.mobian-project.org/doku.php?id=tweaks&s[]=contacts

Let me know if you have any questions or you know how to prevent Contacts from adding "+10" prefix automatically on its own.



RE: Importing vcf, country prefix problem workaround - kqlnut - 11-23-2020

Thanks for that workaround. Hopefully this soon won't be an issue anymore since there is already a merge request to remove automatically adding that prefix: https://source.puri.sm/Librem5/calls/-/merge_requests/188


RE: Importing vcf, country prefix problem workaround - p1trson - 11-23-2020

Cheers for sharing the bug report - TBH I didn't search for it since the workaround is easy (but yes, annoying) ^^.

I'd at least suggest/appreciate if this was somehow part of the known bugs (or mentioned in docs which talk about importing vcf) for this application in pinephone forums to keep everyone aware. Also the PR is opened for two months already, and who knows when this new version will be then part of our favourite OSes on our PPs.


RE: Importing vcf, country prefix problem workaround - cybercow - 12-02-2020

the evolution on mobian nethor wants to import vcf files nor run with the contacts.db file from my computer Huh