SEPIA-Framework / sepia-docs

Documentation and Wiki for SEPIA. Please post your questions and bug-reports here in the issues section! Thank you :-)
https://sepia-framework.github.io/
238 stars 16 forks source link

Dial telephone numbers #229

Open OnkelBruno opened 1 year ago

OnkelBruno commented 1 year ago

Hi all,

thank you very much for that really great assistant! I've installed everything, and it runs like a charm.

But just one question - this feature would make Sepia even more great:

Can somebody please tell me how to create a new command for calling a number from my contact book on my Android phone? I've tried already sth like android.intent.action.CALL -d tel: +49blahblah for just dialing one number - this doesnt work. Is there any possibility to trigger sephia to recognise the contact from contact book and dial the number?

I am using Sepia with the Android App, the Assist-Server, MaryTTS and STT are running on my server and are reachable through OpenVPN/Https-Proxy.

Thank youยด!

fquirin commented 1 year ago

Hi @OnkelBruno :-)

One thing you can definitely do is use android.intent.action.DIAL via the Teach-UI command Execute platform specific actions. This will not automatically start the call, but open the dialer with a given number (the same thing is possible with simple web URLs tel://...). The JSON version of the intent looks like this:

{
    "value": {
        "type": "androidActivity",
        "data": {
            "action": "android.intent.action.DIAL",
            "url": "tel:+99932168"
        }
    }
}

Here is a screenshot of the Teach-UI field "Android Intent (androidActivity, androidBroadcast)" - Type "processed":

image

The same thing should theoretically work for android.intent.action.CALL, but the app is currently not able to request android.permission.CALL_PHONE, so you should get an error message if you try this intent.

Using the contact picker is more complicated and would probably need a specific Android plugin/extra code to handle the process. Maybe there is a "picker" intent that supports a name as data field, but I'm not sure ๐Ÿค”.

In general Android Intent handling has become a lot more complicated since Android 11, because you need to specify most things in the app manifest before you submit your app and certain permissions make it really hard to get Google's Play Store approval :-/.

OnkelBruno commented 1 year ago

Hi Florian,

thank you very much for your quick response. I've tested it and it works really good. As I am new to Intends in Android: Is there a way to place permissions inside the manifest-file for Sepia?

And: has maybe somebody already found out, how to pick contacts from the local adress book for dialing?

Thank you very much!

fquirin commented 1 year ago

As I am new to Intends in Android: Is there a way to place permissions inside the manifest-file for Sepia?

Unfortunately this can only be done before building the Android app. Maybe I could quickly build an APK file for testing that you can side-load if you're really interested in experimenting with the CALL intent ^^.

In general I'm very conservative with permissions, because every entry in the manifest file means more requirements and checks by Google before the app can be released via the Play Store :-/. I do agree though, that this feature is quite useful for a voice assistant ^^.

And: has maybe somebody already found out, how to pick contacts from the local adress book for dialing?

From what I've seen so far the Android procedure is likely: Show the contact picker -> retrieve user selection -> parse contact object for phone number -> trigger call intent. I could be wrong though. To fully automate commands like "call Jim" (without teach-UI) one probably has to make a copy for all contacts and keep that in sync with the phone. There seem to be ways to send SQL-like search queries to the contacts API, but I've no idea how that works yet (the tutorial is pretty long ^^).

From time to time I think about implementing contact lists in SEPIA, but there are usually things with higher priority right now ๐Ÿ˜….

OnkelBruno commented 1 year ago

Thank you, Florian.

Sure I am interessted in using the CALL intent. But my biggest goal is to use Sepia as an fully useable assistant. (Google Assistant or Alexa aren't a option since I'm concious of them spying on people)

As mentioned, I am new to those intends and also not very experienced in programming (I'm an Unix/Windows-Admin).

I don't want to steal your time, but sure, if you want to, send me the APK for sideloading - anyways, I don't install any app directly from Play Store for privacy reasons :)

I've done a bit research. Maybe this can help you (although I'm aware that Sepia is spare-time-project for you and therefore I can't place any feature requests :) - but maybe this could improve the app):

Just my experiences, maybe they can be interessting for you :)

fquirin commented 1 year ago

Hi @OnkelBruno ,

sorry, I'm currently deep down in the speech-recognition rabbit hole ๐Ÿ•ณ๏ธ๐Ÿ‡ to improve the STT server and haven't really had time to look at the app yet. I've noticed though, that the app is missing the code to actually request new permission, even if I add it to the manifest :-/. This is new in Android 13 and I'll probably have to make more changes to implement some kind of permission manager ๐Ÿ˜’.

I've done a bit research. Maybe this can help you (although I'm aware that Sepia is spare-time-project for you and therefore I can't place any feature requests :) - but maybe this could improve the app):

Thanks for the summary, I'm always interested in hardware and features feedback! I noticed as well that Bluetooth can be a problem and these remote buttons act weird sometimes :-|. I don't know if I can really fix this since it should in theory be handled by Android itself, but I'll keep it in mind. I do have a Bose Soundlink II as well, so maybe I can do some testing again ๐Ÿ™‚.

Btw, thanks a lot for your generous donation! ๐Ÿคฉ๐Ÿ˜ƒ

fquirin commented 1 year ago

A little update ๐Ÿ™‚: I just realized that there is probably enough cross-platform support for the Contact Picker API for a while now. Never really looked into that but will do this now to find out if its useful ๐Ÿ˜€