My client has a Vonage business account, which includes a small staff which works from home, using Vonage hard VoIP phones to call customers.
The calls from the staff to customers are automatically initiated from the server by using a webhook URL. This webhook API is old (something Vonage acquired from Vocalocity), and Vonage is making noises that they will discontinue it. They are pushing Nexmo instead.
The Nexmo and GitHub documentation includes examples of how to place an outbound call. However, the examples seem to all be written around playing a text-to-speech recording from a Nexmo soft phone#. This is not what my client needs. We need to have the call initiated from my client's server so that the staff does not have to hand-dial a phone# to speak to a customer.
How can I configure Nexmo to place a call from an already-existing Vonage account / phone#?
I am using Python, and have written the following code:
from nexmo import Client, Voice
import sys
APPLICATION_ID = sys.argv[1]
PRIVATE_KEY = sys.argv[2]
callFrom = sys.argv[3]
callTo = sys.argv[4]
answer_url = 'https://developer.nexmo.com/ncco/tts.json'
client = Client(application_id=APPLICATION_ID, private_key=PRIVATE_KEY)
voice = Voice(client)
response = voice.create_call({
'to': [{'type': 'phone', 'number': callTo}],
'from': {'type': 'phone', 'number': callFrom},
'answer_url': [answer_url]
})
print(response)
In order to connect an existing VBC extension into a new Vonage Voice API Conversation, you would first initiate the conversation to the PSTN using a Vonage virtually provisioned phone number as the
from
number (more info here).Then, you can use the
connect
action in the NCCO to connect the VBC extension into the conversation.The subsequent
connect
NCCO would look like this: