跳到主要内容

PhoneCallService API demo

This example shows how to invoke Layotto PhoneCallService API.

What is PhoneCallService API used for?

PhoneCallService API is used to send voice messages.

step 1. Deploy Layotto

With Docker

You can start Layotto with docker

docker run -v "$(pwd)/configs/config_standalone.json:/runtime/configs/config.json" -d  -p 34904:34904 --name layotto layotto/layotto start

Compile locally (not for Windows)

You can compile and run Layotto locally.

[!TIP|label: Not for Windows users] Layotto fails to compile under Windows. Windows users are recommended to deploy using docker

After downloading the project code to the local, switch the code directory and compile:

cd ${project_path}/cmd/layotto
go build

Once finished, the layotto binary will be generated in the directory.

Run it:

./layotto start -c ../../configs/config_standalone.json

step 2. Run the client program to invoke Layotto PhoneCallService API

Go

Build and run the golang demo:

 cd ${project_path}/demo/phone/common/
go build -o client
./client -s "demo"

If the following information is printed, the demo is successful:

TODO

Java

Download java sdk and examples:

git clone https://github.com/layotto/java-sdk
cd java-sdk

Build the demo:

# build example jar
mvn -f examples-phone/pom.xml clean package

Run it:

java -jar examples-phone/target/examples-phone-jar-with-dependencies.jar

If the following information is printed, the demo is successful:

TODO

step 3. Stop containers and release resources

Destroy the Docker container

If you started Layotto with docker, you can destroy the container as follows:

docker rm -f layotto

Next step

What does this client program do?

The demo client program uses the SDK provided by Layotto to invoke the Layotto PhoneCallService API.

The golang sdk is located in the sdk directory, and the java sdk is in https://github.com/layotto/java-sdk

In addition to using sdk, you can also interact with Layotto directly through grpc in any language you like.

Details later, let's continue to experience other APIs

Explore other Quickstarts through the navigation bar on the left.

Reference

API Reference