; ═══════════════════════════════════════════════════════════════════════════════
; /etc/asterisk/pjsip.conf — Trunk Zadarma + poste local WebRTC
; ═══════════════════════════════════════════════════════════════════════════════

; ─── Transport UDP (SIP classique vers Zadarma) ──────────────────────────────
[transport-udp]
type      = transport
protocol  = udp
bind      = 0.0.0.0:5060

; ─── Transport WebSocket (pour le softphone navigateur) ──────────────────────
[transport-wss]
type      = transport
protocol  = wss
bind      = 0.0.0.0:8089

; ═══════════════════════════════════════════════════════════════════════════════
; TRUNK ZADARMA
; ═══════════════════════════════════════════════════════════════════════════════

[zadarma-registration]
type     = registration
transport = transport-udp
outbound_auth = zadarma-auth
server_uri = sip:pbx.zadarma.com
client_uri = sip:549318-100@pbx.zadarma.com
retry_interval = 60
expiration = 120
contact_user = 549318-100

[zadarma-auth]
type     = auth
auth_type = userpass
username  = 549318-100
password  = PYnhls64TY

[zadarma-aor]
type             = aor
contact          = sip:pbx.zadarma.com
qualify_frequency = 30

[zadarma]
type              = endpoint
transport         = transport-udp
context           = from-zadarma
disallow          = all
allow             = ulaw,alaw,g729,g722
outbound_auth     = zadarma-auth
aors              = zadarma-aor
from_user         = 549318-100
from_domain       = pbx.zadarma.com
send_rpid         = yes
send_pai          = yes
callerid          = "Softphone" <549318-100>

; ═══════════════════════════════════════════════════════════════════════════════
; SOFTPHONE WEB (WebRTC via navigateur)
; ═══════════════════════════════════════════════════════════════════════════════

[softphone-auth]
type     = auth
auth_type = userpass
username  = softphone
password  = webrtc1234

[softphone-aor]
type             = aor
max_contacts     = 5
remove_existing  = yes

[softphone]
type              = endpoint
transport         = transport-wss
context           = from-softphone
disallow          = all
allow             = opus,ulaw,alaw,g722
auth              = softphone-auth
aors              = softphone-aor
webrtc            = yes
use_avpf          = yes
media_encryption  = dtls
dtls_verify       = fingerprint
dtls_setup        = actpass
ice_support       = yes
media_use_received_transport = yes
rtcp_mux          = yes
callerid          = "Softphone Web" <549318-100>
