https://github.com/iuridiniz/freeswitch_module_golang_sample
Sample module for FreeSWITCH using golang
https://github.com/iuridiniz/freeswitch_module_golang_sample
freeswitch golang golang-examples shared-module
Last synced: about 2 months ago
JSON representation
Sample module for FreeSWITCH using golang
- Host: GitHub
- URL: https://github.com/iuridiniz/freeswitch_module_golang_sample
- Owner: iuridiniz
- License: mit
- Created: 2021-10-21T11:43:26.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2025-06-05T15:10:34.000Z (9 months ago)
- Last Synced: 2025-06-05T16:25:30.920Z (9 months ago)
- Topics: freeswitch, golang, golang-examples, shared-module
- Language: Go
- Homepage:
- Size: 11.7 KB
- Stars: 7
- Watchers: 2
- Forks: 7
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# freeswitch_module_golang_sample
Sample module for [FreeSWITCH](https://github.com/signalwire/freeswitch) using golang
## tl; dr
```bash
git clone https://github.com/iuridiniz/freeswitch_module_golang_sample.git mod_hello_world
cd mod_hello_world
make && make install
fs_cli -x 'load mod_hello_world'
fs_cli -x 'hello my friend'
```
## Requirements
Working gcc, golang, make and freeswitch with dev files.
## Compiling
Just call `make`
```bash
make
```
Makefile will use a freeswitch compiled and installed in `/usr/local/freeswitch`, you can change by passing `FREESWITCH_DIR=/path/to/your/freeswitch` to `make`:
```bash
make FREESWITCH_DIR="/opt/freeswitch"
```
Also, this program will try to use `go` tool from your PATH, but you can change this by passing `GO_BINARY=/path/to/your/go` to `make`:
```bash
make GO_BINARY="/host/home/iuri/.local/opt/go-1.17.2.linux-amd64/bin/go"
```
## Install
```bash
make install
```
## Test
On fs_cli, call:
```cli
freeswitch@localhost> load mod_hello_world
freeswitch@localhost> hello golang
```
## File Descriptions
- **fs.c**: Contains C helper functions for interacting with FreeSWITCH.
- **fs.h**: Header file for `fs.c`, defining the interface for the C helper functions.
- **mod_hello_world.go**: The main Go source file for the FreeSWITCH module, containing the module's logic and interaction points with FreeSWITCH.