Dynamic Outbound VoIP Configuration

Dynamic Outbound VoIP Configuration

Overview

When working with VoIP integrations in Dasha, you can configure outbound calls dynamically without creating new configurations for each client. This guide explains how to implement dynamic VoIP configuration and troubleshoot common issues.

Dynamic Configuration Methods

Using DashaScript Functions

Instead of creating static configurations, you can pass VoIP settings directly through DashaScript's built-in functions:

// Configure connection options and establish connection #connectSafe($phone, { sip_fromUser: "YOUR_DID", // Phone number/DID to use as caller ID sip_authUser: "TWILIO_AUTH_USER", // Authentication username sip_authPassword: "TWILIO_AUTH_PASSWORD", // Authentication password sip_server: "your-trunk.pstn.twilio.com" // SIP server address });

The dynamic configuration approach works with any SIP-compliant carrier or PBX system. While we use Twilio in the example below, you can apply the same pattern with other providers like Avaya, Five9, Genesys, RingCentral, or any custom SIP server - just adjust the server address and credentials accordingly.

Twilio Integration Example

For Twilio integration:

  1. Create a single SIP trunk in Twilio
  2. Configure multiple phone numbers under this trunk
  3. Use sip_fromUser to specify which number to use for outbound calls
  4. Extract call information using #getConnectOptions():
// Get Twilio Call SID for billing information var result = #getConnectOptions(); var sid = result.options.sip_X_Twilio_CallSid;

Troubleshooting

Config Deletion (409 Error)

If you receive a 409 error when trying to delete a configuration:

{ "reason": "Config is currently in use. Id: 5da85f7f-b5a0-4d3e-9b24-7c95db478ab3." }

This occurs because there is a running application using the configuration. To resolve:

  1. Stop all running applications using the configuration
  2. Wait for any active calls to complete
  3. Try deleting the configuration again

Best Practices

  1. Use a single trunk configuration for multiple DIDs when possible
  2. Implement proper error handling for dynamic configuration
  3. Store sensitive credentials securely
  4. Monitor active configurations and clean up unused ones
  5. Use logging to track configuration usage and troubleshoot issues

See Also

Found a mistake? Let us know.

Enroll in beta

Request invite to our private Beta program for developers to join the waitlist. No spam, we promise.