Skip to content

Instantly share code, notes, and snippets.

@dougbtv
Last active January 24, 2021 11:02
Show Gist options
  • Save dougbtv/3e8fc88cc96d527070d14a3fe6b41dd8 to your computer and use it in GitHub Desktop.
Save dougbtv/3e8fc88cc96d527070d14a3fe6b41dd8 to your computer and use it in GitHub Desktop.
docker-asterisk running with a default user
[doug@talos ~]$ cd /tmp/
[doug@talos tmp]$ git clone https://github.com/dougbtv/docker-asterisk.git
Cloning into 'docker-asterisk'...
[...snipped...]
[doug@talos tmp]$ cd docker-asterisk/
[doug@talos docker-asterisk]$ docker pull dougbtv/asterisk
[doug@talos docker-asterisk]$ docker run --name asterisk -h asterisk -p 5060:5060/udp -p 10001:10001/udp -v $(pwd)/sip.conf:/etc/asterisk/sip.conf -v $(pwd)/rtp.conf:/etc/asterisk/rtp.conf -v $(pwd)/iax.conf:/etc/asterisk/iax.conf -d -t dougbtv/asterisk
00a500240382cc4b9263b4f7b1fc3a0c8115c848634eec21b3fed3f0b8977b68
[doug@talos docker-asterisk]$
[doug@talos docker-asterisk]$
[doug@talos docker-asterisk]$ docker exec -it asterisk /bin/bash
[root@asterisk /]# echo "hello world"
hello world
[root@asterisk /]# exit
exit
[doug@talos docker-asterisk]$ docker run \
> --name asterisk \
> -h asterisk \
> -p 5060:5060/udp \
> -p 10001:10001/udp \
> -v $(pwd)/sip.conf:/etc/asterisk/sip.conf \
> -v $(pwd)/rtp.conf:/etc/asterisk/rtp.conf \
> -v $(pwd)/iax.conf:/etc/asterisk/iax.conf \
> -d -t dougbtv/asterisk
bc0ac3e35fbfbf7112b64dfcc462b020127051370fc2381d122822b688b70e14
[doug@talos docker-asterisk]$
[doug@talos docker-asterisk]$
[doug@talos docker-asterisk]$
[doug@talos docker-asterisk]$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
bc0ac3e35fbf dougbtv/asterisk "/bin/sh -c 'asterisk" 7 seconds ago Up 3 seconds 0.0.0.0:5060->5060/udp, 0.0.0.0:10001->10001/udp asterisk
[doug@talos docker-asterisk]$
[doug@talos docker-asterisk]$
[doug@talos docker-asterisk]$
[doug@talos docker-asterisk]$ docker exec -it asterisk asterisk -rvvv
Asterisk 11.6-cert11, Copyright (C) 1999 - 2013 Digium, Inc. and others.
Created by Mark Spencer <[email protected]>
Asterisk comes with ABSOLUTELY NO WARRANTY; type 'core show warranty' for details.
This is free software, with components licensed under the GNU General Public
License version 2 and other licenses; you are welcome to redistribute it under
certain conditions. Type 'core show license' for details.
=========================================================================
Connected to Asterisk 11.6-cert11 currently running on asterisk (pid = 1)
asterisk*CLI>
asterisk*CLI>
asterisk*CLI> sip show pe
peers peer
asterisk*CLI> sip show peers
Name/username Host Dyn Forcerport ACL Port Status Description
theuser/theuser (Unspecified) N 0 Unmonitored
1 sip peers [Monitored: 0 online, 0 offline Unmonitored: 0 online, 1 offline]
asterisk*CLI>
asterisk*CLI>
asterisk*CLI>
asterisk*CLI> iax2 show pe
peer peers
asterisk*CLI> iax2 show peers
Name/Username Host Mask Port Status Description
theuser/theuser (null) (D) 255.255.255.255 0 (E) Unmonitored
1 iax2 peers [0 online, 0 offline, 1 unmonitored]
asterisk*CLI>
asterisk*CLI>
asterisk*CLI> quit
Asterisk cleanly ending (0).
Executing last minute cleanups
[doug@talos docker-asterisk]$
[doug@talos docker-asterisk]$
[doug@talos docker-asterisk]$
[doug@talos docker-asterisk]$ docker stop asterisk && docker rm asterisk
[general]
bandwidth=low
disallow=lpc10 ; Icky sound quality... Mr. Roboto.
jitterbuffer=no
forcejitterbuffer=no
autokill=yes
[theuser]
type=friend
auth=md5
context=insidecaller
trunk=no
secret=makeagoodsecret
defaultuser=theuser
username=theuser
host=dynamic
encryption=yes
requirecalltoken=no
disallow=all
allow=gsm
;
; RTP Configuration
;
[general]
rtpstart=10001
rtpend=10001
# -------------------------------------------------
# put all those files above in your working dir
# -----------------------------------------------
docker run \
--name asterisk \
-h asterisk \
-p 5060:5060/udp \
-p 10001:10001/udp \
-v $(pwd)/sip.conf:/etc/asterisk/sip.conf \
-v $(pwd)/rtp.conf:/etc/asterisk/rtp.conf \
-v $(pwd)/iax.conf:/etc/asterisk/iax.conf \
-d -t dougbtv/asterisk
[doug@talos docker-asterisk]$ docker run -it dougbtv/asterisk /bin/bash
[root@1c0c2a622e2d /]# echo "hello world"
hello world
[root@1c0c2a622e2d /]# ps ax
PID TTY STAT TIME COMMAND
1 ? Ss 0:00 /bin/bash
15 ? R+ 0:00 ps ax
[root@1c0c2a622e2d /]# exit
exit
[general]
alwaysauthreject=yes ; Makes account scanning void.
allowguest=no ; No guests!
context=default ; Default context for incoming calls
allowoverlap=no ; Disable overlap dialing support. (Default is yes)
udpbindaddr=0.0.0.0 ; IP address to bind UDP listen socket to (0.0.0.0 binds to all)
tcpenable=no ; Enable server for incoming TCP connections (default is no)
tcpbindaddr=0.0.0.0 ; IP address for TCP server to bind to (0.0.0.0 binds to all interfaces)
transport=udp ; Set the default transports. The order determines the primary default transport.
bindaddr=0.0.0.0
; ---------------------- Connect another endpoint with this username "theuser"
[theuser]
defaultuser=theuser
fromuser=theuser
type=friend
insecure=invite
; ----------------------- Change this line below
host=ANY_IP_OR_HOSTNAME
port=5060
nat=force_rport,comedia
context=inbound
disallow=all
allow=ulaw
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment