Voice Provider
The Voice provider allows you to listen for webhooks from the Voice API. You can also download call recordings.
Functions
onCall- this function allows you to return an NCCO for incoming call webhooks using the Voice API. See the code snippet here.onCallEvent- this function allows you to handle call event webhooks using the Voice API. See the code snippet here.getCallRecording- this function allows you to download a call recording once a call has been completed. See the code snippet here.uploadCallRecording- this helper function allows you to directly store Voice API calls with the Assets provider. See the code snippet here.
Initializing the Voice Provider
To use the Voice Provider you need to create an instance of the provider using a session:
Regions
Incoming calls to the Voice API will hit the data centers in the same region as the application specified in your vcr.yml. For example, applications with aws.use1 in the configuration file will be handled by the US Voice API data center. You can specify which region you want the Voice provider to use by supplying a region URL to the initializer:
For your convenience, incoming webhooks from the Voice API will have a region_url property which you can pass straight to the Voice provider initializer:
Use Case
For example, you can use the Voice provider to answer an incoming Voice API Call: