sipgate / sipgate.io

Create custom telephony integration solutions. Play audio files, manage your devices, reject the call, present dial tone menus or just create statistics. Adapt telephony to your business needs, control your home automation with your phone or just create that funny hack to make using the phone more enjoyable. @sipgate.io, https://twitter.com/sipgateio
https://www.sipgate.io
Other
202 stars 32 forks source link

Request a list of missed calls #108

Closed torsk closed 7 years ago

torsk commented 7 years ago

Is it possible to get a list of missed calls via sipgate.io?

Kann ich eine Liste der entgangenen (oder natürlich auch aller anderen) Anrufe requesten? Habe keine Möglichkeit dafür gefunden.

CookieCrumb23 commented 7 years ago

Not with sipgate.io but you can do it with our REST-API (take a look at the history call). The API uses OAuth 2 for authorization and we have small chapter in our sipgate.io cookbook to help people get started with it.

torsk commented 7 years ago

This is an interactive approach, isn't it? That's a pity, I need a fully automated process. Or did I miss something? I consider applying a mechanize here is exaggerated.

TheCK commented 7 years ago

Hi torsk,

requesting the access token for your account through your script/app is an interactive process for the first time. afterwards your app/script can us the token fully automated.

If it's just a script you run locally and with your account you can also use https://api.sipgate.com/doc/#!/authorization/create and use the json/webtoken to authenticate yourself.

I hope this helps

torsk commented 7 years ago

Thanks a lot you for your help. I was able to receive a token from https://api.sipgate.com/v1/authorization/token. But I still am stopped by a "403 Forbidden. The request is

curl -v -X GET  --header 'Content-Type: application/json' --header 'Accept: application/json' --header 'Authorization: Bearer <token>' --data '{  "phonelineId": "p0", "types": "CALL", "offset": "0", "limit": "10" }' 'https://api.sipgate.com/v1/<my_phone_number>/history'

I took my phone number as userId. Is this correct?

I'm afraid, that there's a stupid mistake or misunderstanding on my side. I apologize for that.

torsk commented 7 years ago

Ah. I finally made it. The appropriate values (like userid and url path) for the above request are received from

https://api.sipgate.com/v1/numbers
TheCK commented 7 years ago

Hi again,

https://api.sipgate.com/v1/<my_phone_number>/history should be https://api.sipgate.com/v1/<your_user>/history

whereas your user probably is "w0"

https://api.sipgate.com/doc/#!/history/getHistory describes all the params and also has example values given.

torsk commented 7 years ago

Thanks again for your help and your patience.

I did read the documentation, but (at least for a aipgate beginner it is not that easy to understand. Where do you get the id from? it is not shown in the Sipgate web frontend. But: Everything is fine now and the script is working (the part of the server request anyhow). I'll close this topic.

Thanks a lot for your help

TheCK commented 7 years ago

Regarding the ID. you can decode the id from the json webtoken. otherwise you could call /users and find your user in the response and get the id from there.