Migrate to remco

master
informatic 2020-04-12 19:33:33 +02:00
parent a972571edc
commit 06f1dac788
6 changed files with 55 additions and 17 deletions

View File

@ -1,12 +1,16 @@
FROM dougbtv/asterisk14
RUN yum install -y perl-Digest-MD5 perl-libwww-perl perl-LWP-Protocol-https sox mpg123 which python-pip
RUN yum install -y perl-Digest-MD5 perl-libwww-perl perl-LWP-Protocol-https sox mpg123 which python-pip wget unzip
RUN pip install pyst2==0.5.0
RUN curl -L https://github.com/kelseyhightower/confd/releases/download/v0.15.0/confd-0.15.0-linux-amd64 > /usr/local/bin/confd && chmod +x /usr/local/bin/confd
ENV REMCO_VER 0.11.1
RUN wget https://github.com/HeavyHorst/remco/releases/download/v${REMCO_VER}/remco_${REMCO_VER}_linux_amd64.zip && \
unzip remco_${REMCO_VER}_linux_amd64.zip && rm remco_${REMCO_VER}_linux_amd64.zip && \
mv remco_linux /bin/remco
COPY conf/*.conf /etc/asterisk/
COPY conf/*.conf.tmpl /etc/confd/templates/
COPY conf/*.conf.toml /etc/confd/conf.d/
COPY agi/* /var/lib/asterisk/agi-bin/
CMD confd -onetime -backend env && asterisk -fvv
COPY remco.config /etc/remco/config
COPY conf/*.conf.tmpl /etc/remco/templates/
ENTRYPOINT ["remco"]

View File

@ -4,3 +4,7 @@ exten => s,1,Answer()
same => n,Monitor(wav,rec-${STRFTIME(${EPOCH},,%d%m%Y-%H:%M:%S)}-${CALLERID(num)})
same => n,agi(googletts.agi,"This is BGP.WTF abuse phone number. This call will be recorded.",en)
same => n,agi(phonetab.agi,/etc/asterisk/phonetab)
[internal]
exten => s,1,Answer()
same => n,agi(googletts.agi,"Oh shit what up",en)

View File

@ -1,7 +1,8 @@
[general]
context=sip
nat=force_rport,comedia
register => {{getv "/asterisk/trunk/username"}}:{{getv "/asterisk/trunk/secret"}}@sip.2call.pl
allowguest=no
register => {{ getv ("/asterisk/trunk/username") }}:{{ getv ("/asterisk/trunk/secret") }}@sip.2call.pl
[trunk-out]
type=friend
@ -17,9 +18,16 @@ qualify=no
fromdomain=sip.2call.pl
host=sip.2call.pl
defaultuser={{getv "/asterisk/trunk/username"}}
fromuser={{getv "/asterisk/trunk/username"}}
username={{getv "/asterisk/trunk/username"}}
user={{getv "/asterisk/trunk/username"}}
defaultuser={{ getv ("/asterisk/trunk/username") }}
fromuser={{ getv ("/asterisk/trunk/username") }}
username={{ getv ("/asterisk/trunk/username") }}
user={{ getv ("/asterisk/trunk/username") }}
secret={{ getv ("/asterisk/trunk/secret") }}
secret={{getv "/asterisk/trunk/secret"}}
{% for client in ls("/peers") %}
[{{ client }}]
type=peer
host=dynamic
secret={{ getv(printf("/peers/%s", client)) }}
context=internal
{% endfor %}

View File

@ -1,6 +0,0 @@
[template]
src = "sip.conf.tmpl"
dest = "/etc/asterisk/sip.conf"
keys = [
"/asterisk",
]

View File

@ -25,3 +25,4 @@ services:
volumes:
- "./phonetab:/etc/asterisk/phonetab"
- "./moh:/var/lib/asterisk/moh"
- "./peers.yml:/etc/asterisk/peers.yml:ro"

27
remco.config Normal file
View File

@ -0,0 +1,27 @@
log_level = "debug"
log_format = "text"
[[resource]]
name = "asterisk"
[resource.exec]
command = "/usr/sbin/asterisk -fvv"
kill_signal = "SIGTERM"
reload_signal = "SIGHUP"
kill_timeout = 10
splay = 10
[[resource.template]]
src = "/etc/remco/templates/sip.conf.tmpl"
dst = "/etc/asterisk/sip.conf"
reload_cmd = "if [[ -e /var/run/asterisk/asterisk.ctl ]]; then asterisk -rx reload ; fi"
[resource.backend]
[resource.backend.file]
filepath = "/etc/asterisk/peers.yml"
watch = true
interval = 5
keys = ["/peers", "/asterisk"]
[resource.backend.env]
keys = ["/asterisk"]