Summit Apps Q&A
kennytlaloc at March 14th, 2017 15:48 — #1
Is there a way via the API to retrieve a recording based on it id?
I am trying to have Summit to the recording and gather info then have another system, pull that call information as well as the recording to use/download.
kennytlaloc at March 21st, 2017 14:14 — #2
Here is the code where I am trying to retrieve a recording from another application datastore. Then I am trying to play that recording back via another application to a caller.
local rec = require("summit.recording")
local datastore = require("summit.datastore")
local my_table, err = datastore.get_table("CallBackInfoList","list","xxxxxxxx-1183-4294-xxxx-cbdxxxx5820c")
if err then
print("No Table Found")
--Return information from table using UUID
local my_row, err = my_table:get_row_by_key("xx007700-xx5f-445b-a4xx-cc6fffxxx93a")
if err then
--Loop through table and assign the recording id to variable
for k,v in pairs (my_row.data) do
if k == 2 then
rec_id = v
--Try to create a RecordingResult by passing rec_id into recording
local rec_result = rec(rec_id)
--Making sure I am referencing actual recordings in the Summit platform. This rec_result always returns nil.
--Therefore I can't access that recording to play to the caller.
aaron at March 21st, 2017 21:36 — #3
Ken, I'm not seeing anything off that stands out directly in your code. Can you send me the recording.id via email? We can look into whether it exists as a file, etc. Thanks!
kennytlaloc at March 22nd, 2017 20:53 — #4
I did figure it out with your help Aaron. For anyone else who is interested here is what happened...
- I recorded a greeting in one app (MyApp)
- In a second app MySecondApp I accessed the datastore from MyApp and returned the Recording ID from the recording in step 1 (or so I thought).
First Mistake: Using the Simulator when testing the logic. I had actual recordings and when running the simulator it put "pseudo" recording ids in the datastore. So I had actual and pseudo recordings and was probably referencing on that was actually nil (or did not exist).
Second Mistake: When I was trying to write the Recording ID into the datastore, i was getting an error about userdata and JSON. So I wrapped the Recording ID in a tostring(), which made it a string.
When I removed the tostring, I realized that all I needed to write to the datastore was Recording_ID.id. When I returned that and passed it into the recording() method recording(rec_id), it worked.