restcomm-ruby 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/AUTHORS.md +38 -0
- data/CHANGES.md +171 -0
- data/Gemfile +11 -0
- data/LICENSE +662 -0
- data/LICENSE.md +19 -0
- data/Makefile +12 -0
- data/README.md +155 -0
- data/Rakefile +10 -0
- data/conf/cacert.pem +3376 -0
- data/docs/Makefile +130 -0
- data/docs/_themes/LICENSE +45 -0
- data/docs/_themes/README.rst +25 -0
- data/docs/_themes/flask_theme_support.py +86 -0
- data/docs/_themes/kr/layout.html +32 -0
- data/docs/_themes/kr/relations.html +19 -0
- data/docs/_themes/kr/static/flasky.css_t +469 -0
- data/docs/_themes/kr/static/small_flask.css +70 -0
- data/docs/_themes/kr/theme.conf +7 -0
- data/docs/_themes/kr_small/layout.html +22 -0
- data/docs/_themes/kr_small/static/flasky.css_t +287 -0
- data/docs/_themes/kr_small/theme.conf +10 -0
- data/docs/changelog.rst +1 -0
- data/docs/conf.py +266 -0
- data/docs/faq.rst +42 -0
- data/docs/getting-started.rst +100 -0
- data/docs/index.rst +109 -0
- data/docs/make.bat +170 -0
- data/docs/src/pip-delete-this-directory.txt +5 -0
- data/docs/usage/accounts.rst +96 -0
- data/docs/usage/addresses.rst +102 -0
- data/docs/usage/applications.rst +111 -0
- data/docs/usage/basics.rst +120 -0
- data/docs/usage/caller-ids.rst +47 -0
- data/docs/usage/conferences.rst +112 -0
- data/docs/usage/errors.rst +31 -0
- data/docs/usage/messages.rst +142 -0
- data/docs/usage/notifications.rst +72 -0
- data/docs/usage/phone-calls.rst +193 -0
- data/docs/usage/phone-numbers.rst +192 -0
- data/docs/usage/queues.rst +117 -0
- data/docs/usage/recordings.rst +102 -0
- data/docs/usage/sip.rst +108 -0
- data/docs/usage/token-generation.rst +96 -0
- data/docs/usage/transcriptions.rst +34 -0
- data/docs/usage/twiml.rst +69 -0
- data/docs/usage/validation.rst +107 -0
- data/examples/examples.rb +200 -0
- data/examples/print-call-log.rb +25 -0
- data/lib/rack/restcomm_webhook_authentication.rb +47 -0
- data/lib/restcomm-ruby.rb +103 -0
- data/lib/restcomm-ruby/rest/accounts.rb +17 -0
- data/lib/restcomm-ruby/rest/addresses.rb +12 -0
- data/lib/restcomm-ruby/rest/addresses/dependent_phone_numbers.rb +6 -0
- data/lib/restcomm-ruby/rest/applications.rb +6 -0
- data/lib/restcomm-ruby/rest/authorized_connect_apps.rb +6 -0
- data/lib/restcomm-ruby/rest/available_phone_numbers.rb +13 -0
- data/lib/restcomm-ruby/rest/available_phone_numbers/country.rb +10 -0
- data/lib/restcomm-ruby/rest/available_phone_numbers/local.rb +11 -0
- data/lib/restcomm-ruby/rest/available_phone_numbers/mobile.rb +11 -0
- data/lib/restcomm-ruby/rest/available_phone_numbers/toll_free.rb +11 -0
- data/lib/restcomm-ruby/rest/call_feedback.rb +28 -0
- data/lib/restcomm-ruby/rest/call_feedback_summary.rb +13 -0
- data/lib/restcomm-ruby/rest/calls.rb +37 -0
- data/lib/restcomm-ruby/rest/client.rb +555 -0
- data/lib/restcomm-ruby/rest/conferences.rb +12 -0
- data/lib/restcomm-ruby/rest/conferences/participants.rb +23 -0
- data/lib/restcomm-ruby/rest/connect_apps.rb +6 -0
- data/lib/restcomm-ruby/rest/errors.rb +14 -0
- data/lib/restcomm-ruby/rest/incoming_phone_numbers.rb +17 -0
- data/lib/restcomm-ruby/rest/incoming_phone_numbers/local.rb +13 -0
- data/lib/restcomm-ruby/rest/incoming_phone_numbers/mobile.rb +13 -0
- data/lib/restcomm-ruby/rest/incoming_phone_numbers/toll_free.rb +13 -0
- data/lib/restcomm-ruby/rest/instance_resource.rb +88 -0
- data/lib/restcomm-ruby/rest/list_resource.rb +132 -0
- data/lib/restcomm-ruby/rest/media.rb +14 -0
- data/lib/restcomm-ruby/rest/messages.rb +23 -0
- data/lib/restcomm-ruby/rest/next_gen_list_resource.rb +29 -0
- data/lib/restcomm-ruby/rest/notifications.rb +6 -0
- data/lib/restcomm-ruby/rest/outgoing_caller_ids.rb +25 -0
- data/lib/restcomm-ruby/rest/queues.rb +12 -0
- data/lib/restcomm-ruby/rest/queues/members.rb +29 -0
- data/lib/restcomm-ruby/rest/recordings.rb +35 -0
- data/lib/restcomm-ruby/rest/sandbox.rb +5 -0
- data/lib/restcomm-ruby/rest/sip.rb +10 -0
- data/lib/restcomm-ruby/rest/sip/credential_lists.rb +11 -0
- data/lib/restcomm-ruby/rest/sip/credential_lists/credentials.rb +6 -0
- data/lib/restcomm-ruby/rest/sip/domains.rb +12 -0
- data/lib/restcomm-ruby/rest/sip/domains/credential_list_mappings.rb +6 -0
- data/lib/restcomm-ruby/rest/sip/domains/ip_access_control_list_mappings.rb +6 -0
- data/lib/restcomm-ruby/rest/sip/ip_access_control_lists.rb +11 -0
- data/lib/restcomm-ruby/rest/sip/ip_access_control_lists/ip_addresses.rb +6 -0
- data/lib/restcomm-ruby/rest/sms.rb +11 -0
- data/lib/restcomm-ruby/rest/sms/messages.rb +39 -0
- data/lib/restcomm-ruby/rest/sms/short_codes.rb +8 -0
- data/lib/restcomm-ruby/rest/task_router/activities.rb +8 -0
- data/lib/restcomm-ruby/rest/task_router/events.rb +8 -0
- data/lib/restcomm-ruby/rest/task_router/reservations.rb +8 -0
- data/lib/restcomm-ruby/rest/task_router/task_queues.rb +8 -0
- data/lib/restcomm-ruby/rest/task_router/task_queues_statistics.rb +15 -0
- data/lib/restcomm-ruby/rest/task_router/tasks.rb +15 -0
- data/lib/restcomm-ruby/rest/task_router/workers.rb +8 -0
- data/lib/restcomm-ruby/rest/task_router/workers_statistics.rb +8 -0
- data/lib/restcomm-ruby/rest/task_router/workflow_statistics.rb +7 -0
- data/lib/restcomm-ruby/rest/task_router/workflows.rb +8 -0
- data/lib/restcomm-ruby/rest/task_router/workspace_statistics.rb +7 -0
- data/lib/restcomm-ruby/rest/task_router/workspaces.rb +15 -0
- data/lib/restcomm-ruby/rest/tokens.rb +7 -0
- data/lib/restcomm-ruby/rest/transcriptions.rb +6 -0
- data/lib/restcomm-ruby/rest/usage.rb +10 -0
- data/lib/restcomm-ruby/rest/usage/records.rb +21 -0
- data/lib/restcomm-ruby/rest/usage/triggers.rb +12 -0
- data/lib/restcomm-ruby/rest/utils.rb +49 -0
- data/lib/restcomm-ruby/task_router.rb +0 -0
- data/lib/restcomm-ruby/task_router/capability.rb +87 -0
- data/lib/restcomm-ruby/twiml/response.rb +16 -0
- data/lib/restcomm-ruby/util.rb +15 -0
- data/lib/restcomm-ruby/util/capability.rb +64 -0
- data/lib/restcomm-ruby/util/configuration.rb +7 -0
- data/lib/restcomm-ruby/util/request_validator.rb +37 -0
- data/lib/restcomm-ruby/version.rb +3 -0
- data/restcomm-ruby.gemspec +34 -0
- data/spec/rack/twilio_webhook_authentication_spec.rb +110 -0
- data/spec/rest/account_spec.rb +89 -0
- data/spec/rest/address_spec.rb +11 -0
- data/spec/rest/call_feedback_spec.rb +12 -0
- data/spec/rest/call_feedback_summary_spec.rb +9 -0
- data/spec/rest/call_spec.rb +22 -0
- data/spec/rest/client_spec.rb +258 -0
- data/spec/rest/conference_spec.rb +11 -0
- data/spec/rest/instance_resource_spec.rb +15 -0
- data/spec/rest/message_spec.rb +12 -0
- data/spec/rest/numbers_spec.rb +58 -0
- data/spec/rest/queue_spec.rb +11 -0
- data/spec/rest/recording_spec.rb +11 -0
- data/spec/rest/sms/message_spec.rb +37 -0
- data/spec/rest/sms/messages_spec.rb +36 -0
- data/spec/rest/task_router/reservation_spec.rb +9 -0
- data/spec/rest/task_router/task_queue_spec.rb +9 -0
- data/spec/rest/token_spec.rb +7 -0
- data/spec/rest/utils_spec.rb +45 -0
- data/spec/spec_helper.rb +15 -0
- data/spec/support/fakeweb.rb +2 -0
- data/spec/task_router_spec.rb +114 -0
- data/spec/twilio_spec.rb +15 -0
- data/spec/util/capability_spec.rb +186 -0
- data/spec/util/configuration_spec.rb +13 -0
- data/spec/util/request_validator_spec.rb +93 -0
- data/spec/util/url_encode_spec.rb +12 -0
- metadata +298 -0
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
.. module:: restcomm.rest.resources
|
|
2
|
+
|
|
3
|
+
==============================
|
|
4
|
+
Queues and Members
|
|
5
|
+
==============================
|
|
6
|
+
|
|
7
|
+
For more information, see the
|
|
8
|
+
`Queue REST Resource <http://docs.telestax.com/restcomm-pages/>`_
|
|
9
|
+
and `Member REST Resource <http://docs.telestax.com/restcomm-pages/>`_
|
|
10
|
+
documentation.
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
Listing Queues
|
|
14
|
+
-----------------------
|
|
15
|
+
|
|
16
|
+
.. code-block:: ruby
|
|
17
|
+
|
|
18
|
+
require 'restcomm-ruby'
|
|
19
|
+
|
|
20
|
+
# To find these visit http://docs.telestax.com/restcomm-pages/
|
|
21
|
+
account_sid = "ACXXXXXXXXXXXXXXXXX"
|
|
22
|
+
auth_token = "YYYYYYYYYYYYYYYYYY"
|
|
23
|
+
host = "XXX.XXX.XXX.XXX"
|
|
24
|
+
|
|
25
|
+
@client = Restcomm::REST::Client.new account_sid, auth_token, host
|
|
26
|
+
@queues = @client.queues.list
|
|
27
|
+
|
|
28
|
+
@queues.each do |queue|
|
|
29
|
+
puts queue.sid
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
Listing Queue Members
|
|
34
|
+
----------------------
|
|
35
|
+
|
|
36
|
+
Each :class:`Queue` has a :attr:`members` instance which
|
|
37
|
+
represents all current calls in the queue.
|
|
38
|
+
|
|
39
|
+
.. code-block:: ruby
|
|
40
|
+
|
|
41
|
+
require 'restcomm-ruby'
|
|
42
|
+
|
|
43
|
+
# To find these visit http://docs.telestax.com/restcomm-pages/
|
|
44
|
+
account_sid = "ACXXXXXXXXXXXXXXXXX"
|
|
45
|
+
auth_token = "YYYYYYYYYYYYYYYYYY"
|
|
46
|
+
host = "XXX.XXX.XXX.XXX"
|
|
47
|
+
|
|
48
|
+
@client = Restcomm::REST::Client.new account_sid, auth_token, host
|
|
49
|
+
@queue = @client.queues.get("QU123")
|
|
50
|
+
|
|
51
|
+
@queue.members.list().each do |member|
|
|
52
|
+
puts member.call_sid
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
Getting a specific Queue Member
|
|
57
|
+
-------------------------------
|
|
58
|
+
|
|
59
|
+
To retrieve information about a specific member in the queue, each
|
|
60
|
+
:class:`Members` has a :attr:`get` method. :attr:`get` accepts one
|
|
61
|
+
argument. The argument can either be a `call_sid` thats in the queue,
|
|
62
|
+
in which case :attr:`get` will return a :class:`Member` instance
|
|
63
|
+
representing that call, or the argument can be 'Front', in which case
|
|
64
|
+
:attr:`Get` will return a :class:`Member` instance representing the
|
|
65
|
+
first call in the queue.
|
|
66
|
+
|
|
67
|
+
.. code-block:: ruby
|
|
68
|
+
|
|
69
|
+
require 'restcomm-ruby'
|
|
70
|
+
|
|
71
|
+
# To find these visit http://docs.telestax.com/restcomm-pages/
|
|
72
|
+
account_sid = "ACXXXXXXXXXXXXXXXXX"
|
|
73
|
+
auth_token = "YYYYYYYYYYYYYYYYYY"
|
|
74
|
+
host = "XXX.XXX.XXX.XXX"
|
|
75
|
+
|
|
76
|
+
@client = Restcomm::REST::Client.new account_sid, auth_token, host
|
|
77
|
+
|
|
78
|
+
queue_sid = "QUAAAAAAAAAAAAA"
|
|
79
|
+
call_sid = "CAXXXXXXXXXXXXXX"
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
@members = @client.queues.get(queue_sid).members
|
|
83
|
+
|
|
84
|
+
# Get the first call in the queue
|
|
85
|
+
puts members.front.date_enqueued
|
|
86
|
+
|
|
87
|
+
# Get the call with the given call sid in the queue
|
|
88
|
+
puts members.get(call_sid).current_position
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
Dequeueing Queue Members
|
|
92
|
+
------------------------
|
|
93
|
+
|
|
94
|
+
To dequeue a specific member from the queue, each
|
|
95
|
+
:class:`Members` has a :attr:`dequeue` method. :attr:`dequeue` accepts an
|
|
96
|
+
argument and two optional keyword arguments. The first argument is the
|
|
97
|
+
url of the twiml document to be executed when the member is
|
|
98
|
+
dequeued. The other two are :attr:`call_sid` and :attr:`method`, their
|
|
99
|
+
default values are 'Front' and 'GET'
|
|
100
|
+
|
|
101
|
+
.. code-block:: ruby
|
|
102
|
+
|
|
103
|
+
require 'restcomm-ruby'
|
|
104
|
+
|
|
105
|
+
# To find these visit http://docs.telestax.com/restcomm-pages/
|
|
106
|
+
account_sid = "ACXXXXXXXXXXXXXXXXX"
|
|
107
|
+
auth_token = "YYYYYYYYYYYYYYYYYY"
|
|
108
|
+
host = "XXX.XXX.XXX.XXX"
|
|
109
|
+
|
|
110
|
+
@client = Restcomm::REST::Client.new account_sid, auth_token, host
|
|
111
|
+
|
|
112
|
+
queue_sid = "QUAAAAAAAAAAAAA"
|
|
113
|
+
|
|
114
|
+
@members = @client.queues.get(queue_sid).members
|
|
115
|
+
|
|
116
|
+
# Dequeue the first call in the queue
|
|
117
|
+
puts @members.dequeue('http://SOME_WEBSITE/welcome/call')
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
.. module:: restcomm.rest.resources
|
|
2
|
+
|
|
3
|
+
================
|
|
4
|
+
Recordings
|
|
5
|
+
================
|
|
6
|
+
|
|
7
|
+
For more information, see the
|
|
8
|
+
`Recordings REST Resource <http://docs.telestax.com/restcomm-pages/>`_
|
|
9
|
+
documentation.
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
Audio Formats
|
|
13
|
+
-----------------
|
|
14
|
+
|
|
15
|
+
Each :class:`Recording` has a few special methods. To get the url
|
|
16
|
+
for the wav format of this recording, use :meth:`Recording.wav`. For the
|
|
17
|
+
mp3 format, use :meth:`Recording.mp3`. To make requests for either of
|
|
18
|
+
these formats use the same method with a '!' appended. These methods
|
|
19
|
+
both take a block to be executed as soon as the response returns.
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
Listing Your Recordings
|
|
23
|
+
----------------------------
|
|
24
|
+
|
|
25
|
+
The following code will print out the :attr:`duration`
|
|
26
|
+
for each :class:`Recording`.
|
|
27
|
+
|
|
28
|
+
.. code-block:: ruby
|
|
29
|
+
|
|
30
|
+
require 'restcomm-ruby'
|
|
31
|
+
|
|
32
|
+
# To find these visit http://docs.telestax.com/restcomm-pages/
|
|
33
|
+
account_sid = "ACXXXXXXXXXXXXXXXXX"
|
|
34
|
+
auth_token = "YYYYYYYYYYYYYYYYYY"
|
|
35
|
+
host = "XXX.XXX.XXX.XXX"
|
|
36
|
+
|
|
37
|
+
@client = Restcomm::REST::Client.new account_sid, auth_token, host
|
|
38
|
+
|
|
39
|
+
@client.recordings.list().each do |recording|
|
|
40
|
+
puts recording.duration
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
You can filter recordings by CallSid by passing the Sid as :attr:`call`.
|
|
44
|
+
Filter recordings using :attr:`DateCreated<` and :attr:`DateCreated>` dates.
|
|
45
|
+
|
|
46
|
+
The following will only show recordings made before January 1, 2011.
|
|
47
|
+
|
|
48
|
+
.. code-block:: ruby
|
|
49
|
+
|
|
50
|
+
require 'restcomm-ruby'
|
|
51
|
+
|
|
52
|
+
# To find these visit http://docs.telestax.com/restcomm-pages/
|
|
53
|
+
account_sid = "ACXXXXXXXXXXXXXXXXX"
|
|
54
|
+
auth_token = "YYYYYYYYYYYYYYYYYY"
|
|
55
|
+
host = "XXX.XXX.XXX.XXX"
|
|
56
|
+
|
|
57
|
+
@client = Restcomm::REST::Client.new account_sid, auth_token, host
|
|
58
|
+
@client.recordings.list('DateCreated<' => '2011-01-01').each do |recording|
|
|
59
|
+
puts recording.duration
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
Deleting Recordings
|
|
63
|
+
---------------------
|
|
64
|
+
|
|
65
|
+
The :class:`Recordings` resource allows you to delete unnecessary recordings.
|
|
66
|
+
|
|
67
|
+
.. code-block:: ruby
|
|
68
|
+
|
|
69
|
+
require 'restcomm-ruby'
|
|
70
|
+
|
|
71
|
+
# To find these visit http://docs.telestax.com/restcomm-pages/
|
|
72
|
+
account_sid = "ACXXXXXXXXXXXXXXXXX"
|
|
73
|
+
auth_token = "YYYYYYYYYYYYYYYYYY"
|
|
74
|
+
host = "XXX.XXX.XXX.XXX"
|
|
75
|
+
|
|
76
|
+
@client = Restcomm::REST::Client.new account_sid, auth_token, host
|
|
77
|
+
@client.recordings.get("RC123").delete()
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
Accessing Related Transcptions
|
|
81
|
+
-------------------------------
|
|
82
|
+
|
|
83
|
+
The :class:`Recordings` allows you to retrieve associated transcriptions.
|
|
84
|
+
The following prints out the text for each of the transcriptions associated
|
|
85
|
+
with this recording.
|
|
86
|
+
|
|
87
|
+
.. code-block:: ruby
|
|
88
|
+
|
|
89
|
+
require 'restcomm-ruby'
|
|
90
|
+
|
|
91
|
+
# To find these visit http://docs.telestax.com/restcomm-pages/
|
|
92
|
+
account_sid = "ACXXXXXXXXXXXXXXXXX"
|
|
93
|
+
auth_token = "YYYYYYYYYYYYYYYYYY"
|
|
94
|
+
host = "XXX.XXX.XXX.XXX"
|
|
95
|
+
|
|
96
|
+
@client = Restcomm::REST::Client.new account_sid, auth_token, host
|
|
97
|
+
@recording = @client.recordings.get("RC123")
|
|
98
|
+
|
|
99
|
+
@recording.transcriptions.list().each do |transcription|
|
|
100
|
+
puts transcription.transcription_text
|
|
101
|
+
end
|
|
102
|
+
|
data/docs/usage/sip.rst
ADDED
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
=============
|
|
2
|
+
Sip In
|
|
3
|
+
=============
|
|
4
|
+
|
|
5
|
+
Getting started with Sip In
|
|
6
|
+
===========================
|
|
7
|
+
|
|
8
|
+
If you're unfamiliar with SIP, please see the `SIP API Documentation
|
|
9
|
+
<http://docs.telestax.com/restcomm-pages/>`_ on our website. If you want
|
|
10
|
+
to make a regular phone call, take a look at :doc:`phone-calls`.
|
|
11
|
+
|
|
12
|
+
Creating a Sip Domain
|
|
13
|
+
=====================
|
|
14
|
+
|
|
15
|
+
The :class:`Domains` resource allows you to create a new domain. To
|
|
16
|
+
create a new domain, you'll need to choose a unique domain that lives
|
|
17
|
+
under sip.restcomm.com.
|
|
18
|
+
|
|
19
|
+
.. code-block:: ruby
|
|
20
|
+
|
|
21
|
+
require 'restcomm-ruby'
|
|
22
|
+
|
|
23
|
+
# To find these visit http://docs.telestax.com/restcomm-pages/
|
|
24
|
+
account_sid = "ACXXXXXXXXXXXXXXXXX"
|
|
25
|
+
auth_token = "YYYYYYYYYYYYYYYYYY"
|
|
26
|
+
host = "XXX.XXX.XXX.XXX"
|
|
27
|
+
|
|
28
|
+
@client = Restcomm::REST::Client.new account_sid, auth_token, host
|
|
29
|
+
|
|
30
|
+
@domain = @client.sip.domains.create(
|
|
31
|
+
friendly_name: "The Office Domain",
|
|
32
|
+
voice_url: "http://example.com/voice"
|
|
33
|
+
domain_name: "dunder-mifflin-scranton.sip.restcomm.com"
|
|
34
|
+
)
|
|
35
|
+
puts @domain.sid
|
|
36
|
+
|
|
37
|
+
Creating a new IpAccessControlList
|
|
38
|
+
==================================
|
|
39
|
+
|
|
40
|
+
To control access to your new domain, you'll need to explicitly grant access
|
|
41
|
+
to individual ip addresses. To do this, you'll first need to create an
|
|
42
|
+
:class:`IpAccessControlList` to hold the ip addresses you wish to allow.
|
|
43
|
+
|
|
44
|
+
.. code-block:: ruby
|
|
45
|
+
|
|
46
|
+
require 'restcomm-ruby'
|
|
47
|
+
|
|
48
|
+
# To find these visit http://docs.telestax.com/restcomm-pages/
|
|
49
|
+
account_sid = "ACXXXXXXXXXXXXXXXXX"
|
|
50
|
+
auth_token = "YYYYYYYYYYYYYYYYYY"
|
|
51
|
+
host = "XXX.XXX.XXX.XXX"
|
|
52
|
+
|
|
53
|
+
@client = Restcomm::REST::Client.new account_sid, auth_token, host
|
|
54
|
+
|
|
55
|
+
@ip_acl = @client.sip.ip_access_control_lists.create(
|
|
56
|
+
friendly_name: "The Office IpAccessControlList"
|
|
57
|
+
)
|
|
58
|
+
puts @ip_acl.sid
|
|
59
|
+
|
|
60
|
+
Adding a new IpAddress
|
|
61
|
+
=========================
|
|
62
|
+
|
|
63
|
+
Now it's time to add an :class:`IpAddress` to your new :class:`IpAccessControlList`.
|
|
64
|
+
|
|
65
|
+
.. code-block:: ruby
|
|
66
|
+
|
|
67
|
+
require 'restcomm-ruby'
|
|
68
|
+
|
|
69
|
+
# To find these visit http://docs.telestax.com/restcomm-pages/
|
|
70
|
+
account_sid = "ACXXXXXXXXXXXXXXXXX"
|
|
71
|
+
auth_token = "YYYYYYYYYYYYYYYYYY"
|
|
72
|
+
host = "XXX.XXX.XXX.XXX"
|
|
73
|
+
|
|
74
|
+
@client = Restcomm::REST::Client.new account_sid, auth_token, host
|
|
75
|
+
|
|
76
|
+
@ip_address = @client.sip.ip_access_control_lists.get(
|
|
77
|
+
"AL456", # IpAccessControlList sid
|
|
78
|
+
).ip_addresses.create(
|
|
79
|
+
friendly_name: "Dwights's Computer",
|
|
80
|
+
ip_address: "192.168.1.42"
|
|
81
|
+
)
|
|
82
|
+
puts @ip_address.sid
|
|
83
|
+
|
|
84
|
+
Adding an IpAccessControlList to a Domain
|
|
85
|
+
===========================================
|
|
86
|
+
|
|
87
|
+
Once you've created a :class:`Domain` and an :class:`IpAccessControlList` you need to
|
|
88
|
+
associate them. To do this, create an :class:`IpAccessControlListMapping`.
|
|
89
|
+
|
|
90
|
+
.. code-block:: ruby
|
|
91
|
+
|
|
92
|
+
require 'restcomm-ruby'
|
|
93
|
+
|
|
94
|
+
# To find these visit http://docs.telestax.com/restcomm-pages/
|
|
95
|
+
account_sid = "ACXXXXXXXXXXXXXXXXX"
|
|
96
|
+
auth_token = "YYYYYYYYYYYYYYYYYY"
|
|
97
|
+
host = "XXX.XXX.XXX.XXX"
|
|
98
|
+
|
|
99
|
+
@client = Restcomm::REST::Client.new account_sid, auth_token, host
|
|
100
|
+
|
|
101
|
+
@ip_acl_mapping = @client.sip.domains.get(
|
|
102
|
+
"SD456", # SIP Domain sid
|
|
103
|
+
).ip_access_control_list_mappings.create(
|
|
104
|
+
ip_access_control_list_sid: "AL789"
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
puts @ip_acl_mapping.sid
|
|
108
|
+
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
.. module:: restcomm.util
|
|
2
|
+
|
|
3
|
+
===========================
|
|
4
|
+
Generate Capability Tokens
|
|
5
|
+
===========================
|
|
6
|
+
|
|
7
|
+
`Restcomm Client <http://docs.telestax.com/restcomm-pages/>`_ allows you to make and
|
|
8
|
+
receive connections in the browser.
|
|
9
|
+
You can place a call to a phone on the PSTN network,
|
|
10
|
+
all without leaving your browser. See the `Restcomm Client Quickstart
|
|
11
|
+
<http://docs.telestax.com/restcomm-pages/>`_ to get up and running with
|
|
12
|
+
Restcomm Client.
|
|
13
|
+
|
|
14
|
+
Capability tokens are used by `Restcomm Client
|
|
15
|
+
<http://docs.telestax.com/restcomm-pages/>`_ to provide connection
|
|
16
|
+
security and authorization. The `Capability Token documentation
|
|
17
|
+
<http://docs.telestax.com/restcomm-pages/>`_ explains in depth the purpose and
|
|
18
|
+
features of these tokens.
|
|
19
|
+
|
|
20
|
+
:class:`Restcomm::Util::Capability` is responsible for the creation of these
|
|
21
|
+
capability tokens. You'll need your Restcomm AccountSid and AuthToken.
|
|
22
|
+
|
|
23
|
+
.. code-block:: ruby
|
|
24
|
+
|
|
25
|
+
require 'restcomm-ruby'
|
|
26
|
+
|
|
27
|
+
# Find these values at restcomm.com/user/account
|
|
28
|
+
account_sid = "AC123123"
|
|
29
|
+
auth_token = "secret"
|
|
30
|
+
|
|
31
|
+
@capability = Restcomm::Util::Capability.new account_sid, auth_token
|
|
32
|
+
|
|
33
|
+
You can also configure capability tokens using the top level configure method,
|
|
34
|
+
like so:
|
|
35
|
+
|
|
36
|
+
.. code-block:: ruby
|
|
37
|
+
|
|
38
|
+
require 'restcomm-ruby'
|
|
39
|
+
|
|
40
|
+
Restcomm.configure do |config|
|
|
41
|
+
config.account_sid = "ACXXXXXXXXXXXXXXXXX"
|
|
42
|
+
config.auth_token = "YYYYYYYYYYYYYYYYYY"
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
@capability = Restcomm::Util::Capability.new
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
Allow Incoming Connections
|
|
50
|
+
==============================
|
|
51
|
+
|
|
52
|
+
Before a device running `Restcomm Client <http://docs.telestax.com/restcomm-pages/>`_
|
|
53
|
+
can recieve incoming connections, the instance must first register a name
|
|
54
|
+
(such as "Alice" or "Bob").
|
|
55
|
+
The :meth:`allow_client_incoming` method adds the client name to the
|
|
56
|
+
capability token.
|
|
57
|
+
|
|
58
|
+
.. code-block:: ruby
|
|
59
|
+
|
|
60
|
+
@capability.allow_client_incoming("Alice")
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
Allow Outgoing Connections
|
|
64
|
+
==============================
|
|
65
|
+
|
|
66
|
+
To make an outgoing connection from a
|
|
67
|
+
`Restcomm Client <http://docs.telestax.com/restcomm-pages/>`_ device,
|
|
68
|
+
you'll need to choose a
|
|
69
|
+
`Restcomm Application <http://www.restcomm.com/docs/api/rest/applications>`_
|
|
70
|
+
to handle RCML URLs. A Restcomm Application is a collection of URLs responsible
|
|
71
|
+
for outputting valid RCML to control phone calls and messages.
|
|
72
|
+
|
|
73
|
+
.. code-block:: ruby
|
|
74
|
+
|
|
75
|
+
# Restcomm Application Sid
|
|
76
|
+
application_sid = "APabe7650f654fc34655fc81ae71caa3ff"
|
|
77
|
+
@capability.allow_client_outgoing(application_sid)
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
Generate a Token
|
|
81
|
+
==================
|
|
82
|
+
|
|
83
|
+
.. code-block:: ruby
|
|
84
|
+
|
|
85
|
+
@token = @capability.generate()
|
|
86
|
+
|
|
87
|
+
By default, this token will expire in one hour. If you'd like to change the
|
|
88
|
+
token expiration, :meth:`generate` takes an optional :attr:`ttl` argument.
|
|
89
|
+
|
|
90
|
+
.. code-block:: ruby
|
|
91
|
+
|
|
92
|
+
@token = @capability.generate(ttl=600)
|
|
93
|
+
|
|
94
|
+
This token will now expire in 10 minutes. If you haven't guessed already,
|
|
95
|
+
:attr:`ttl` is expressed in seconds.
|
|
96
|
+
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
.. module:: restcomm.rest.resources
|
|
2
|
+
|
|
3
|
+
================
|
|
4
|
+
Transcriptions
|
|
5
|
+
================
|
|
6
|
+
|
|
7
|
+
Transcriptions are generated from recordings via the
|
|
8
|
+
`RCML <Record> verb <http://www.restcomm.com/docs/api/twiml/record>`_.
|
|
9
|
+
Using the API, you can only read your transcription records.
|
|
10
|
+
|
|
11
|
+
For more information, see the `Transcriptions REST Resource
|
|
12
|
+
<http://docs.telestax.com/restcomm-pages/>`_ documentation.
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
Listing Your Transcriptions
|
|
16
|
+
----------------------------
|
|
17
|
+
|
|
18
|
+
The following code will print out the length of each :class:`Transcription`.
|
|
19
|
+
|
|
20
|
+
.. code-block:: ruby
|
|
21
|
+
|
|
22
|
+
require 'restcomm-ruby'
|
|
23
|
+
|
|
24
|
+
# To find these visit http://docs.telestax.com/restcomm-pages/
|
|
25
|
+
account_sid = "ACXXXXXXXXXXXXXXXXX"
|
|
26
|
+
auth_token = "YYYYYYYYYYYYYYYYYY"
|
|
27
|
+
host = "XXX.XXX.XXX.XXX"
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
@client = Restcomm::REST::Client.new account_sid, auth_token, host
|
|
31
|
+
@client.transcriptions.list().each do |transcription|
|
|
32
|
+
puts transcription.duration
|
|
33
|
+
end
|
|
34
|
+
|