48 lines
848 B
Bash
48 lines
848 B
Bash
#!/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}
|
|
external_signaling_address=${EXTERNAL_IP}
|
|
|
|
[mytrunk]
|
|
type=registration
|
|
transport=mytransport
|
|
outbound_auth=mytrunk
|
|
server_uri=sip:${SIP_SERVER}:5060
|
|
client_uri=sip:${SIP_USER}@${SIP_SERVER}:5060
|
|
|
|
[mytrunk]
|
|
type=auth
|
|
auth_type=userpass
|
|
password=${SIP_PASS}
|
|
username=${SIP_USER}
|
|
|
|
[mytrunk]
|
|
type=aor
|
|
contact=sip:${SIP_SERVER}:5060
|
|
|
|
[mytrunk]
|
|
type=endpoint
|
|
context=incoming-calls
|
|
disallow=all
|
|
allow=speex,g726,g722,ilbc,gsm,alaw
|
|
outbound_auth=mytrunk
|
|
aors=mytrunk
|
|
|
|
[mytrunk]
|
|
type=identify
|
|
endpoint=mytrunk
|
|
match=${SIP_SERVER}
|
|
EOF
|
|
|
|
/usr/sbin/asterisk -cv |