68 releases
Uses new Rust 2024
new 0.1.72 | Apr 19, 2025 |
---|---|
0.1.71 | Apr 18, 2025 |
0.1.50 | Mar 28, 2025 |
#139 in Audio
5,653 downloads per month
Used in 5 crates
(3 directly)
185KB
5.5K
SLoC
cal-jambonz-rust π
A Rust library for building applications that interact with the Jambonz communications platform.
π± Heads up! For implementing a complete Jambonz webhook server with Actix Web integration, check out our awesome companion project jambonz-actix-web - it's perfect for handling those webhooks like a pro!
Overview π
This library provides a Rust implementation for creating and managing Jambonz applications. Jambonz is an open-source CPaaS (Communications Platform as a Service) that allows developers to build voice and messaging applications using a simple API. This library allows you to create Jambonz applications using type-safe Rust code, abstracting away the complexities of the underlying JSON webhook API.
Features β¨
- π‘οΈ Type-safe implementation of Jambonz verbs and actions
- π Simplified request/response handling for Jambonz webhooks
- π― Comprehensive support for Jambonz's feature set, including:
- π Call control (answer, hangup)
- π΅ Media operations (play, pause, record)
- π£οΈ Speech recognition and text-to-speech
- π₯ Conference management
- π Call transfer and SIP integration
- π’ Gather DTMF input
- And more...
Requirements β
- Rust 1.70+
- Actix Web ecosystem
- Features from:
actix-web
,actix-ws
,uuid
,serde
,futures
, etc.
Installation π¦
Add this to your Cargo.toml
:
[dependencies]
cal-jambonz-rust = "0.1.0"
Quick Start πββοΈ
Here's a simple example of using the library to create a basic IVR (Interactive Voice Response) application:
use cal_jambonz_rust::{JambonzResponse, verbs::*};
use cal_jambonz_rust::verbs::synthesizer::Synthesizer;
// Handle an incoming call webhook from Jambonz
fn handle_call_webhook(request_json: &str) {
// Parse the incoming webhook data
// (Implementation would depend on your web framework)
// Build a response with Jambonz verbs
let mut say = Say::new("Welcome to our service!".to_string());
say.synthesize(Some(Synthesizer::default().voice("female").language("en-US")));
let response = JambonzResponse::new()
.add_verb(say);
// Print the JSON response
println!("{}", response.to_json().unwrap());
// The JSON response would look something like:
// {
// "verb": "say",
// "text": "Welcome to our service!",
// "synthesizer": {
// "voice": "female",
// "language": "en-US"
// },
// "loop": 1,
// "earlyMedia": false
// }
}
Supported Jambonz Verbs π
This library supports all standard Jambonz verbs including:
- π£οΈ
Say
- Synthesize speech - π΅
Play
- Play an audio file - π’
Gather
- Collect DTMF digits - ποΈ
Record
- Record the call - π
Dial
- Make an outbound call - π₯
Conference
- Create or join a conference - π
Hangup
- End the call - π«
Sip:decline
- Decline an incoming call - πΆ
Leave
- Leave a conference - π
Transfer
- Transfer the call - βΈοΈ
Pause
- Pause execution - π·οΈ
Tag
- Add metadata to call events - βοΈ
Config
- Configure call parameters - π
Enqueue
- Place call in a queue - π
Dequeue
- Remove call from a queue
For detailed documentation on each verb and its options, please refer to the code documentation.
License π
This project is licensed under the MIT License - see the LICENSE file for details.
Contributing π§±
PRs and issues are welcome. Whether it's bug fixes, new features, or documentation improvements β let's build together.
Acknowledgments π
- Jambonz & Dave Horton, for providing a kick-ass open-source communications platform
TODO List π
Future enhancements planned for this library:
- π Implement Jambonz REST API client for account management
- β‘ Add support for real-time call control
- π Create comprehensive documentation with more examples
Dependencies
~3β5MB
~92K SLoC