From eb0b46425582c52564c96d5e0f56ac3cbc843470 Mon Sep 17 00:00:00 2001 From: Tony Bedford Date: Tue, 1 May 2018 11:52:34 +0100 Subject: [PATCH 01/17] Added connect an inbound call building block. --- voice/connect-an-inbound-call.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100755 voice/connect-an-inbound-call.py diff --git a/voice/connect-an-inbound-call.py b/voice/connect-an-inbound-call.py new file mode 100755 index 0000000..4572823 --- /dev/null +++ b/voice/connect-an-inbound-call.py @@ -0,0 +1,21 @@ +#!/usr/bin/env python3 +from flask import Flask, request, jsonify + +app = Flask(__name__) + +@app.route("/webhooks/answer") +def answer_call(): + + ncco = [ + { + "action": "connect", + "endpoint": [{ + "type": 'phone', + "number": "TO_NUMBER" + }] + } + ] + return jsonify(ncco) + +if __name__ == '__main__': + app.run(port=3000) From e0ccc5343cf33794d26d9fcceb67485b6b9edf4c Mon Sep 17 00:00:00 2001 From: Tony Bedford Date: Tue, 1 May 2018 12:15:02 +0100 Subject: [PATCH 02/17] Added from number and removed blank line. Tested. --- voice/connect-an-inbound-call.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/voice/connect-an-inbound-call.py b/voice/connect-an-inbound-call.py index 4572823..8f11c9e 100755 --- a/voice/connect-an-inbound-call.py +++ b/voice/connect-an-inbound-call.py @@ -5,10 +5,10 @@ @app.route("/webhooks/answer") def answer_call(): - ncco = [ { "action": "connect", + "from": "NEXMO_NUMBER", "endpoint": [{ "type": 'phone', "number": "TO_NUMBER" @@ -18,4 +18,4 @@ def answer_call(): return jsonify(ncco) if __name__ == '__main__': - app.run(port=3000) + app.run(port=9000) From 7a57c7f0a7f4357cb2847e8cf4e0f12110c4fc78 Mon Sep 17 00:00:00 2001 From: Tony Bedford Date: Tue, 1 May 2018 12:23:10 +0100 Subject: [PATCH 03/17] Use RECIPIENT_NUMBER rather than TO_NUMBER. --- voice/connect-an-inbound-call.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/voice/connect-an-inbound-call.py b/voice/connect-an-inbound-call.py index 8f11c9e..416f2b4 100755 --- a/voice/connect-an-inbound-call.py +++ b/voice/connect-an-inbound-call.py @@ -11,7 +11,7 @@ def answer_call(): "from": "NEXMO_NUMBER", "endpoint": [{ "type": 'phone', - "number": "TO_NUMBER" + "number": "RECIPIENT_NUMBER" }] } ] From 4fbaa427c8ed172831c8cb94a130d5ce2a9f0b66 Mon Sep 17 00:00:00 2001 From: Tony Bedford Date: Wed, 2 May 2018 10:53:30 +0100 Subject: [PATCH 04/17] Ignore Mac system file. Added building block. Fixed port on building block example. --- .gitignore | 2 ++ voice/connect-an-inbound-call.py | 4 +-- voice/record-a-call.py | 42 ++++++++++++++++++++++++++++++++ 3 files changed, 46 insertions(+), 2 deletions(-) create mode 100755 voice/record-a-call.py diff --git a/.gitignore b/.gitignore index 19e815f..617d374 100644 --- a/.gitignore +++ b/.gitignore @@ -90,3 +90,5 @@ ENV/ # nexmo key file private.key + +.DS_Store diff --git a/voice/connect-an-inbound-call.py b/voice/connect-an-inbound-call.py index 416f2b4..39c7e16 100755 --- a/voice/connect-an-inbound-call.py +++ b/voice/connect-an-inbound-call.py @@ -14,8 +14,8 @@ def answer_call(): "number": "RECIPIENT_NUMBER" }] } - ] + ] return jsonify(ncco) if __name__ == '__main__': - app.run(port=9000) + app.run(port=3000) diff --git a/voice/record-a-call.py b/voice/record-a-call.py new file mode 100755 index 0000000..1ba8316 --- /dev/null +++ b/voice/record-a-call.py @@ -0,0 +1,42 @@ +#!/usr/bin/env python3 +from flask import Flask, request, jsonify +from pprint import pprint + +app = Flask(__name__) + +@app.route("/webhooks/answer") +def answer_call(): + ncco = [ + { + "action": "talk", + "text": "Hi, we will shortly forward your call. This call is recorded for quality assurance purposes." + }, + { + "action": "record", + "eventUrl": ["https://275d6df0.ngrok.io/webhooks/recordings"] + }, + { + "action": "connect", + "eventUrl": ["https://275d6df0.ngrok.io/webhooks/event"], + "from": "NEXMO_NUMBER", + "endpoint": [ + { + "type": "phone", + "number": "RECIPIENT_NUMBER" + } + ] + } + ] + return jsonify(ncco) + +@app.route("/webhooks/recordings", methods=['POST']) +def recordings(): + + data = request.get_json() + pprint(data) + + recording_url = request.args['recording_url'] + pprint(recording_url) + +if __name__ == '__main__': + app.run(port=3000) From d5c0adfae20fde7f1034d2e9b12437c07a703f53 Mon Sep 17 00:00:00 2001 From: Tony Bedford Date: Wed, 2 May 2018 11:13:00 +0100 Subject: [PATCH 05/17] Another building block plus fixes. --- voice/record-a-call-with-split-audio.py | 40 +++++++++++++++++++++++++ voice/record-a-call.py | 7 ++--- 2 files changed, 42 insertions(+), 5 deletions(-) create mode 100755 voice/record-a-call-with-split-audio.py diff --git a/voice/record-a-call-with-split-audio.py b/voice/record-a-call-with-split-audio.py new file mode 100755 index 0000000..860efbc --- /dev/null +++ b/voice/record-a-call-with-split-audio.py @@ -0,0 +1,40 @@ +#!/usr/bin/env python3 +from flask import Flask, request, jsonify +from pprint import pprint + +app = Flask(__name__) + +@app.route("/webhooks/answer") +def answer_call(): + ncco = [ + { + "action": "talk", + "text": "Hi, we will shortly forward your call. This call is recorded for quality assurance purposes." + }, + { + "action": "record", + "split" : "conversation", + "eventUrl": ["https://demo.ngrok.io/webhooks/recordings"] + }, + { + "action": "connect", + "eventUrl": ["https://demo.ngrok.io/webhooks/event"], + "from": "NEXMO_NUMBER", + "endpoint": [ + { + "type": "phone", + "number": "RECIPIENT_NUMBER" + } + ] + } + ] + return jsonify(ncco) + +@app.route("/webhooks/recordings", methods=['POST']) +def recordings(): + + data = request.get_json() + pprint(data) + +if __name__ == '__main__': + app.run(port=3000) diff --git a/voice/record-a-call.py b/voice/record-a-call.py index 1ba8316..b9bb471 100755 --- a/voice/record-a-call.py +++ b/voice/record-a-call.py @@ -13,11 +13,11 @@ def answer_call(): }, { "action": "record", - "eventUrl": ["https://275d6df0.ngrok.io/webhooks/recordings"] + "eventUrl": ["https://demo.ngrok.io/webhooks/recordings"] }, { "action": "connect", - "eventUrl": ["https://275d6df0.ngrok.io/webhooks/event"], + "eventUrl": ["https://demo.ngrok.io/webhooks/event"], "from": "NEXMO_NUMBER", "endpoint": [ { @@ -35,8 +35,5 @@ def recordings(): data = request.get_json() pprint(data) - recording_url = request.args['recording_url'] - pprint(recording_url) - if __name__ == '__main__': app.run(port=3000) From 18e57e9108db369ed1076b4d40ea112eb19be24e Mon Sep 17 00:00:00 2001 From: Tony Bedford Date: Wed, 2 May 2018 11:48:25 +0100 Subject: [PATCH 06/17] New building block, plus fixed view response code (was missing). --- voice/record-a-call-with-split-audio.py | 2 +- voice/record-a-call.py | 2 +- voice/record-a-conversation.py | 33 +++++++++++++++++++++++++ 3 files changed, 35 insertions(+), 2 deletions(-) create mode 100755 voice/record-a-conversation.py diff --git a/voice/record-a-call-with-split-audio.py b/voice/record-a-call-with-split-audio.py index 860efbc..8c6162d 100755 --- a/voice/record-a-call-with-split-audio.py +++ b/voice/record-a-call-with-split-audio.py @@ -32,9 +32,9 @@ def answer_call(): @app.route("/webhooks/recordings", methods=['POST']) def recordings(): - data = request.get_json() pprint(data) + return ("200") if __name__ == '__main__': app.run(port=3000) diff --git a/voice/record-a-call.py b/voice/record-a-call.py index b9bb471..1190556 100755 --- a/voice/record-a-call.py +++ b/voice/record-a-call.py @@ -31,9 +31,9 @@ def answer_call(): @app.route("/webhooks/recordings", methods=['POST']) def recordings(): - data = request.get_json() pprint(data) + return ("200") if __name__ == '__main__': app.run(port=3000) diff --git a/voice/record-a-conversation.py b/voice/record-a-conversation.py new file mode 100755 index 0000000..11129c2 --- /dev/null +++ b/voice/record-a-conversation.py @@ -0,0 +1,33 @@ +#!/usr/bin/env python3 +# `eventMethod` is a required workaround currently, otherwise `/webhooks/recordings` is never called. +from flask import Flask, request, jsonify +from pprint import pprint + +app = Flask(__name__) + +@app.route("/webhooks/answer") +def answer_call(): + ncco = [ + { + "action": "talk", + "text": "Hi, welcome to this Nexmo conference call. This call is recorded for quality assurance purposes." + }, + { + "action": "conversation", + "name": "nexmo-conference-standard", + "record": "true", + "eventMethod": "POST", + "eventUrl": ["https://demo.ngrok.io/webhooks/recordings"] + } + ] + return jsonify(ncco) + +@app.route("/webhooks/recordings", methods=['POST']) +def recordings(): + data = request.get_json() + pprint(data) + return ("200") + + +if __name__ == '__main__': + app.run(port=3000) From 0013292134e20e4f4e0d29d5f4ec4acc45e0fd96 Mon Sep 17 00:00:00 2001 From: Tony Bedford Date: Wed, 2 May 2018 11:52:49 +0100 Subject: [PATCH 07/17] Formatting fix --- voice/record-a-conversation.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/voice/record-a-conversation.py b/voice/record-a-conversation.py index 11129c2..12696ab 100755 --- a/voice/record-a-conversation.py +++ b/voice/record-a-conversation.py @@ -13,11 +13,11 @@ def answer_call(): "text": "Hi, welcome to this Nexmo conference call. This call is recorded for quality assurance purposes." }, { - "action": "conversation", - "name": "nexmo-conference-standard", - "record": "true", - "eventMethod": "POST", - "eventUrl": ["https://demo.ngrok.io/webhooks/recordings"] + "action": "conversation", + "name": "nexmo-conference-standard", + "record": "true", + "eventMethod": "POST", + "eventUrl": ["https://demo.ngrok.io/webhooks/recordings"] } ] return jsonify(ncco) @@ -28,6 +28,5 @@ def recordings(): pprint(data) return ("200") - if __name__ == '__main__': app.run(port=3000) From cf815b82dcab86960758a7eda21c44d47b7def2c Mon Sep 17 00:00:00 2001 From: Tony Bedford Date: Wed, 2 May 2018 12:22:03 +0100 Subject: [PATCH 08/17] Fixed block to comply with spec (no welcome message). Plus two new blocks. --- voice/record-a-conversation.py | 6 +----- voice/retrieve-info-for-a-call.py | 12 ++++++++++++ voice/retrieve-info-for-all-calls.py | 12 ++++++++++++ 3 files changed, 25 insertions(+), 5 deletions(-) create mode 100644 voice/retrieve-info-for-a-call.py create mode 100644 voice/retrieve-info-for-all-calls.py diff --git a/voice/record-a-conversation.py b/voice/record-a-conversation.py index 12696ab..fb0f213 100755 --- a/voice/record-a-conversation.py +++ b/voice/record-a-conversation.py @@ -8,13 +8,9 @@ @app.route("/webhooks/answer") def answer_call(): ncco = [ - { - "action": "talk", - "text": "Hi, welcome to this Nexmo conference call. This call is recorded for quality assurance purposes." - }, { "action": "conversation", - "name": "nexmo-conference-standard", + "name": "CONF_NAME", "record": "true", "eventMethod": "POST", "eventUrl": ["https://demo.ngrok.io/webhooks/recordings"] diff --git a/voice/retrieve-info-for-a-call.py b/voice/retrieve-info-for-a-call.py new file mode 100644 index 0000000..52b2445 --- /dev/null +++ b/voice/retrieve-info-for-a-call.py @@ -0,0 +1,12 @@ +#!/usr/bin/env python3 +import nexmo +from pprint import pprint + +client = nexmo.Client( + application_id=APPLICATION_ID, + private_key=APPLICATION_PRIVATE_KEY_PATH, +) + +# Note call can be made to current call or a completed call +response = client.get_call("NEXMO_CALL_UUID") +pprint(response) diff --git a/voice/retrieve-info-for-all-calls.py b/voice/retrieve-info-for-all-calls.py new file mode 100644 index 0000000..13d546a --- /dev/null +++ b/voice/retrieve-info-for-all-calls.py @@ -0,0 +1,12 @@ +#!/usr/bin/env python3 +import nexmo +from pprint import pprint + +client = nexmo.Client( + application_id=APPLICATION_ID, + private_key=APPLICATION_PRIVATE_KEY_PATH, +) + +# Note call can be made to current call or a completed call +response = client.get_calls() +pprint(response) From 48a8309f22c59fe6e589fec346fa2bd809e83790 Mon Sep 17 00:00:00 2001 From: Tony Bedford Date: Wed, 2 May 2018 14:26:33 +0100 Subject: [PATCH 09/17] Ignore all private keys. Improved building block to comply more with spec. --- .gitignore | 3 ++- voice/retrieve-info-for-all-calls.py | 12 +++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) mode change 100644 => 100755 voice/retrieve-info-for-all-calls.py diff --git a/.gitignore b/.gitignore index 617d374..04f9a5e 100644 --- a/.gitignore +++ b/.gitignore @@ -88,7 +88,8 @@ ENV/ # Rope project settings .ropeproject -# nexmo key file +# nexmo key files private.key +*.key .DS_Store diff --git a/voice/retrieve-info-for-all-calls.py b/voice/retrieve-info-for-all-calls.py old mode 100644 new mode 100755 index 13d546a..3165a61 --- a/voice/retrieve-info-for-all-calls.py +++ b/voice/retrieve-info-for-all-calls.py @@ -1,12 +1,18 @@ #!/usr/bin/env python3 import nexmo from pprint import pprint +from datetime import datetime, timedelta client = nexmo.Client( application_id=APPLICATION_ID, private_key=APPLICATION_PRIVATE_KEY_PATH, ) -# Note call can be made to current call or a completed call -response = client.get_calls() -pprint(response) +DATE_END = datetime.utcnow().replace(microsecond=0).isoformat()+"Z" +DATE_START = (datetime.utcnow() - timedelta(hours=24, minutes=00)).replace(microsecond=0).isoformat()+"Z" + +params = {"date_start": DATE_START, "date_end": DATE_END} +response = client.get_calls(params) +calls = response['_embedded']['calls'] +for call in calls: + pprint(call) From aae93d45c9ba55c21a70bd2abda034c210d0f9e4 Mon Sep 17 00:00:00 2001 From: Tony Bedford Date: Wed, 2 May 2018 15:14:43 +0100 Subject: [PATCH 10/17] Pedantic change to make sure time interval exactly 24 hours. --- voice/retrieve-info-for-all-calls.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/voice/retrieve-info-for-all-calls.py b/voice/retrieve-info-for-all-calls.py index 3165a61..bcf8156 100755 --- a/voice/retrieve-info-for-all-calls.py +++ b/voice/retrieve-info-for-all-calls.py @@ -8,8 +8,9 @@ private_key=APPLICATION_PRIVATE_KEY_PATH, ) -DATE_END = datetime.utcnow().replace(microsecond=0).isoformat()+"Z" -DATE_START = (datetime.utcnow() - timedelta(hours=24, minutes=00)).replace(microsecond=0).isoformat()+"Z" +NOW = datetime.utcnow() +DATE_END = NOW.replace(microsecond=0).isoformat()+"Z" +DATE_START = (NOW - timedelta(hours=24, minutes=00)).replace(microsecond=0).isoformat()+"Z" params = {"date_start": DATE_START, "date_end": DATE_END} response = client.get_calls(params) From e18ed5819d734df4e1476ff7abedad5adb159ff8 Mon Sep 17 00:00:00 2001 From: Tony Bedford Date: Wed, 2 May 2018 15:21:17 +0100 Subject: [PATCH 11/17] File is appears to be example.env. Plus a few minor typos fixed. --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 9011ad6..3aa3ef7 100644 --- a/README.md +++ b/README.md @@ -2,14 +2,14 @@ Quickstarts also available for: [Java](https://github.com/nexmo-community/nexmo-java-quickstart), [.NET](https://github.com/nexmo-community/nexmo-dotnet-quickstart), [Node.js](https://github.com/nexmo-community/nexmo-node-quickstart), [PHP](https://github.com/nexmo-community/nexmo-php-quickstart), [Ruby](https://github.com/nexmo-community/nexmo-ruby-quickstart) -The purpose of the quickstart guide is to provide simple examples focused -on one goal. For example, sending and SMS, handling and incoming SMS webhook, -making a Text to Speech call. +The purpose of the Quickstart guide is to provide simple examples focused +on one goal. For example, sending an SMS, handling an incoming SMS webhook, +or making a Text to Speech call. ## Setup -To use this sample you will first need a [Nexmo account][sign-up]. Then rename -the `.env-example` file to `.env` and set the values as required. +To use the examples you will first need a [Nexmo account][sign-up]. Then rename +the `example.env` file to `.env` and set the values as required. For some of the examples you will need to [buy a number][buy-number]. From e8a335b9908a7bec4217a89cf92851a6ba4c5b8b Mon Sep 17 00:00:00 2001 From: Tony Bedford Date: Wed, 2 May 2018 16:00:17 +0100 Subject: [PATCH 12/17] Add new building block. --- voice/transfer-a-call.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100755 voice/transfer-a-call.py diff --git a/voice/transfer-a-call.py b/voice/transfer-a-call.py new file mode 100755 index 0000000..9abb8ea --- /dev/null +++ b/voice/transfer-a-call.py @@ -0,0 +1,12 @@ +#!/usr/bin/env python3 +import nexmo +from pprint import pprint + +client = nexmo.Client( + application_id=APPLICATION_ID, + private_key=APPLICATION_PRIVATE_KEY_PATH, +) + +dest = {"type": "ncco", "url": ["https://developer.nexmo.com/ncco/tts.json"]} +response = client.update_call(UUID, action="transfer", destination=dest) +pprint(response) From c9dcd1443b5457f6760c5f77951b5b0d590268db Mon Sep 17 00:00:00 2001 From: Tony Bedford Date: Wed, 2 May 2018 16:09:37 +0100 Subject: [PATCH 13/17] New building block. --- voice/earmuff-a-call.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 voice/earmuff-a-call.py diff --git a/voice/earmuff-a-call.py b/voice/earmuff-a-call.py new file mode 100644 index 0000000..e174171 --- /dev/null +++ b/voice/earmuff-a-call.py @@ -0,0 +1,15 @@ +#!/usr/bin/env python3 +import nexmo +import time +from pprint import pprint + +client = nexmo.Client( + application_id=APPLICATION_ID, + private_key=APPLICATION_PRIVATE_KEY_PATH, +) + +response = client.update_call(UUID, action="earmuff") +pprint(response) +time.sleep(5) +response = client.update_call(UUID, action="unearmuff") +pprint(response) From fd7ad0e94f3854d36901fa58ea70090c0d129a31 Mon Sep 17 00:00:00 2001 From: Tony Bedford Date: Wed, 2 May 2018 16:24:56 +0100 Subject: [PATCH 14/17] Add a new building block. --- voice/mute-a-call.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 voice/mute-a-call.py diff --git a/voice/mute-a-call.py b/voice/mute-a-call.py new file mode 100644 index 0000000..bfc96b7 --- /dev/null +++ b/voice/mute-a-call.py @@ -0,0 +1,15 @@ +#!/usr/bin/env python3 +import nexmo +import time +from pprint import pprint + +client = nexmo.Client( + application_id=APPLICATION_ID, + private_key=APPLICATION_PRIVATE_KEY_PATH, +) + +response = client.update_call(UUID, action="mute") +pprint(response) +time.sleep(5) +response = client.update_call(UUID, action="unmute") +pprint(response) From 67e63340a6dfe61a3f39b68db16886178cb3578d Mon Sep 17 00:00:00 2001 From: Tony Bedford Date: Wed, 2 May 2018 16:46:17 +0100 Subject: [PATCH 15/17] New building block. --- voice/connect-callers-to-a-conference.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 voice/connect-callers-to-a-conference.py diff --git a/voice/connect-callers-to-a-conference.py b/voice/connect-callers-to-a-conference.py new file mode 100644 index 0000000..abe517c --- /dev/null +++ b/voice/connect-callers-to-a-conference.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python3 +from flask import Flask, request, jsonify + +app = Flask(__name__) + + +@app.route("/webhooks/answer") +def answer_call(): + ncco = [ + { + "action": "talk", + "text": "Please wait while we connect you to the conference" + }, + { + "action": "conversation", + "name": CONF_NAME + }] + return jsonify(ncco) + + +if __name__ == '__main__': + app.run(port=3000) From 154b9bce55c05a67ed882d0241b1e32895a1a81e Mon Sep 17 00:00:00 2001 From: Tony Bedford Date: Thu, 3 May 2018 14:41:08 +0100 Subject: [PATCH 16/17] Building block for join-outbound-calls --- voice/join-outbound-calls.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100755 voice/join-outbound-calls.py diff --git a/voice/join-outbound-calls.py b/voice/join-outbound-calls.py new file mode 100755 index 0000000..d02bcb1 --- /dev/null +++ b/voice/join-outbound-calls.py @@ -0,0 +1,29 @@ +#!/usr/bin/env python3 +from flask import Flask, request, jsonify + +app = Flask(__name__) + +@app.route("/webhooks/answer") +def answer_call(): + ncco = [ + { + "action": "connect", + "from": "NEXMO_NUMBER", + "endpoint": [{ + "type": 'phone', + "number": "RECIPIENT_NUMBER_1" + }] + }, + { + "action": "connect", + "from": "NEXMO_NUMBER", + "endpoint": [{ + "type": 'phone', + "number": "RECIPIENT_NUMBER_2" + }] + } + ] + return jsonify(ncco) + +if __name__ == '__main__': + app.run(port=3000) From aa029b9d2912c1090e36841c937c0a25117b98e5 Mon Sep 17 00:00:00 2001 From: Tony Bedford Date: Tue, 22 May 2018 10:55:30 +0100 Subject: [PATCH 17/17] Updated based on Mark's feedback. --- .gitignore | 2 +- voice/record-a-call-with-split-audio.py | 2 +- voice/record-a-call.py | 2 +- voice/record-a-conversation.py | 2 +- voice/retrieve-info-for-all-calls.py | 3 +-- 5 files changed, 5 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index 04f9a5e..22b6e42 100644 --- a/.gitignore +++ b/.gitignore @@ -89,7 +89,7 @@ ENV/ .ropeproject # nexmo key files -private.key *.key .DS_Store +settings.json diff --git a/voice/record-a-call-with-split-audio.py b/voice/record-a-call-with-split-audio.py index 8c6162d..5894383 100755 --- a/voice/record-a-call-with-split-audio.py +++ b/voice/record-a-call-with-split-audio.py @@ -34,7 +34,7 @@ def answer_call(): def recordings(): data = request.get_json() pprint(data) - return ("200") + return "Webhook received" if __name__ == '__main__': app.run(port=3000) diff --git a/voice/record-a-call.py b/voice/record-a-call.py index 1190556..33c2185 100755 --- a/voice/record-a-call.py +++ b/voice/record-a-call.py @@ -33,7 +33,7 @@ def answer_call(): def recordings(): data = request.get_json() pprint(data) - return ("200") + return "webhook received" if __name__ == '__main__': app.run(port=3000) diff --git a/voice/record-a-conversation.py b/voice/record-a-conversation.py index fb0f213..05ddc64 100755 --- a/voice/record-a-conversation.py +++ b/voice/record-a-conversation.py @@ -22,7 +22,7 @@ def answer_call(): def recordings(): data = request.get_json() pprint(data) - return ("200") + return "Webhook received" if __name__ == '__main__': app.run(port=3000) diff --git a/voice/retrieve-info-for-all-calls.py b/voice/retrieve-info-for-all-calls.py index bcf8156..25cb4e4 100755 --- a/voice/retrieve-info-for-all-calls.py +++ b/voice/retrieve-info-for-all-calls.py @@ -12,8 +12,7 @@ DATE_END = NOW.replace(microsecond=0).isoformat()+"Z" DATE_START = (NOW - timedelta(hours=24, minutes=00)).replace(microsecond=0).isoformat()+"Z" -params = {"date_start": DATE_START, "date_end": DATE_END} -response = client.get_calls(params) +response = client.get_calls(date_start=DATE_START, date_end=DATE_END) calls = response['_embedded']['calls'] for call in calls: pprint(call)