~singpolyma/cheogram-sip

5736d57283f4d6163df63500fe9bb4dce258bb48 — Thilo Molitor 5 months ago 14a10d1 master
Activate ICE and add google STUN to detect server's external IP
4 files changed, 12 insertions(+), 4 deletions(-)

M asterisk-conf/motif.conf
A asterisk-conf/rtp.conf
M docker/Dockerfile
M docker/entrypoint.sh
M asterisk-conf/motif.conf => asterisk-conf/motif.conf +2 -4
@@ 1,12 1,10 @@
[default](!)
disallow=all
allow=ulaw
allow=vp8
allow=all
context=incoming-motif ; Default context that incoming sessions will land in

[jingle-endpoint](default)
context=jingle
transport=ice-udp              ; Change the default protocol of outgoing sessions to Jingle ICE-UDP
allow=g722                     ; Add G.722 as an allowed format since the other side may support it
allow=all                     ; Add G.722 as an allowed format since the other side may support it
connection=asterisk            ; Connection to accept traffic on and send traffic out
accountcode=jingle             ; Account code for CDR purposes

A asterisk-conf/rtp.conf => asterisk-conf/rtp.conf +8 -0
@@ 0,0 1,8 @@
[general]
rtpstart=10000
rtpend=20000

icesupport=true
stunaddr=stun.l.google.com:19302

[ice_host_candidates]

M docker/Dockerfile => docker/Dockerfile +1 -0
@@ 43,6 43,7 @@ RUN apt-get update \
 && rm -rf /var/cache /root/asterisk*.deb

COPY --from=cheogram-sip /opt/cheogram-sip/asterisk-conf/motif.conf /etc/asterisk/motif.conf
COPY --from=cheogram-sip /opt/cheogram-sip/asterisk-conf/rtp.conf /etc/asterisk/rtp.conf
COPY --from=cheogram-sip /opt/cheogram-sip/asterisk-conf/xmpp.conf /etc/asterisk/xmpp.conf
COPY --from=cheogram-sip /opt/cheogram-sip/asterisk-conf/extensions.lua /etc/asterisk/extensions.lua


M docker/entrypoint.sh => docker/entrypoint.sh +1 -0
@@ 5,6 5,7 @@ sed -i "s/^port=.*/port=$CONNECT_PORT/" /etc/asterisk/xmpp.conf
sed -i "s/^username=.*/username=$ASTERISK_COMPONENT_DOMAIN/" /etc/asterisk/xmpp.conf
sed -i "s/sip.cheogram.com/$COMPONENT_DOMAIN/g" /etc/asterisk/extensions.lua
sed -i "s/^secret=.*/secret=$ASTERISK_COMPONENT_SECRET/" /etc/asterisk/xmpp.conf
sed -i "/^; icesupport = yes/icesupport = yes" /etc/asterisk/sip.conf
if [ -n "$SIP_HOST" ]; then
	 if ! grep "@$SIP_HOST" /etc/asterisk/sip.conf; then
		sed -i "/^;register => 1234/a register => $SIP_USER:$SIP_PASSWORD@$SIP_HOST/\"$SIP_JID\"" /etc/asterisk/sip.conf