2019-01-01 22:34:16 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
SIP_SERVER=${SIP_SERVER:-127.0.0.1}
|
|
|
|
SIP_USER=${SIP_USER:-user}
|
|
|
|
SIP_PASS=${SIP_PASS:-user}
|
|
|
|
EXTERNAL_IP=${EXTERNAL_IP:-127.0.0.1}
|
|
|
|
|
|
|
|
cat >/etc/asterisk/pjsip.conf <<EOF
|
|
|
|
[mytransport]
|
|
|
|
type=transport
|
|
|
|
protocol=udp
|
|
|
|
bind=0.0.0.0
|
|
|
|
; localnet=172.17.0.0/16
|
|
|
|
external_media_address=${EXTERNAL_IP}
|
2022-06-28 15:53:21 +00:00
|
|
|
external_signaling_address=${EXTERNAL_IP}
|
2019-01-01 22:34:16 +00:00
|
|
|
|
|
|
|
[mytrunk]
|
|
|
|
type=registration
|
|
|
|
transport=mytransport
|
|
|
|
outbound_auth=mytrunk
|
|
|
|
server_uri=sip:${SIP_SERVER}:5060
|
|
|
|
client_uri=sip:${SIP_USER}@${SIP_SERVER}:5060
|
2022-06-28 15:53:21 +00:00
|
|
|
|
2019-01-01 22:34:16 +00:00
|
|
|
[mytrunk]
|
|
|
|
type=auth
|
|
|
|
auth_type=userpass
|
|
|
|
password=${SIP_PASS}
|
|
|
|
username=${SIP_USER}
|
2022-06-28 15:53:21 +00:00
|
|
|
|
2019-01-01 22:34:16 +00:00
|
|
|
[mytrunk]
|
|
|
|
type=aor
|
|
|
|
contact=sip:${SIP_SERVER}:5060
|
2022-06-28 15:53:21 +00:00
|
|
|
|
2019-01-01 22:34:16 +00:00
|
|
|
[mytrunk]
|
|
|
|
type=endpoint
|
|
|
|
context=incoming-calls
|
|
|
|
disallow=all
|
|
|
|
allow=speex,g726,g722,ilbc,gsm,alaw
|
|
|
|
outbound_auth=mytrunk
|
|
|
|
aors=mytrunk
|
2022-06-28 15:53:21 +00:00
|
|
|
|
2019-01-01 22:34:16 +00:00
|
|
|
[mytrunk]
|
|
|
|
type=identify
|
|
|
|
endpoint=mytrunk
|
|
|
|
match=${SIP_SERVER}
|
|
|
|
EOF
|
|
|
|
|
2022-06-28 15:53:21 +00:00
|
|
|
/usr/sbin/asterisk -cv
|