feat(trunk): add customizable Asterisk Trunk Dial Options field with quick presets (tTR, TR, T)

This commit is contained in:
sorcier committed 2026-11-04 00:18:37 +01:00
1 parent bf2e2098f0
commit b3c98834c8
5 files changed
+43 -3

No files matched your search

+6 -2
View File
@@ -1133,6 +1133,7 @@ try {
$custom_aor_params = trim((string)($payload['custom_aor_params'] ?? ''));
$moh_sound_id = max(0, (int)($payload['moh_sound_id'] ?? 0));
$cid_name_prefix = trim((string)($payload['cid_name_prefix'] ?? ''));
$dial_options = preg_replace('/[^a-zA-Z0-9(),]/', '', trim((string)($payload['dial_options'] ?? 'tTR'))) ?: 'tTR';
$enabled = isset($payload['enabled']) ? (int)!empty($payload['enabled']) : 1;
$didRoutesRaw = is_array($payload['did_routes'] ?? null) ? $payload['did_routes'] : [];
@@ -1203,6 +1204,7 @@ try {
':custom_aor_params' => $custom_aor_params,
':moh_sound_id' => $moh_sound_id,
':cid_name_prefix' => $cid_name_prefix,
':dial_options' => $dial_options,
':enabled' => $enabled,
];
@@ -1230,6 +1232,7 @@ try {
outbound_prefix = :outbound_prefix, custom_endpoint_params = :custom_endpoint_params,
custom_reg_params = :custom_reg_params, custom_aor_params = :custom_aor_params,
moh_sound_id = :moh_sound_id, cid_name_prefix = :cid_name_prefix,
dial_options = :dial_options,
enabled = :enabled
WHERE id = :id
');
@@ -1245,7 +1248,7 @@ try {
qualify_frequency, max_channels, timers, language, rtp_keepalive, t38_udptl,
fax_detect, inband_progress, match_ips, context, inbound_dest, did_routes_json,
outbound_prefix, custom_endpoint_params, custom_reg_params, custom_aor_params, moh_sound_id,
cid_name_prefix, enabled
cid_name_prefix, dial_options, enabled
) VALUES (
:name, :host, :port, :outbound_proxy, :transport, :auth_mode, :username, :auth_username, :secret,
:registration_mode, :register, :server_uri, :client_uri, :contact_user, :expiration, :retry_interval,
@@ -1255,7 +1258,7 @@ try {
:qualify_frequency, :max_channels, :timers, :language, :rtp_keepalive, :t38_udptl,
:fax_detect, :inband_progress, :match_ips, :context, :inbound_dest, :did_routes_json,
:outbound_prefix, :custom_endpoint_params, :custom_reg_params, :custom_aor_params, :moh_sound_id,
:cid_name_prefix, :enabled
:cid_name_prefix, :dial_options, :enabled
)
ON CONFLICT(name) DO UPDATE SET
host = excluded.host, port = excluded.port, outbound_proxy = excluded.outbound_proxy,
@@ -1279,6 +1282,7 @@ try {
custom_reg_params = excluded.custom_reg_params, custom_aor_params = excluded.custom_aor_params,
moh_sound_id = excluded.moh_sound_id,
cid_name_prefix = excluded.cid_name_prefix,
dial_options = excluded.dial_options,
enabled = excluded.enabled
');
$stmt->execute($params);