File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ # Use the official Golang image as the base image
2+ FROM golang:1.14
3+
4+ # Set the working directory
5+ WORKDIR /go/src/app
6+
7+ COPY go.mod go.sum ./
8+
9+ # Download dependencies using Go modules
10+ RUN go get -d ./...
11+
12+ COPY . .
13+
14+ # Build the Call API tools and place them in the /go/bin directory
15+ RUN GOBIN=/usr/bin make install
16+
17+ # Expose the WebSocket port
18+ EXPOSE 5059
19+
20+ # Default is 'call-api' when the container starts
21+ # to run the others, simply override the CMD
22+ # docker run call-api-client
23+ # docker run call-cmd
24+ CMD ["call-api" ]
Original file line number Diff line number Diff line change @@ -154,3 +154,30 @@ go run cmd/call-cmd/main.go CallStart caller=sip:alice@localhost callee=sip:bob@
154154## Documentation
155155
156156The [ docs] ( docs/ ) folder contains the documentation for this project.
157+
158+ ## Build and run docker containers
159+
160+ You can build and run the three tools under a docker container.
161+
162+ ``` sh
163+ docker build -t opensips-call-api:latest .
164+ ```
165+
166+ By default the ` call-api ` will be run:
167+
168+ ``` sh
169+ > docker run opensips-call-api:latest
170+ time=" 2023-10-10T21:42:48Z" level=info msg=" Listening for JSON-RPC over WebSocket on localhost:5059/call-api ..."
171+ ```
172+
173+ But, you can specify the ` call-cmd ` and ` call-api-client ` tools:
174+
175+ ``` sh
176+ docker run opensips-call-api:latest call-api-client \
177+ -method CallStart \
178+ -params ' {"caller": "sip:alice@localhost", "callee": "sip:bob@localhost"}'
179+ ```
180+
181+ ``` bash
182+ docker run opensips-call-api:latest call-cmd CallStart caller=sip:alice@localhost callee=sip:bob@localhost
183+ ```
You can’t perform that action at this time.
0 commit comments