-
Notifications
You must be signed in to change notification settings - Fork 104
Open
Description
I'm encountering Twilio error 21626: Invalid 'StatusCallbackEvent' when using the twilio openapi generated crate to initiate a call and track its status.
The same parameters work correctly when sent from a TypeScript client, but fail in Rust, even though the StatusCallbackEvent values are identical.
Snippet of the rust code:
let params = CreateCallParams {
account_sid,
to: to.to_string(),
from: from.to_string(),
url: Some("https://handler.twilio.com/twiml/EH93b5aded9d7acc065df056e7aab03b17".to_string()),
status_callback: Some("https://my-ngrok-url.ngrok-free.app/twilio".to_string()),
status_callback_event: Some(vec![
"initiated".to_string(),
"ringing".to_string(),
"answered".to_string(),
"completed".to_string(),
]),
..Default::default()
};
match create_call(&twilio_config, params).await {
Ok(resp) => println!("Call initiated successfully: {:?}", resp),
Err(e) => eprintln!("Failed to initiate call: {:?}", e),
}I tested the typescript call status monitoring and it worked correctly, so I compared the request from typescript and the request from rust:
Typescript:
Transcribe=false&Trim=trim-silence&Timeout=55&StatusCallback=https%3A%2F%2F227e97e53e35.ngrok-free.app%2Ftwilio&From=%2BNUMBER&Method=GET&StatusCallbackEvent=initiated%2C+ringing%2C+answered%2C+completed&AccountSid=ACf05dcbb291ca3a61ab0def0f64f61835&Url=https%3A%2F%2Fhandler.twilio.com%2Ftwiml%2FEH93b5aded9d7acc065df056e7aab03b17&StatusCallbackMethod=POST&AsyncAmd=false&To=%2BNUMBER&MachineDetectionTimeout=0
Rust:
Transcribe=false&Trim=trim-silence&Timeout=55&StatusCallback=https%3A%2F%2F2ceab4754dc5.ngrok-free.app%2Ftwilio&From=%2BNUMBER&Method=POST&StatusCallbackEvent=initiated%2C+ringing%2C+answered%2C+completed&AccountSid=ACf05dcbb291ca3a61ab0def0f64f61835&Url=https%3A%2F%2Fhandler.twilio.com%2Ftwiml%2FEH93b5aded9d7acc065df056e7aab03b17&StatusCallbackMethod=POST&AsyncAmd=false&To=%2BNUMBER&MachineDetectionTimeout=0
The parameter values are identical, All other key parameters (e.g., To, From, StatusCallback, Url) are correct.
I need help troubleshooting this.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels