Alexa Smart Properties: Enabling WebRTC in property rooms

Paul Socha Aug 02, 2023
Share:
Alexa Skills
Blog_Header_Post_Img

Following up on our prior blog - Alexa Smart Properties: WebRTC skill code and deployment, in this post, we will enable you to add your skill to an Alexa Smart Properties (ASP) room, create WebRTC contacts, and add them to an ASP room.

For this example, we will be using Delegated AuthenticationDelegated account linking creates an association between your skill provider account and your Amazon Business account as your Alexa Smart Properties account is tied to you Amazon Business account. After you set it up, your account credentials are delegated to the skill enablement API calls you make for your skill, so that you don't need to provide account details on each WebRTC call.

Enabling WebRTC in ASP Rooms in development stage

Follow the below steps:

1.     Log into the Alexa Mobile application on Android or iPhone using the same credentials you use to log into your Alexa Developer Console.

2.     Once logged into the Alexa Mobile app, navigate to the ‘More’ button at the bottom navigation bar. 

3.     Select “Skills and Games”. 

4.     Scroll to the bottom and select “Your Skills”. 

5.     At the top of “Your Skills”, swipe right at the top of the page till you see “Dev”. 

6.     Select Dev. 

7.     Locate your WebRTC Skill. 

8.     Select your WebRTC Skill. 

9.     Select “ENABLE TO USE”. 

10.  You will be promoted to Account Link your skill. For this process, you will provide credentials you used to login into the Alexa Smart Properties Console

11.  Once you have Account Linked your skill, Alexa Mobile will ask you if you accept Account Permission for making and receiving calls. Select “Save Permissions”.

12.  Select “Close”.

Enabling your WebRTC skill in ASP rooms in development stage

Once you have completed enabling your WebRTC skill on the Alexa Mobile, you are now ready to enable it in an ASP room. Use the ASP Skill Enablement API to enable your WebRTC for testing in an ASP room. Below is the sample API call that you will need to execute. Note that you need to use “development” in the stage for this to work.

Copied to clipboard
https://api.amazonalexa.com/v1/skills/{skillID}/enablements
{
 "unitId": "Room ID for ASP",
 "stage": "development"
}

 

The response for this call should look like this:

Copied to clipboard
{
    "skill": {
        "stage": "development",
        "id": "amzn1.ask.skill.XXXXXXX"
    },
        "unit": {
        "id": "XXXXXX"
    },
        "accountLink": {
            "status": "LINKED"
        },
    "status": "ENABLED"
}

 

Enabling your WebRTC skill in an ASP room in production stage

Once you skill has completed the ASP certification and is ready to be published live, you can now enable this skill using a public API or the ASP console. 

For enabling the skill live via API you can use the same API used for enabling the skill in development mode by changing the stage to “live.”

Copied to clipboard
https://api.amazonalexa.com/v1/skills/{skillID}/enablements
{
 "unitId": "Room ID for ASP",
 "stage": "live"
}

 

To enable WebRTC Alexa skill using the ASP console, navigate to the room for which the skill needs to be enabled. Once at the room, go to the bottom of the page to the Skill section. 

Click on tab “Hidden Skills”. Search for your WebRTC Alexa skillId: “amzn1.ask.skill.XXXXXXXXXX” and click Enable. Your skill using the same Delegated Authentication will assume the correct account linking credentials, so you will not have to enter any skill credentials.

 

Once you have your WebRTC Alexa skill enabled, the last step you will need to complete before placing your first WebRTC call is creating WebRTC contacts on ASP. 


Adding WebRTC contacts to an ASP room

First you will need to create a WebRTC contact in ASP. This will enable outbound calling from an Alexa device to your WebRTC infrastructure. 

1.     Create address book in your ASP organization. This can be completed on the ASP console or using the API. 

2.     Once your address book is created, using the Create Contact API, create the WebRTC contact type. 

Copied to clipboard
http://api.amazonalexa.com/v1/addressBooks/{Addressbook Unit Id}/contacts
{
"contact": {
    "name": "{contactName}", 
    "providerContact": {
        "id":"{id}" 
       }
    } 
}

* NOTE: The Provider Contact ID is created and owned by the developer. The developer is able to add whatever identifier into that ID. 

Second, you will need to associate endpoints on your network with your service provider. This is to enable inbound calling from your WebRTC infrastructure to an Alexa device. 

1.     Obtain your Service Provider ID and Amazon ID which was used when you created your Service Provider.

2.     Make the Associate Endpoint API call to map to an ID on the WebRTC network and the Alexa entity.

Copied to clipboard
POST /v1/communications/serviceProviders/amzn1.comms.csp.id.eb56ddf4-a5bd-119c-be09-0242ac127501/externalUsers 
HTTP/1.1 Host: api.amazonalexa.com 
Accept: application/json 
Authorization: Bearer {access token} 

{ 
    "externalUserId": "", 
    "amazonId": "amzn1.alexa.communications.profile.did.ABC1234", 
    "amazonIdType": "communication-profile" 
}

 

Testing your WebRTC Skill 


For outbound calling you can simply say “Alexa call {ASP Contact Name}”. For inbound calling you can use your WebRTC service (Web application, mobile application etc.) to select the specific contact and place the inbound call to your ASP Alexa  device. 

With this step, you are all set to enable seamless communication between Echo devices in your property rooms and non-Echo devices.

To recap, you have now successfully completed the ASP add-on for WebRTC, created your Service Provider, built your WebRTC skill, enabled your skill in an ASP room, and are able to place and receive audio and video calling between Echo and non-Echo devices. 

Contact the Alexa Smart Properties team to learn more about offering voice-enabled experiences powered by ASP. Learn how to enable WebRTC at your property by reviewing the technical documents and accessing the full sample in the GitHub Repo.

Related articles

Alexa Smart Properties enables audio and video calling between Echo and non-Echo devices with WebRTC
Alexa Smart Properties: How to easily get started with WebRTC
Alexa Smart Properties: WebRTC skill code and deployment

Subscribe