Public Repository

Last pushed: 2 years ago
Short Description
Dockwilio is a Docker container for Twilio operation. (ver.2016.03.19)
Full Description

ver.2016.03.19 released.

== Dockwilio ==

Dockwilio is a Docker container for Twilio operation.
This container has 2 functions.

  • Requesting Twilio REST API to create a call.
  • TwiML server accessed by Twilio for request above.

The merit is that you don’t have to run 2 modules to make a call.
At this version, Dockwilio provides single <Say> verb only.
The container image is based on centos6. 2 nginx processes runs in it.

== Provisioning ==

  • Open inbound port for TwiML access.

# iptables -A INPUT -p tcp -m tcp --dport 443 -j ACCEPT

  • Create a Dockwilio configuration file “dwilio.conf”.
    Configuration file have to be written in YAML format.

(Example)
account_sid: ACxxxxxxxxxxxx
auth_token: xxxxxxxxxxxxx
from: +8150xxxxxxxx
twiml_url_base: https://hostname.example:443/
syslog_facility: local0
twiml_ssl_crt: fullchain.pem
twiml_ssl_key: privkey.pem

(Parameters)
account_sid: Account SID. [essential]
auth_token: Auth Token. [essential]
from: Caller telephone Number.
twiml_url_base: URL for the host(doesn’t include file path). [essential]
basic_user: User name for BASIC authentication. [default: no authentication]
basic_password: Password for BASIC authentication. [default: no authentication]
call_timeout: Seconds before assuming there is no answer. [default: 60]
language: Language parameter for <Say> verb. [default: ja-JP]
voice: Voice parameter for <Say> verb. [default: alice]
syslog_facility: Syslog facility. [essential]
twiml_ssl_crt: SSL CERTIFICATE file name for TwiML access(ex. "fullchain.pem"). [essential]
twiml_ssl_key: SSL KEY file name for TwiML access(ex. "privkey.pem"). [essential]
debug: Debug flag. [default: false]
(SSL CERTIFICATE and KEY files have to be placed in a directory same as configuration file.
When the files are updated, dockwilio reloads them in 10 minutes.)

== Starting Dockwilio container ==
The container is resident until you stop it explicitly.

(Example)
# docker run -d -p 443:443 -v /dockwilio_config_dir:/etc/dockwilio:ro -v /etc/localtime:/etc/localtime:ro --name dwilio emerry/dockwilio

/dockwilio_config_dir - A directory which Dockwilio configuration file, SSL CERTIFICATE and SSL KEY are placed in.

IP address of the container is logged to syslog(local0.info).

(Example)
Nov 22 11:32:20 4acb42090932 logger: IP address of Dockwilio: inet 172.17.0.51/16 scope global eth0

== Creating a call and say message ==

  • POST telephone number and message to Dockwilio’s HTTP(TCP 80) port.
    It returns when the call has completed.
  • It accepts YAML and JSON format.

(Example in YAML)

$ ls -l post_data.yaml
-rw-r--r-- 1 user users 49 Nov 21 12:59 2015 post_data.yaml

$ cat post_data.yaml
to: +8180xxxxxxxx
say: Hello. How are you doing?

$ curl -XPOST http://172.17.0.51/say.yaml -H 'Content-length: 49' --data-binary @post_data.yaml
code: 0
status: completed
message:

(Example in JSON)

$ ls -l post_data.json
-rw-r--r-- 1 user users 62 Nov 21 13:06 post_data.json

$ cat post_data.json
{
"to": "+818046684833",
"say": "Hello. How are you doing?"
}

$ curl -XPOST http://172.17.0.51/say.json -H 'Content-length: 62' --data-binary @post_data.json
{“code”:”0”,”status”:”completed”,”message”:””}

(Parameters)
to: Telephone number to call. [essensial]
say: Message to be synthesized. [essensial]
(Parameters below are override dwilio.conf ones)
from: Caller telephone Number.
twiml_url_base: URL for the host.
call_timeout: Seconds before assuming there is no answer. [default: 60]
language: Language parameter for <Say> verb.
voice: Voice parameter for <Say> verb.
syslog_facility: Syslog facility.
debug: Debug flag.

(Return)
code: 0, status: completed
code: 1, busy, no-answer
code: -1
status: canceled, failed
or message: Service_Twilio_RestException
code: other(Twilio error code)

== Change log ==

ver.2016,03.19
When SSL CERTIFICATE and KEY files are updated, dockwilio reloads them in 10 minutes.)

.

Docker Pull Command
Owner
emerry