This package provides integration between Laravel Nova and the Zadarma VoIP service. It allows you to make, receive and manage phone calls directly from your Nova interface!
Run the following command to install the package:
composer require webard/nova-zadarma
Publish the package configuration using the following command:
php artisan vendor:publish --provider="Webard\NovaZadarma\NovaZadarmaServiceProvider" --tag=config
Add this lines to .env
file and fill them:
ZADARMA_KEY=
ZADARMA_SECRET=
ZADARMA_SIP_LOGIN=
Zadarma Secret and Key you can find in Settings -> Integrations and API -> Keys and API:
Zadarma SIP Login is the suffix of PBX number, which can be found under My PBX -> Extensions.
Your SIP Login is behind the painted field.
Publish the package migrations using the following command:
php artisan vendor:publish --provider="Webard\NovaZadarma\NovaZadarmaServiceProvider" --tag=migrations
NovaServiceProvider
use Webard\NovaZadarma\NovaZadarmaTool;
public function tools()
{
return [
...
NovaZadarmaTool::make(),
];
}
HasPhoneCalls
trait to the User modelzadarma_sip
and phone_number
to $fillable
propertyphone_number
field to E164PhoneNumberCast::class
.use Propaganistas\LaravelPhone\Casts\E164PhoneNumberCast;
use Webard\NovaZadarma\Traits\HasPhoneCalls;
class User extends Authenticatable {
use HasPhoneCalls;
protected $fillable = [
...
'zadarma_sip',
'phone_number'
];
protected function casts(): array
{
return [
...
'phone_number' => E164PhoneNumberCast::class,
];
}
}
Zadarma SIP
fieldPhone Number
fieldUserPhoneCalls
fielduse Webard\NovaZadarma\Nova\Fields\UserPhoneCalls;
class User extends Resource {
public function fields(NovaRequest $request)
{
return [
...
Text::make(__('Zadarma SIP'), 'zadarma_sip')
->sortable()
->nullable()
->rules('nullable', 'max:4'),
Text::make(__('Phone Number'), 'phone_number')
->sortable()
->rules('nullable', 'max:20', 'phone'),
UserPhoneCalls::make(),
];
}
}
Add the MakePhoneCall
action to the User resource:
use Webard\NovaZadarma\Nova\Actions\MakePhoneCall;
class User extends Resource {
public function actions(NovaRequest $request)
{
return [
...
MakePhoneCall::make()
->sole()
];
}
}
[!WARNING]
MakePhoneCall
action must besole
, because User can make call to only one user at time.[!TIP] You can add
->withoutConfirmation()
method to action to allow making phone calls directly after clicking action.
Go to your User edit form and fill Zadarma SIP
according to SIP number in Zadarma panel. Default created SIP number is 100:
Go to Settings -> Integrations and API -> Integrations in Zadarma Panel and enable "Notifications" integration.
Go to Notifications settings and enter webhook URL:
https://YOUR-DOMAIN.com/nova-vendor/webard/nova-zadarma/webhook
and enable checkboxes:
Go to bootstrap/app.php
file and modify withMiddleware
method:
return Application::configure(basePath: dirname(__DIR__))
->withMiddleware(function (Middleware $middleware) {
$middleware->validateCsrfTokens(except: [
'/nova-vendor/webard/nova-zadarma/webhook',
]);
})
->withExceptions(function (Exceptions $exceptions) {
//
})
->create();
If you have fruitcake/laravel-telescope-toolbar
installed, add webhook URL to ignore_paths
in config/telescope-toolbar.php
'ignore-paths' => [
'nova-vendor/webard/nova-zadarma/webhook'
]
I'm are actively seeking contributions to enhance this package. Here are some features I would love to see implemented:
We welcome contributions to improve this plugin! Please follow these steps to contribute:
This project is licensed under the MIT License. See the LICENSE.md file for more details.
For questions or support, please open an issue on GitHub.