Is there a way to find whether the voice call is answered by machine or human . We came to know from the REST docs that if machine will be deprecated . If that so , whether the below code will work
*Call call = Call
.creator(new PhoneNumber(phSettings.getQueueConnectNumber()), new PhoneNumber(callnum),
new URI(url))
.setIfMachine("Hangup")
.setMethod(HttpMethod.GET).setStatusCallback(statusurl)
.setStatusCallbackMethod(HttpMethod.POST).setStatusCallbackEvent(callbackEvents).create(RestClient);*
Also from the docs we found MachineDetection is in beta , will we be get beta access for our testing.
Answering Machine Detection is in public beta so you can start experimenting with it right away.
The IfMachine parameter will be deprecated so you will need to update your code. For example, use the MachineDetection parameter as Enable or DetectMessageEnd. Enable returns results as soon as recognition is complete. DetectMessageEnd will wait until after a greeting to return results if an answering machine is detected.
As call to the API as seen in the docs:
curl 'https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXX123456789/Calls.json' -X POST \
--data-urlencode 'To=+1562300000' \
--data-urlencode 'From=+18180000000' \
--data-urlencode 'MachineDetection=Enable' \
--data-urlencode 'Url=https://handler.twilio.com/twiml/EH8ccdbd7f0b8fe34357da8ce87ebe5a16' \
-u ACXXXXXXXXXXXXXXXX123456789:[AuthToken]
Related
I am wondering how to update event.TaskAttributes.variable value of a current task. I thought it's straight forward from the example by Twilio but I am not seeing any change If I followed the same and try to set/update a value of a specific attribute (defined in IVR voice flow widget).
https://www.twilio.com/docs/taskrouter/api/task#action-update
For example, there is an attribute called language which is a gather input digits field in IVR flow and at some point in the execution (while the caller is in waiting queue), we would like to update it to a different value. I tried via postman but it does nothing. Any help is greatly appreciated.
https://taskrouter.twilio.com/v1/Workspaces/WSXXXXXXX/Tasks/WTXXXXXX
{
"attributes": {
"language": "6"
}
}
Thanx!
In Postman use url-encoded format. The request should be encoded. Use 'Attributes' in place of 'attributes'. I am attaching a sample cURL request, this might be helpful
curl -X POST \
https://taskrouter.twilio.com/v1/Workspaces/WS...../Tasks/WTXXXX...... \
-H 'Authorization: Basic XXXXXXXXXXXXX' \
-H 'Content-Type: application/x-www-form-urlencoded' \
-d 'Attributes=%7B%22test2%22%3A%201%7D'
I am having an issues with thingsboard professional edition.
I am using HTML Server Side RPC API.
Basically what I am trying to do is load dashboard and update knob temperature value. The next step is to set temperature value using knob and send it to device.
Issue with getValue method
First of all I open dashboard and I am sending GET request
curl -v -X GET https://cloud.thingsboard.io/api/v1/*Device Access/Token*/rpc
Response is:
{"id":241,"method":"getValue","params":null}*
So I respond:
curl -v -X POST -d "{"result":44}" https://cloud.thingsboard.io/api/v1/*Device Access Token*/rpc/241 --header "Content-Type:application/json"
In place of "{"result":44}" I tried (I think) all possibilities like:
"{"method":"getValue","params":44}"
"{"method":"setValue","params":44}"
"{"method":NULL,"params":44}"
"{NULL,44}"
"44"
"{44}" and so on...
Can somebody help me how should proper response look like to update knob value when dashboard loads?
2) setValue issue
When I am trying to change temperature value I noticed that there is something weird happening.
Let's say that I want to change value from 50 to 80deg using knob.
If i just "click" and temperature is set somewhere about 80deg when I send GET message response is what i expect:
{"id":273,"method":"setValue","params":"81.37"}*
But when I click on knob and slide the value from 50deg to 80deg and release the button I don't have proper response. Most of the time I have response like that:
{"id":275,"method":"setValue","params":"50.00"}* Closing connection 0
Or very close to 50 deg and it doesn't change anymore. How can i fix that issue?
Even though this is more than 2 years old, I think it might help someone never the less:
Regarding GetValue I did many experiments and found that the POST message does not need
--header "Content-Type:application/json"
and the return value does not need to be in JSON format, but just plain text. So if you use
--header "Content-Type:application/text"
and as a return value just send e.g.
40.0
it will be accepted by the knob control.
full command might be something like
curls -v -X POST -d 40.0 https://cloud.thingsboard.io/api/v1/*Device Access Token*/rpc/241 --header "Content-Type:application/text"
As part of our application flow, we create default LiveBroadcasts for the users to stream too. For most of our users the default LiveBroadcasts are automatically bound to the default LiveStreams, however a few users have default LiveBroadcasts that don't bind automatically.
I attempted to bind to a non-default LiveStream (since there seems to be no way to find the default LiveStream) and I get a 403 with an error message liveBroadcastBindingNotAllowed: The binding is not allowed.
Since there is no stream bound, we are unable to stream to that LiveBroadcast and our users are getting errors. Is there any workaround or fix for this?
I have encountered a similar issue as well. When listing all broadcasts via the following:
curl \
'https://www.googleapis.com/youtube/v3/liveBroadcasts?part=id%2Csnippet%2CcontentDetails%2Cstatus&broadcastType=all&mine=true&key=[YOUR_API_KEY]' \
--header 'Authorization: Bearer [YOUR_ACCESS_TOKEN]' \
--header 'Accept: application/json' \
--compressed
Some of our users are getting more than one broadcast where snippet.defaultBroadcast is true, but only one of these persistent broadcasts actually have a valid contentDetails.boundStreamId, the others simply omit the property. For my personal account, if I change the broadcastType from all to persistent, then I'm able to get just the one true default broadcast which has a valid contentDetails.boundStreamId. Here is an example request:
curl \
'https://www.googleapis.com/youtube/v3/liveBroadcasts?part=id%2Csnippet%2CcontentDetails%2Cstatus&broadcastType=persistent&mine=true&key=[YOUR_API_KEY]' \
--header 'Authorization: Bearer [YOUR_ACCESS_TOKEN]' \
--header 'Accept: application/json' \
--compressed
I'm not sure yet if it's a fluke that it happens to choose the correct persistent broadcast. I am going to contact some of our users to help me troubleshoot this, I know of one that has at least 3 persistent broadcasts in the response from the API.
I'm trying to figure out if it's possible to use a single REST request to have Twilio call out to a phone number, and play out a voice message. The content of the voice message will be different each time, so that message would need to be passed as a parameter.
In looking at the Twilio API "Making Calls" doc, I see this curl sample:
$ curl -XPOST https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls.json \
--data-urlencode "Url=http://demo.twilio.com/docs/voice.xml" \
--data-urlencode "To=+14155551212" \
--data-urlencode "From=+14158675309" \
-u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
This specifies a URL for an XML configuration. For dynamic text, is the expectation that I should publish an xml file to a URL before making the REST call, and then provide that URL in the call? Is there a way to provide the XML as POST data to the end point, rather than using a URL?
Thanks in advance.
gmc
Twilio developer evangelist here.
You can't include the XML as POST data I'm afraid. However, we do offer TwiML Bins which you can use to host your XML without getting a server of your own. Recently we added support for templating in TwiML Bins. This means that you can pass URL parameters to a TwiML Bin URL and use those parameters in your response.
So, if you are intending to use speech to text to read out a message with <Say> then you could write the following TwiML as a TwiML Bin:
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Say>{{ Message }}</Say>
</Response>
You'll get a URL that looks like: https://handler.twilio.com/twiml/EHsomerandomcharacters
You can then use that URL in your call creation, with a URL parameter of Message to read a different message each time.
$ curl -XPOST https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Calls.json \
--data-urlencode "Url=https://handler.twilio.com/twiml/EHsomerandomcharacters?Message=Hello+from+your+TwiML+Bin!" \
--data-urlencode "To=+14155551212" \
--data-urlencode "From=+14158675309" \
-u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
Let me know if that helps at all.
I am working on a Rails app that has as the requirement logging in with omniuth to Instagram. This would be my first time using Instagram's OAuth endpoint and it is unclear whether it is working (and not clear to project manager either).
I'm using their cURL implementation with the following (will reset it in future) but getting "No matching code found" error which would seem to be the logical first step.
curl \-F 'client_id=4658fa17d45244c88dd13c73949a57d7' \
-F 'client_secret=ae6cfe5d13544eada4dece2ec40ac5dc' \
-F 'grant_type=authorization_code' \
-F 'redirect_uri= http://seek-style.herokuapp.com/arc/services/instagram' \
-F 'code=CODE' \https://api.instagram.com/oauth/access_token
with response
{"code": 400, "error_type": "OAuthException", "error_message": "No matching code found."}
Is there something that I am doing obviously wrong? Is there a finished example of how to get this done? I have seen https://github.com/ropiku/omniauth-instagram but can't tell if still working. Spec's pass but the actual call is mocked.
Edit #1
Per comments, I have added a link to repo https://github.com/trestles/seek that is being used to deploy to Heroku. There's basically nothing in the app and the above cURL to the best of my knowledge should be working (and isn't) so I haven't really even tested this. Perhaps I'm misunderstanding even how Instagram's API is working.
So, I have done a little research on Instagram API.
All the required info is located here: http://instagram.com/developer/authentication/
First of all, you need to get one-time CODE from Instagram. For your app it is pretty easy.
Just set href for your 'auth to instagram' link to:
"https://api.instagram.com/oauth/authorize/?client_id=4658fa17d45244c88dd13c73949a57d7&redirect_uri=http://seek-style.herokuapp.com/arc/services/instagram&response_type=code"
You will receive a redirect from API with CODE as a parameter.
You can handle it in services_controller#instagram or simply extract from application logs.
There should be something like
Processing by ServicesController#instagram as HTML
Parameters: {"code"=>"c25dcdcb96ed4eb9a508fede0cb94e87", "state"=>"e3d6dc22d6cd3cdebf6fb9e51a728a120a6d901cc382c4bf"}
Then you should request an ACCESS_TOKEN from the API
using cURL:
curl \-F 'client_id=YOUR_CLIENT_ID' \
-F 'client_secret=YOUR_CLIENT_SECRET' \
-F 'grant_type=authorization_code' \
-F 'redirect_uri= http://seek-style.herokuapp.com/arc/services/instagram' \
-F 'code=CODE_FROM_ABOVE' \https://api.instagram.com/oauth/access_token
Or using RestClient in services_controller#instagram :
resp = RestClient.post 'https://api.instagram.com/oauth/access_token', {
client_id: 'YOUR_CLIENT_ID',
client_secret: 'YOUR_CLIENT_SECRET',
grant_type: 'authorization_code',
redirect_uri: 'http://seek-style.herokuapp.com/arc/services/instagram',
code: params[:code]
}
The cURL response or resp.body in controller should contain something like:
{
"access_token":"1515660384.9f652d3.fcb1e712d41347069ad5c65ccfada994",
"user":{
"username":"petro.softserve",
"bio":"",
"website":"",
"profile_picture":"http:\/\/images.ak.instagram.com\/profiles\/anonymousUser.jpg",
"full_name":"",
"id":"1515660384"
}
}