Realtime PostgreSQL pjsip
Добавлено: 17 авг 2021, 12:09
На просторах инета сложно найти готовую sql команду для realtime pjsip работающий на postgesql потому оставлю настройки пользователей для realtime тут, может кому то понадобится)
Возможны неточности в реализации, в SQL я не силен
Код: Выделить всё
CREATE TYPE yorn AS ENUM ('yes', 'no');
CREATE TYPE inreup AS ENUM ('invite','reinvite','update');
CREATE TYPE allow_prohib_un AS ENUM ('allowed_not_screened','allowed_passed_screened','allowed_failed_screened','allowed','prohib_not_screened','prohib_passed_screened','prohib_failed_screened','prohib','unavailable');
CREATE TYPE auth_tp AS ENUM ('md5','userpass');
CREATE TYPE noouin AS ENUM ('none','outgoing','incoming');
CREATE TYPE dtmf_md AS ENUM ('rfc4733','inband','info','auto');
CREATE TYPE ind_by AS ENUM ('username','auth_username');
CREATE TYPE timers_mode AS ENUM ('forced','no','required','yes');
CREATE TYPE rel_mode AS ENUM ('no','required','yes');
CREATE TYPE media_encryption_mode AS ENUM ('no','sdes','dtls');
CREATE TYPE t38_udptl_ec_mode AS ENUM ('none','fec','redundancy');
CREATE TYPE dtls_setup_mode AS ENUM ('active','passive','actpass');
CREATE TYPE redirect_method_mode AS ENUM ('user','uri_core','uri_pjsip');
CREATE TYPE transport_method_mode AS ENUM ('default','unspecified','tlsv1','sslv2','sslv3','sslv23');
CREATE TYPE protocol_mode AS ENUM ('udp','tcp','tls','ws','wss');
-- SQLINES LICENSE FOR EVALUATION USE ONLY
CREATE TABLE ps_aors (
id varchar(40) NOT NULL,
contact varchar(255) DEFAULT NULL,
default_expiration int DEFAULT NULL,
mailboxes varchar(80) DEFAULT NULL,
max_contacts int DEFAULT NULL,
minimum_expiration int DEFAULT NULL,
remove_existing yorn DEFAULT NULL,
qualify_frequency int DEFAULT NULL,
authenticate_qualify yorn DEFAULT NULL,
maximum_expiration int DEFAULT NULL,
outbound_proxy varchar(40) DEFAULT NULL,
support_path yorn DEFAULT NULL,
qualify_timeout double precision DEFAULT NULL,
voicemail_extension varchar(40) DEFAULT NULL,
CONSTRAINT id UNIQUE (id)
) ;
CREATE INDEX ps_aors_id ON ps_aors (id);
CREATE INDEX ps_aors_qualifyfreq_contact ON ps_aors (qualify_frequency,contact);
-- SQLINES LICENSE FOR EVALUATION USE ONLY
CREATE TABLE ps_auths (
id varchar(40) NOT NULL,
auth_type auth_tp DEFAULT NULL,
nonce_lifetime int DEFAULT NULL,
md5_cred varchar(40) DEFAULT NULL,
password varchar(80) DEFAULT NULL,
realm varchar(40) DEFAULT NULL,
username varchar(40) DEFAULT NULL
) ;
CREATE INDEX ps_auths_id ON ps_auths (id);
-- SQLINES LICENSE FOR EVALUATION USE ONLY
CREATE TABLE ps_contacts (
id varchar(255) DEFAULT NULL,
uri varchar(255) DEFAULT NULL,
expiration_time bigint DEFAULT NULL,
qualify_frequency int DEFAULT NULL,
outbound_proxy varchar(40) DEFAULT NULL,
path text,
user_agent varchar(255) DEFAULT NULL,
qualify_timeout double precision DEFAULT NULL,
reg_server varchar(20) DEFAULT NULL,
authenticate_qualify yorn DEFAULT NULL,
via_addr varchar(40) DEFAULT NULL,
via_port int DEFAULT NULL,
call_id varchar(255) DEFAULT NULL,
endpoint varchar(40) DEFAULT NULL,
prune_on_boot yorn DEFAULT NULL
CONSTRAINT ps_contacts_uq UNIQUE (id,reg_server)
) ;
CREATE INDEX ps_contacts_id ON ps_contacts (id);
CREATE INDEX ps_contacts_qualifyfreq_exp ON ps_contacts (qualify_frequency,expiration_time);
-- SQLINES LICENSE FOR EVALUATION USE ONLY
CREATE TABLE ps_domain_aliases (
id varchar(40) NOT NULL,
domain varchar(80) DEFAULT NULL
) ;
CREATE INDEX ps_domain_aliases_id ON ps_domain_aliases (id);
-- SQLINES LICENSE FOR EVALUATION USE ONLY
CREATE TABLE ps_endpoint_id_ips (
id varchar(40) NOT NULL,
endpoint varchar(40) DEFAULT NULL,
match varchar(80) DEFAULT NULL
) ;
CREATE INDEX ps_endpoint_id_ips_id ON ps_endpoint_id_ips (id);
-- SQLINES LICENSE FOR EVALUATION USE ONLY
CREATE TABLE ps_endpoints (
id varchar(40) NOT NULL,
transport varchar(40) DEFAULT NULL,
aors varchar(200) DEFAULT NULL,
auth varchar(40) DEFAULT NULL,
context varchar(40) DEFAULT NULL,
disallow varchar(200) DEFAULT NULL,
allow varchar(200) DEFAULT NULL,
direct_media yorn DEFAULT NULL,
connected_line_method inreup DEFAULT NULL,
direct_media_method inreup DEFAULT NULL,
direct_media_glare_mitigation noouin DEFAULT NULL,
disable_direct_media_on_nat yorn DEFAULT NULL,
dtmf_mode dtmf_md DEFAULT NULL,
external_media_address varchar(40) DEFAULT NULL,
force_rport yorn DEFAULT NULL,
ice_support yorn DEFAULT NULL,
identify_by ind_by DEFAULT NULL,
mailboxes varchar(40) DEFAULT NULL,
moh_suggest varchar(40) DEFAULT NULL,
outbound_auth varchar(40) DEFAULT NULL,
outbound_proxy varchar(40) DEFAULT NULL,
rewrite_contact yorn DEFAULT NULL,
rtp_ipv6 yorn DEFAULT NULL,
rtp_symmetric yorn DEFAULT NULL,
send_diversion yorn DEFAULT NULL,
send_pai yorn DEFAULT NULL,
send_rpid yorn DEFAULT NULL,
timers_min_se int DEFAULT NULL,
timers timers_mode DEFAULT NULL,
timers_sess_expires int DEFAULT NULL,
callerid varchar(40) DEFAULT NULL,
callerid_privacy allow_prohib_un DEFAULT NULL,
callerid_tag varchar(40) DEFAULT NULL,
"100rel" rel_mode DEFAULT NULL,
aggregate_mwi yorn DEFAULT NULL,
trust_id_inbound yorn DEFAULT NULL,
trust_id_outbound yorn DEFAULT NULL,
use_ptime yorn DEFAULT NULL,
use_avpf yorn DEFAULT NULL,
media_encryption media_encryption_mode DEFAULT NULL,
inband_progress yorn DEFAULT NULL,
call_group varchar(40) DEFAULT NULL,
pickup_group varchar(40) DEFAULT NULL,
named_call_group varchar(40) DEFAULT NULL,
named_pickup_group varchar(40) DEFAULT NULL,
device_state_busy_at int DEFAULT NULL,
fax_detect yorn DEFAULT NULL,
t38_udptl yorn DEFAULT NULL,
t38_udptl_ec t38_udptl_ec_mode DEFAULT NULL,
t38_udptl_maxdatagram int DEFAULT NULL,
t38_udptl_nat yorn DEFAULT NULL,
t38_udptl_ipv6 yorn DEFAULT NULL,
tone_zone varchar(40) DEFAULT NULL,
language varchar(40) DEFAULT NULL,
one_touch_recording yorn DEFAULT NULL,
record_on_feature varchar(40) DEFAULT NULL,
record_off_feature varchar(40) DEFAULT NULL,
rtp_engine varchar(40) DEFAULT NULL,
allow_transfer yorn DEFAULT NULL,
allow_subscribe yorn DEFAULT NULL,
sdp_owner varchar(40) DEFAULT NULL,
sdp_session varchar(40) DEFAULT NULL,
tos_audio varchar(10) DEFAULT NULL,
tos_video varchar(10) DEFAULT NULL,
sub_min_expiry int DEFAULT NULL,
from_domain varchar(40) DEFAULT NULL,
from_user varchar(40) DEFAULT NULL,
mwi_from_user varchar(40) DEFAULT NULL,
dtls_verify varchar(40) DEFAULT NULL,
dtls_rekey varchar(40) DEFAULT NULL,
dtls_cert_file varchar(200) DEFAULT NULL,
dtls_private_key varchar(200) DEFAULT NULL,
dtls_cipher varchar(200) DEFAULT NULL,
dtls_ca_file varchar(200) DEFAULT NULL,
dtls_ca_path varchar(200) DEFAULT NULL,
dtls_setup dtls_setup_mode DEFAULT NULL,
srtp_tag_32 yorn DEFAULT NULL,
media_address varchar(40) DEFAULT NULL,
redirect_method redirect_method_mode DEFAULT NULL,
set_var text,
cos_audio int DEFAULT NULL,
cos_video int DEFAULT NULL,
message_context varchar(40) DEFAULT NULL,
force_avp yorn DEFAULT NULL,
media_use_received_transport yorn DEFAULT NULL,
accountcode varchar(80) DEFAULT NULL,
user_eq_phone yorn DEFAULT NULL,
moh_passthrough yorn DEFAULT NULL,
media_encryption_optimistic yorn DEFAULT NULL,
rpid_immediate yorn DEFAULT NULL,
g726_non_standard yorn DEFAULT NULL,
rtp_keepalive int DEFAULT NULL,
rtp_timeout int DEFAULT NULL,
rtp_timeout_hold int DEFAULT NULL,
bind_rtp_to_media_address yorn DEFAULT NULL,
voicemail_extension varchar(40) DEFAULT NULL,
mwi_subscribe_replaces_unsolicited int DEFAULT NULL,
deny varchar(95) DEFAULT NULL,
permit varchar(95) DEFAULT NULL,
acl varchar(40) DEFAULT NULL,
contact_deny varchar(95) DEFAULT NULL,
contact_permit varchar(95) DEFAULT NULL,
contact_acl varchar(40) DEFAULT NULL,
subscribe_context varchar(40) DEFAULT NULL,
fax_detect_timeout int DEFAULT NULL,
contact_user varchar(80) DEFAULT NULL,
asymmetric_rtp_codec yorn DEFAULT NULL
);
CREATE INDEX ps_endpoint_id ON ps_endpoints (id);
-- SQLINES LICENSE FOR EVALUATION USE ONLY
CREATE TABLE ps_globals (
id varchar(40) NOT NULL,
max_forwards int DEFAULT NULL,
user_agent varchar(255) DEFAULT NULL,
default_outbound_endpoint varchar(40) DEFAULT NULL,
debug varchar(40) DEFAULT NULL,
endpoint_identifier_order varchar(40) DEFAULT NULL,
max_initial_qualify_time int DEFAULT NULL,
default_from_user varchar(80) DEFAULT NULL,
keep_alive_interval int DEFAULT NULL,
regcontext varchar(80) DEFAULT NULL,
contact_expiration_check_interval int DEFAULT NULL,
default_voicemail_extension varchar(40) DEFAULT NULL,
disable_multi_domain yorn DEFAULT NULL,
unidentified_request_count int DEFAULT NULL,
unidentified_request_period int DEFAULT NULL,
unidentified_request_prune_interval int DEFAULT NULL,
default_realm varchar(40) DEFAULT NULL,
mwi_tps_queue_high int DEFAULT NULL,
mwi_tps_queue_low int DEFAULT NULL,
mwi_disable_initial_unsolicited yorn DEFAULT NULL,
ignore_uri_user_options yorn DEFAULT NULL
) ;
CREATE INDEX ps_globals_id ON ps_globals (id);
-- SQLINES LICENSE FOR EVALUATION USE ONLY
CREATE TABLE ps_registrations (
id varchar(40) NOT NULL,
auth_rejection_permanent yorn DEFAULT NULL,
client_uri varchar(255) DEFAULT NULL,
contact_user varchar(40) DEFAULT NULL,
expiration int DEFAULT NULL,
max_retries int DEFAULT NULL,
outbound_auth varchar(40) DEFAULT NULL,
outbound_proxy varchar(40) DEFAULT NULL,
retry_interval int DEFAULT NULL,
forbidden_retry_interval int DEFAULT NULL,
server_uri varchar(255) DEFAULT NULL,
transport varchar(40) DEFAULT NULL,
support_path yorn DEFAULT NULL,
fatal_retry_interval int DEFAULT NULL,
line yorn DEFAULT NULL,
endpoint varchar(40) DEFAULT NULL
) ;
CREATE INDEX ps_registrations_id ON ps_registrations (id);
-- SQLINES LICENSE FOR EVALUATION USE ONLY
CREATE TABLE ps_subscription_persistence (
id varchar(40) NOT NULL,
packet varchar(2048) DEFAULT NULL,
src_name varchar(128) DEFAULT NULL,
src_port int DEFAULT NULL,
transport_key varchar(64) DEFAULT NULL,
local_name varchar(128) DEFAULT NULL,
local_port int DEFAULT NULL,
cseq int DEFAULT NULL,
tag varchar(128) DEFAULT NULL,
endpoint varchar(40) DEFAULT NULL,
expires int DEFAULT NULL
) ;
CREATE INDEX ps_subscription_persistence_id ON ps_subscription_persistence (id);
-- SQLINES LICENSE FOR EVALUATION USE ONLY
CREATE TABLE ps_systems (
id varchar(40) NOT NULL,
timer_t1 int DEFAULT NULL,
timer_b int DEFAULT NULL,
compact_headers yorn DEFAULT NULL,
threadpool_initial_size int DEFAULT NULL,
threadpool_auto_increment int DEFAULT NULL,
threadpool_idle_timeout int DEFAULT NULL,
threadpool_max_size int DEFAULT NULL,
disable_tcp_switch yorn DEFAULT NULL
) ;
CREATE INDEX ps_systems_id ON ps_systems (id);
-- SQLINES LICENSE FOR EVALUATION USE ONLY
CREATE TABLE ps_transports (
id varchar(40) NOT NULL,
async_operations int DEFAULT NULL,
bind varchar(40) DEFAULT NULL,
ca_list_file varchar(200) DEFAULT NULL,
cert_file varchar(200) DEFAULT NULL,
cipher varchar(200) DEFAULT NULL,
domain varchar(40) DEFAULT NULL,
external_media_address varchar(40) DEFAULT NULL,
external_signaling_address varchar(40) DEFAULT NULL,
external_signaling_port int DEFAULT NULL,
method transport_method_mode DEFAULT NULL,
local_net varchar(40) DEFAULT NULL,
password varchar(40) DEFAULT NULL,
priv_key_file varchar(200) DEFAULT NULL,
protocol protocol_mode DEFAULT NULL,
require_client_cert yorn DEFAULT NULL,
verify_client yorn DEFAULT NULL,
verify_server yorn DEFAULT NULL,
tos varchar(10) DEFAULT NULL,
cos int DEFAULT NULL,
allow_reload yorn DEFAULT NULL
);
CREATE INDEX ps_transports_id ON ps_transports (id);