Can't seem to figure out how to perform an incoming call using Twilio? - node.js

So, I'm new to Twilio and have been trying to build a full VoIP app. I can make outbound calls, but I'm not sure how to get an incoming call to be answered with Twilio and talking to a real person. I've scrolled through what seems like most of their documentation and can't seem to figure this out, and there doesn't seem to be any tutorials out there to help either.
I have the basic incoming function that is provided:
function incoming() {
const voiceResponse = new VoiceResponse();
voiceResponse.say("Congratulations! You have received your first inbound call! Good bye.");
console.log('Response:' + voiceResponse.toString());
return voiceResponse.toString();
}
I know how to do call forwarding, but for this VoIP application that isn't really what I want. I am using the Twilio trial account still. I am trying to set this VoIP app up on iOS if that makes a difference.
Thank you so much in advance!

Related

Does Twilio provide any APIs or services that can detect if call has been placed on hold by the receiver?

I'm placing a call from my React Native application using Twilio and the outbound call works fine. Now I want to create something that will detect when I am put on hold by the receiver. The idea here is to make my app hold for me and get back to the caller once the hold has ended.
I searched the twilio docs and services but could not find any thing regarding this use case. How would I go about doing this?
Twilio developer evangelist here.
Unfortunately, there is no mechanism to make this happen, even if there were something in the SIP signaling from the carrier, such as a re-INVITE.
In the world of SIP, putting a call on hold often involves sending a re-INVITE with different media parameters, such as saying a=sendonly in the session description. Even if this were passed end-to-end through the PSTN to Twilio, we do not generate webhooks to inform the customer’s app of this fact.
There are some good SO questions about placing a Twilio call on hold and retrieving it later--the Enqueue verb might be helpful.

Gmail API Watch Request Not Filtering Label IDs

Issue
Trying to get the Gmail API to send only new messages to Cloud Pub/Sub by using the Gmail APIs Watch function but when setting the labelIds in order to filter to just INBOX, i am still notified of all changes, files sent, drafts etc.
I've looked online and can see that there are people that are experiencing this issue and there is even a bug out for it https://issuetracker.google.com/issues/36759803.
But i find it kind of odd that the entire feature of filtering just doesn't work and its been an issue for 5 years according to the bug report. Makes me think its just me that is doing something wrong. Would be cool to hear from anyone that has got this to work.
Where im at
I'm using the Gmail API, trying to get my Gmail account to publish messages to Cloud Pub/Sub. I've managed to do this however im trying to filter what i get notifications for to just new messages. This is where i have a problem.
According to this Gmail API documentation, it appears all i have to call is the code below and that should be that. I will add however, that im calling the Kotlin equivalent, but i don't think this should matter.
request = {
'labelIds': ['INBOX'],
'topicName': 'projects/myproject/topics/mytopic'
}
gmail.users().watch(userId='me', body=request).execute()
What im calling:
val request = WatchRequest().apply {
labelIds = listOf("INBOX")
topicName = "projects/myproject/topics/mytopic"
}
gmail.users().watch("me", request).execute()
Other things ive tried
I have tried adding labelFilterAction = Include and other variations but they all seem to be ignored.
After trying the ideas listed by ziganotschka, I'm more confident that the issue is not related to specific client libraries.
I managed to speak to someone at Google who in turn contacted the G-mail API team. They said they were aware that this is an issue, that it has been an issue since 2015 and was most likely caused by a change they made back then.
A ticket is still open, but doesn't look like it will be fixed.
Perform the following trouble-shooting actions
Provide a request body including labelIds, labelFilterAction AND topicName as specified here
Try the label "UNREAD" instead of "INBOX"
To discart Kotlin implementation related issues, test your request in a programming language that allows you to pass the request as a JSON body in exactly the same way as specified in the documentation.

Nexmo API: Is there any method or API to cancel ongoing outbound or inbound call in Nexmo?

I want to disconnect an ongoing call from my server based on some circumstances. Is there any Nexmo API through which I can do the same?
Got answer to my query. Bit of more searching and study found my answer.
I can modify in-progress call by making a PUT call to below URL.
https://api.nexmo.com/v1/calls/:uuid
where UUID is uuid of call.
have to give action = 'hangup'

Webhooks are not fired. API nexmo

I use the nexmo api to redirect all call to a virtual us number to a real number.
To implement i use this request :
https://developer.nexmo.com/api/developer/numbers#update-a-number
With params below:
moHttpUrl : an url (https) on my server which respond 200 OK
country : US
misdn : the us virtual number
voiceCallbackType : tel
voiceCallbackValue : the real forward
voiceStatusCallback : an url (https) on my server which respond 200 OK
(The data is well recorded, i can see it on nexmo backoffice)
Problem : when i call the us number with my phone, the redirection is ok. I stay on line 10 seconds and stop the call.
At the moment nexmo should call my voiceStatusCallback but do nothing.
Furthermore i have no idea on which informations are passing with the webhook.
Thx for your help.
It looks like your problem is related to https, the simple call forwarding is part of our deprecated voice API and as such that only supports SHA-1 certs on https, so I'm imagining this is your problem.
https://help.nexmo.com/hc/en-us/articles/115005461928
There are 2 options, either use http for your callback (not great I know) or take a look at our new Voice API which will give you a lot more control, if you want to do a simple call forward you would just need to host a JSON file on a URL somewhere that contains a connect action see https://developer.nexmo.com/api/voice/ncco#connect You will then get a whole bunch of call event webhooks such as when the call starts, is answered and ends.
Rgds
Sam
Nexmo Developer Advocate

Control your device with custom commands using Actions in Google

just getting started with Assistant features in RPi and I am able to successfully implement upto this point and wondering few thing.
Scenario:
user: hey google "please turn on my living room Lights"
List item my code in horword.py : has a function to perform same action based on ON_RECOGNIZING_SPEACH_FINISHED
RPi/google home: I am not sure how respond to that
I was able to capture the request query asked by user using ON_RECOGNIZING_SPEACH_FINISHED = Args.text(str) and use it in my logic to perform the task. However, at the same time, "ok google" is responding with this answer.
to mitigate this problem, I created an google-actions, now it understands my query and respond with intention from api.ai. However, didn't acts on turn lights ON. So, wondering how can I read response from google home/api.ai in text and change code to act on it locally.
appreciate it.
You will not get response as text.
For getting response to client app use webhook in API.AI and send message using fcm to client app.
Read the fcm message in client app and do the corresponding actions.
finally was able to figure out multiple ways. answered this in other stack question. find more details in this post.
Multiple ways to handle this since google doesn't gives voices transcript and we let google say our transcript which is kind off solution for now.

Resources