Asterisk in Docker: Difference between revisions

From Wildsong
Jump to navigationJump to search
Brian Wilson (talk | contribs)
Brian Wilson (talk | contribs)
 
(13 intermediate revisions by the same user not shown)
Line 6: Line 6:


I used with the github respoke/asterisk image as my starting point.
I used with the github respoke/asterisk image as my starting point.
git clone [email protected]:respoke/asterisk-docker.git
Then I broke respoke's image out into two parts, so that it would build faster.
Then I broke respoke's image out into two parts, so that it would build faster.


Currently I work logged into Bellman.
Currently I work logged into Bellman.


I have a Debian Stretch container wildsong/build that has all the
I have a Debian Stretch container that has all the
tools in it, when the container builds it downloads sources and  
tools in it, and when the container builds it downloads sources and  
configures and compiles them.
configures and compiles them.


  cd source/docker/docker-build
  cd source/docker
git clone [email protected]:brian32768/docker-build-asterisk.git build-asterisk
cd source/docker/build-asterisk
docker build -t build-asterisk .


Once the 'build' container is working, check in changes to github and a new copy
Once the 'build' container is working, check in changes to github and a new copy
will build at hub.docker.com.
will autobuild at hub.docker.com.


== Configuration ==
== Configuration ==


Put environment settings into Dockerfile and add j2 config files that I created for [[Fogg]].
Put environment settings into Dockerfile and add j2 config files that I created for [[Vastra]].
 
I decided today (3/2/2019) that pjsip is not the greatest thing ever and went back to using chan_sip.


The configuration is entirely file based because my home phone system is relatively static.
The configuration is entirely file based because my home phone system is relatively static.
Making it file based means the whole config can be baked into the Docker image.


The docker-asterisk container configures Asterisk based on templates
The docker-asterisk container configures Asterisk based on templates
Line 36: Line 39:
  ''edit files''
  ''edit files''
  cd ..
  cd ..
  docker rm -f asterisk
  docker rm -f asterisk-wildsong
  docker build -t asterisk .
  docker build -t asterisk-wildsong .


== Launch server ==
== Launch server ==
Line 51: Line 54:
== Testing ==
== Testing ==


=== Outside call ===
=== Outside calls via Twilio ===


Call from PSTN to 707-827-0001
Call from PSTN (mobile) to 707-827-0001
or use the Twilio service to test call.
* Is it being logged at Twilio? '''YES'''
* Is it being logged at Twilio? '''YES'''
* Can I see the connection attempt in the Asterisk console? '''No'''
* Two way audio? '''YES'''
** Can I see the connection attempt being forwarded through the firewall? '''Don't know yet'''
 
* Two way audio?
Call out from a GXV3240 to the mobile. '''WORKS!'''
* TODO Set up SMS and MMS message gateways???
 
TODO Set up SMS and MMS message gateways???


=== Inside call, to PBX ===
=== Inside call, to PBX ===
Line 70: Line 75:


* 100 Ring all phones
* 100 Ring all phones
* 101 Office phone
* 101 Studio phone 192.168.123.80 on wire
* 102 eLab phone
* 102 eLab phone 192.168.123.76 on WIFI
* 850 voice mail
* 850 voice mail


* TODO -- GET SMART PHONE set up.
* Call to voice mail '''works'''.
* Calling station to station '''works'''.
* Video calling '''works'''.
 
* TODO -- GET SMART PHONE set up. Currently it fails to register
[Nov  6 06:56:21] NOTICE[262]: res_pjsip/pjsip_distributor.c:659 log_failed_request: Request 'REGISTER' from '<sip:[email protected]>' failed for '192.168.123.207:13411' (callid: [email protected]) - Failed to authenticate
[Nov  6 06:56:21] NOTICE[262]: res_pjsip/pjsip_distributor.c:659 log_failed_request: Request 'REGISTER' from '<sip:[email protected]>' failed for '192.168.123.207:13411' (callid: [email protected]) - No matching endpoint found
 
=== Voicemail ===
 
Logins fail with this error.
[Nov  6 06:54:09] WARNING[294][C-00000008]: app_voicemail.c:11191 vm_authenticate: Couldn't read username
 
I got it set right finally... not sure which change did it. I did have to tell the phone to send number 100.


== Intercom calling ==
== Intercom calling ==


TODO
I tried MulticastRTP paging. Asterisk did not understand what that was.
 
I tried using one registration on the phone and sending "Auto answer = 0" in the sip header
and it almost worked.
 
I ended up having each phone register on two separate lines, one normal and one set to auto-answer and start in video mode.
 
Dial 500


== Console ==
== Console ==
Line 99: Line 124:




[[Category: VOIP]]
[[Category: Telephones]]
[[Category: Docker]]

Latest revision as of 15:48, 31 August 2022

Read the Docker page if you don't know what Docker is.

Notes on building a current executable, the old way: Building Asterisk

Building a docker container

I used with the github respoke/asterisk image as my starting point. Then I broke respoke's image out into two parts, so that it would build faster.

Currently I work logged into Bellman.

I have a Debian Stretch container that has all the tools in it, and when the container builds it downloads sources and configures and compiles them.

cd source/docker
git clone [email protected]:brian32768/docker-build-asterisk.git build-asterisk
cd source/docker/build-asterisk
docker build -t build-asterisk .

Once the 'build' container is working, check in changes to github and a new copy will autobuild at hub.docker.com.

Configuration

Put environment settings into Dockerfile and add j2 config files that I created for Vastra.

I decided today (3/2/2019) that pjsip is not the greatest thing ever and went back to using chan_sip.

The configuration is entirely file based because my home phone system is relatively static. Making it file based means the whole config can be baked into the Docker image.

The docker-asterisk container configures Asterisk based on templates in etc_asterisk.

cd source/docker/docker-asterisk
edit Dockerfile to adjust environment
cd etc_asterisk
edit files
cd ..
docker rm -f asterisk-wildsong
docker build -t asterisk-wildsong .

Launch server

Using the --net=host option is not a best practice because it exposes every port running on the docker machine. It means it looks like Asterisk is just running on Bellman, not inside a container.

docker run -d --net=host --name=asterisk asterisk

I don't think I need any -p port mappings or --expose if I use --net=host, and though it's not "best practices" it will make Asterisk networking problems go away pretty much.

Testing

Outside calls via Twilio

Call from PSTN (mobile) to 707-827-0001 or use the Twilio service to test call.

  • Is it being logged at Twilio? YES
  • Two way audio? YES

Call out from a GXV3240 to the mobile. WORKS!

TODO Set up SMS and MMS message gateways???

Inside call, to PBX

  • Press voicemail button. Does prompt come back? YES
    • TODO -- I want it configured to bypass the user/pass prompt.

Inside call, station to station

I have two stations registering right now, the GXV phones.

  • 100 Ring all phones
  • 101 Studio phone 192.168.123.80 on wire
  • 102 eLab phone 192.168.123.76 on WIFI
  • 850 voice mail
  • Call to voice mail works.
  • Calling station to station works.
  • Video calling works.
  • TODO -- GET SMART PHONE set up. Currently it fails to register
[Nov  6 06:56:21] NOTICE[262]: res_pjsip/pjsip_distributor.c:659 log_failed_request: Request 'REGISTER' from '<sip:[email protected]>' failed for '192.168.123.207:13411' (callid: [email protected]) - Failed to authenticate
[Nov  6 06:56:21] NOTICE[262]: res_pjsip/pjsip_distributor.c:659 log_failed_request: Request 'REGISTER' from '<sip:[email protected]>' failed for '192.168.123.207:13411' (callid: [email protected]) - No matching endpoint found

Voicemail

Logins fail with this error.

[Nov  6 06:54:09] WARNING[294][C-00000008]: app_voicemail.c:11191 vm_authenticate: Couldn't read username

I got it set right finally... not sure which change did it. I did have to tell the phone to send number 100.

Intercom calling

I tried MulticastRTP paging. Asterisk did not understand what that was.

I tried using one registration on the phone and sending "Auto answer = 0" in the sip header and it almost worked.

I ended up having each phone register on two separate lines, one normal and one set to auto-answer and start in video mode.

Dial 500

Console

You can connect to the Asterisk console directly with this command

docker exec -it asterisk asterisk -r

Or you can connect the usual way via a bash shell

docker exec -it asterisk bash
tcpdump -n not port 22 and not arp and not host 192.168.123.159

Connected phones

I don't know how to see what phones are registered with pjsip!??

I started a separate page for it, PJSIP.