Download the PHP package codego/php-ksip-telnet without Composer
On this page you can find all versions of the php package codego/php-ksip-telnet. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download codego/php-ksip-telnet
More information about codego/php-ksip-telnet
Files in codego/php-ksip-telnet
Package php-ksip-telnet
Short Description FreePBX extension manager via SSH
License MIT
Informations about the package php-ksip-telnet
php-ksip-telnet
A PHP library for managing FreePBX/Asterisk PJSIP extensions remotely via SSH.
FreePBX-Safe Extension Creation
Direct SQL inserts into users, devices, sip, or the generic pjsip table can produce half-created extensions that appear in dialplan but are not fully managed FreePBX endpoints.
This library now expects extension creation to happen through a PBX-side PHP script that bootstraps FreePBX and uses its Core module methods. A starter script is included at stubs/create_freepbx_extension.php.
Deployment steps
-
Copy the stub to your FreePBX host:
- Verify that the script can load
/etc/freepbx.confon the PBX host. - Call
SSHClient::createExtensionKsip()as usual. It now invokes the PBX-side script instead of raw SQL inserts. - Reload FreePBX after successful creation.
Version note
The stub uses FreePBX::Create()->Core->addDevice() and addUser() as the intended integration path, but exact method signatures can vary by FreePBX version. Confirm them on your PBX before production rollout.
WEB DOCUMENTATION
Visit Documentation: php-ksip-telnet & juv-ksip-softphone Documentation
Requirements
- PHP >= 7.4
- Composer
Installation
Usage
1. Connect to SSH
2. Create a PJSIP Extension
3. Get All Extensions
4. Generate Extension if Not Exists
5. Run a Custom SSH Command
Environment Variables (Recommended)
Instead of hardcoding credentials, use environment variables:
License
MIT
Laravel Integration
1. Install the package
2. Add credentials to .env
3. Create a Service class
4. Register in config/services.php
5. Bind in AppServiceProvider
6. Use in a Controller
7. Add route in routes/api.php
8. Test via API
make:ksip-config — Per-User Softphone Settings
Generates a migration, model, controller, and API routes so each user can save their own softphone configuration in the database.
What it generates
database/migrations/{timestamp}_create_softphone_configs_table.phpapp/Models/SoftphoneConfig.phpapp/Http/Controllers/Api/SoftphoneConfigController.php- Appends routes to
routes/api.php
Migration Schema
Generated API Routes
| Method | Endpoint | Description |
|---|---|---|
GET |
/api/softphone-config |
Get the authenticated user's config |
POST |
/api/softphone-config |
Save / update the authenticated user's config |
Save Config Example
React Integration — configApiUrl prop
Pass the API endpoint to the Softphone component. It will fetch the user's saved config on mount and fall back to default values if no config is found.
If the API returns { "data": null }, the component uses its built-in default config.
SipController — Artisan Command Integration
Create extensions via HTTP API by calling the make:ksip Artisan command from a controller.
Controller Implementation
Route Registration
API Usage
make:ksip — Create Extension via CLI
Create a FreePBX PJSIP extension directly from the terminal without writing any PHP code.
--secret is optional — if omitted, the extension number is used as the password.
Options
| Option | Required | Description |
|---|---|---|
--extension |
✅ | The PJSIP extension number |
--name |
✅ | Display name / Caller ID |
--secret |
❌ | SIP password (defaults to extension number) |
Prerequisites
Make sure config/services.php has the freepbx block:
Auto Extension Registration (ksipRegisterUser)
Automatically generates a 12-digit extension number from a user's name acronym + birthdate, then registers it in FreePBX.
Extension Number Formula
| Part | Example | Result |
|---|---|---|
| Last name initial (L = 12th letter) | Luna | 12 |
| First name initial (J = 10th letter) | Juan | 10 |
| Middle name initial (M = 13th letter) | Mercado | 13 |
| Birthdate (mmddyy) | 12/16/1996 | 121696 |
| Final Extension | 121013121696 |
If the result is less than 12 digits, random digits are appended to complete it.
1. Scaffold the cron job
This generates:
app/Console/Commands/AssignExtensionToUsers.php- Appends schedule entry to
routes/console.php(Laravel 11+)
2. Add to .env
3. Run the scheduler
Production: Auto-run via Supervisor
In production, use Supervisor to keep the scheduler running automatically — no need to manually trigger it.
Install Supervisor:
Create config file:
Start Supervisor:
Check status:
Replace
/var/www/your-projectwith your actual project path andwww-datawith your server user (e.g.ubuntu,forge,deployer).
4. Call directly from a Registration Controller
Full Registration Controller Example
Generate Extension Number Only (no SSH)
Return Values of ksipRegisterUser
| status | Meaning |
|---|---|
assigned |
Extension generated and saved to FreePBX |
skipped |
User already has an extensionName |
error |
Missing name or birthdate fields |
Artisan Scaffold Generator
The package includes a make:ksipgen command that auto-generates call recording scaffold files in your Laravel project.
What it generates
app/Http/Controllers/Api/CallRecordingController.phpdatabase/migrations/{timestamp}_create_call_recordings_table.php- Appends routes to
routes/api.php
Usage
Generated Routes
Available API Endpoints
| Method | Endpoint | Description |
|---|---|---|
GET |
/api/recordings |
List all recordings |
POST |
/api/recordings/upload |
Upload a recording (mp3/wav/ogg) |
GET |
/api/recordings/{id} |
Get a single recording |
GET |
/api/recordings/{id}/download |
Download a recording |
DELETE |
/api/recordings/{id} |
Delete a recording |