Get Configs of Creating WebRTC Connection

Last Updated on : 2023-07-12 02:45:53download

This topic describes how to get configurations for creating a connection over WebRTC.

API description

Get the configurations that are used to create a WebRTC connection.

API endpoint

GET: /v1.0/devices/{device_id}/webrtc-configs

Request parameters

Parameter name Type Location Required Description
device_id String uri true The device ID.

Return parameters

Parameter name Type Description
result WebRTCConfigVO The returned result.

Description of result

Parameter name Type Description
audio_attributes JSONObject The audio attribute.
auth String The license.
id String The device ID.
moto_id String The ID of the signaling service.
p2p_config JSONObject The P2P configuration.
skill String The skill.
supports_webrtc Boolean Indicates whether WebRTC is supported.
vedio_clarity Integer The video definition.

Description of p2p_config

Parameter name Type Description
ices List The information about interactive connectivity establishment (ICE).

Description of audio_attributes

Parameter name Type Description
call_mode List The call mode.
hardware_capability List The hardware capabilities.

Description of ices

Parameter name Type Description
urls String The URL of the specified server.
username String The username.
credential String The password.
ttl Integer The validity period.

Sample request

GET: /v1.0/devices/6c08578d894xxxx11afye1/webrtc-configs
{}

Sample response

{
    "result": {
        "p2p_config": {
            "ices": [
                {
                    "urls": "stun:172.81.239.63:****"
                },
                {
                    "urls": "stun:tx1stun.wgine.com:****"
                },
                {
                    "urls": "nat:tx1nat.wgine.com:****"
                },
                {
                    "urls": "nat:tx1nat.tuyacn.com:****"
                },
                {
                    "ttl": 3600,
                    "urls": "turn:172.81.239.63:3478",
                    "credential": "+eszzFb3f+KM7N5f+/3jdCHl****",
                    "username": "1615438498:6c08578d894934411afye1:kydhkuwwehqrvd8p****"
                },
                {
                    "ttl": 3600,
                    "urls": "turn:tx1turn.wgine.com:****",
                    "credential": "+eszzFb3f+KM7N5f+/3jdCHl****",
                    "username": "1615438498:6c08578d894934411afye1:kydhkuwwehqrvd8p****"
                }
            ]
        },
        "auth": "U+qtvRP+Amz3YQLpcgagMxqID8aUGBUZopKJr0kW****",
        "supports_webrtc": true,
        "skill": "{\"webrtc\":3,\"audios\":[{\"channels\":1,\"dataBit\":16,\"codecType\":105,\"sampleRate\":8000}],\"videos\":[{\"streamType\":2,\"profileId\":\"\",\"width\":2304,\"codecType\":4,\"sampleRate\":0,\"height\":1296},{\"streamType\":4,\"width\":640,\"codecType\":2,\"sampleRate\":0,\"height\":360}]}",
        "moto_id": "moto_cnpre002",
        "id": "6c08578d894934411a****",
        "vedio_clarity": 4,
        "audio_attributes": {
            "call_mode": [
                1,
                2
            ],
            "hardware_capability": [
                1,
                2
            ]
        }
    },
    "t": 1615434898584,
    "success": true
}

Error codes

For more information, see Global Error Codes.