# Active Call Configuration
#
# CLI Options (override config file):
#   --conf <path>          : Load configuration from file
#   --http <addr:port>     : HTTP server bind address
#   --sip <addr:port>      : SIP server bind address
#   --handler <value>      : Quick handler setup
#                            - URL (http://...) for webhook handler
#                            - .md file for playbook default handler
#   --call <SIP_URI>       : Initiate an outgoing SIP call immediately
#   --external-ip <IP>     : Set external IP address
#   --codecs <CODECS>      : Supported codecs (e.g., pcmu,pcma,opus)
#
# Examples:
#   ./active-call --handler https://api.example.com/webhook
#   ./active-call --handler default.md --sip 0.0.0.0:13050 --external-ip 1.2.3.4 --codecs pcmu,pcma
#   ./active-call --call sip:1001@127.0.0.1 --handler greeting.md

addr = "0.0.0.0"
http_addr = "0.0.0.0:8080"
udp_port = 13050
# http_gzip = true
log_level = "debug"
#log_file = "/tmp/rustpbx.log"
# Paths can include a trailing * to skip whole subtrees
# http_access_skip_paths = ["/health", "/metrics*"]
media_cache_path = "./config/mediacache"

# external IP address for SIP signaling and media
# if server is behind NAT, set your public IP here (without port)
# external_ip = "1.2.3.4"
# auto learn public SIP address from Via received/rport in responses
# auto_learn_public_address = true

# rtp_start_port = 20000
# rtp_end_port = 30000
#
# enable_rtp_latching = true
# enable_ice_lite = false
# rtp_bind_ip = 0.0.0.0

# setup your STUN/TURN servers here, for webrtc web clients
# [[ice_servers]]
# urls = ["stun:stun.l.google.com:19302"]

# [[ice_servers]]
# urls = ["turn:restsend.com:3478"]
# username = "user"
# credential = "pass"

# Invitation handler - handles incoming SIP invitations
# Option 1: Webhook handler - forward invitations to HTTP endpoint
# [handler]
# type = "webhook"
# url = "http://localhost:8090/webhook"
# method = "POST"

# Option 2: Playbook handler - route calls to playbooks based on caller/callee patterns
# [handler]
# type = "playbook"
# default = "default.md"  # optional: default playbook when no rules match
#
# [[handler.rules]]
# caller = "^\\+1\\d{10}$"        # regex pattern for caller number
# callee = "^sip:support@.*"      # regex pattern for callee number
# playbook = "support.md"         # playbook file to use
#
# [[handler.rules]]
# caller = "^\\+86\\d+"           # pattern for Chinese numbers
# playbook = "chinese.md"         # optional: only match caller
#
# [[handler.rules]]
# callee = "^sip:sales@.*"        # optional: only match callee
# playbook = "sales.md"

# [handler]
# type = "webhook"
# url = "http://localhost:8090/webhook"
# method = "POST"

[recording]
enabled = true
auto_start = true

[callrecord]
type = "local"
root = "./config/cdr"

# [[register_users]]
# server = "127.0.0.1:5060" # Your Asterisk server
# username = "1002"        # SIP extension
# disabled = false         # Set to true to disable this account

# [register_users.credential]
# username = "1002"
# password = ""     # Leave empty for IP-based auth
