金色时刻 · 15:48
让好资源,触手可及
AGENT SKILL

asterisk-tester

asterisk-tester 是面向测试与安全的 Agent Skill,来自 mikopbx/Core。查看技能说明、操作步骤与使用约定,并通过原项目了解详细用法。

Тестирование сценариев Asterisk dialplan и потоков звонков используя безопасные Local каналы. Использовать при тестировании логики маршрутизации звонков, отладке проблем dialplan или проверке потоков IVR меню.

SKILL.md

下载 MD ↓
nameasterisk-tester
descriptionТестирование сценариев Asterisk dialplan и потоков звонков используя безопасные Local каналы. Использовать при тестировании логики маршрутизации звонков, отладке проблем dialplan или проверке потоков IVR меню.
allowed-toolsBash, Read, Grep, Glob

asterisk-dialplan-testing

Tests Asterisk dialplan scenarios and call flows to verify they work as expected.

What this skill does

  • Tests dialplan contexts and extensions
  • Simulates call flows through the dialplan
  • Verifies routing logic and conditions
  • Tests IVR menus and time conditions
  • Validates AGI/AMI integrations
  • Checks pattern matching and regular expressions

When to use this skill

Use this skill when: - Creating or modifying dialplan scenarios - Testing call routing logic - Verifying IVR menu flows - Debugging call issues - Testing time-based routing - Validating custom dialplan applications

How to use this skill

Simply describe what you want to test: - "Test calling extension 201" - "Simulate call flow through IVR menu" - "Test emergency number routing" - "Verify time condition for night mode" - "Test pattern matching for international calls"

Instructions

You are an expert Asterisk dialplan tester. When invoked:

  1. Understand the test scenario from the user's request: - Which extension/pattern to test - Expected call flow - Conditions to verify (time, caller ID, etc.) - Success criteria

  2. Access Asterisk CLI in the Docker container: ```bash # Get container ID docker ps | grep mikopbx

# Access Asterisk CLI docker exec -it asterisk -rvvv ```

  1. Analyze dialplan before testing: ```bash # Show specific context docker exec asterisk -rx "dialplan show "

# Show specific extension docker exec asterisk -rx "dialplan show @"

# Search for pattern docker exec asterisk -rx "dialplan show" | grep -A 10 "" ```

  1. Use dialplan simulation tools: ```bash # Test extension matching docker exec asterisk -rx "dialplan show @"

# Simulate call flow (requires custom AGI or debug) docker exec asterisk -rx "core set verbose 5" docker exec asterisk -rx "core set debug 5" ```

  1. Test with originate command for real call simulation: ```bash # Originate a test call docker exec asterisk -rx "channel originate Local/@ application Wait 10"

# Test with specific caller ID docker exec asterisk -rx "channel originate Local/@ application Playback demo-congrats" ```

  1. Monitor call flow in real-time: ```bash # Enable verbose logging docker exec asterisk -rx "core set verbose 10"

# Watch dialplan execution docker exec asterisk -rx "dialplan set debug on"

# Follow logs during test docker exec tail -f /var/log/asterisk/full ```

  1. Test specific scenarios:

IVR Testing: ```bash # Check IVR structure docker exec asterisk -rx "dialplan show ivr-@"

# Test DTMF handling docker exec asterisk -rx "channel originate Local/@ application Read digits,/var/lib/asterisk/sounds/en/beep,1" ```

Time Condition Testing: ```bash # Check current time conditions docker exec asterisk -rx "dialplan show" | grep -i "gotoiftime"

# Verify time expressions # (requires checking dialplan logic) ```

Pattern Matching: ```bash # Test pattern match docker exec asterisk -rx "dialplan show @"

# Should show which pattern matched ```

Call Recording: bash # Verify recording is enabled docker exec <id> asterisk -rx "dialplan show" | grep -i "mixmonitor"

  1. Database verification: ```bash # Check extension in database docker exec sqlite3 /cf/conf/mikopbx.db "SELECT * FROM extensions WHERE number=''"

# Check routing rules docker exec sqlite3 /cf/conf/mikopbx.db "SELECT * FROM m_IncomingRoutes" docker exec sqlite3 /cf/conf/mikopbx.db "SELECT * FROM m_OutgoingRoutes" ```

  1. Report test results in this format: ``` ## Dialplan Test Results

### Scenario: - Status: ✅ Passed / ❌ Failed / ⚠️ Warning

### Test Configuration - Extension: - Context: - Caller ID: - Time:

### Call Flow 1. [Step]: → 2. [Step]: → 3. ...

### Verification Points - ✅ Extension matched: - ✅ Routing correct: - ❌ Recording failed: - ⚠️ Timeout occurred:

### Dialplan Execution <relevant dialplan snippet>

### Issues Found - : → - : →

### Recommendations - - ```

  1. Common test patterns:

    Basic extension call: ```bash

    Test extension 201 can receive calls

    docker exec asterisk -rx "dialplan show 201@internal" docker exec asterisk -rx "channel originate Local/201@internal application Playback demo-congrats" ```

    Outbound routing: ```bash

    Test outbound number pattern

    docker exec asterisk -rx "dialplan show 79001234567@outgoing" ```

    IVR menu: ```bash

    Show IVR structure

    docker exec asterisk -rx "dialplan show ivr-main@internal"

    Test each menu option

    docker exec asterisk -rx "dialplan show 1@ivr-main" ```

Advanced testing techniques

Test with AMI (Asterisk Manager Interface)

# Connect to AMI
docker exec <id> asterisk -rx "manager show connected"

# Can use curl for AMI actions
curl -u admin:password http://localhost:8088/asterisk/rawman?action=Originate&Channel=Local/201@internal&Exten=202&Context=internal&Priority=1

Test with AGI scripts

# Check AGI scripts
docker exec <id> ls -la /var/lib/asterisk/agi-bin/

# Test AGI execution
docker exec <id> /var/lib/asterisk/agi-bin/<script> < /dev/null

Load testing

# Generate multiple test calls (use with caution)
docker exec <id> asterisk -rx "channel originate Local/load-test@internal application Wait 30"

MikoPBX-specific testing

  1. Test worker-generated contexts: Verify contexts like internal, outgoing, incoming-<id>
  2. Module integration: Test custom module dialplan hooks
  3. Custom applications: Verify dialplan applications in /storage/usbdisk1/mikopbx/custom_modules/
  4. Call detail records: Check CDR database after test calls

Safety guidelines

  • Never test on production systems without proper planning
  • Use Local channel for safe testing (no actual SIP calls)
  • Clean up test calls: Always terminate test calls properly
  • Monitor resources: Watch CPU/memory during load tests
  • Backup configs: Before testing major changes

Useful debugging

# Enable all debugging
docker exec <id> asterisk -rx "core set verbose 10"
docker exec <id> asterisk -rx "core set debug 10"
docker exec <id> asterisk -rx "dialplan set debug on"

# Disable after testing
docker exec <id> asterisk -rx "core set verbose 0"
docker exec <id> asterisk -rx "core set debug 0"
docker exec <id> asterisk -rx "dialplan set debug off"

# Check active channels during test
docker exec <id> asterisk -rx "core show channels"

# Hangup stuck channels
docker exec <id> asterisk -rx "channel request hangup <channel_name>"

Output format

Always provide: 1. Test scenario description 2. Step-by-step call flow 3. Success/failure status for each verification point 4. Actual dialplan code tested 5. Issues found with recommendations 6. Relevant log excerpts if failures occurred

Be thorough, provide evidence (log outputs), and give actionable recommendations.

来源:mikopbx/Core · GPL 许可 · 许可原文 · MD 为来源页保存的历史版本