benjolo commited on
Commit
714dd0b
·
verified ·
1 Parent(s): df72e55

Update backend/main.py

Browse files
Files changed (1) hide show
  1. backend/main.py +20 -19
backend/main.py CHANGED
@@ -232,16 +232,16 @@ async def call_user(sid, call_id):
232
  # BO - Get call id from dictionary created during socketio connection
233
  client_id = clients[sid].client_id
234
 
235
- gunicorn_logger.warning(f"NOW TRYING TO CREATE DB RECORD FOR Caller with ID: {client_id} for call: {call_id}")
236
- # BO -> Create Call Record with Caller and call_id field (None for callee, duration, terms..)
237
- request_data = {
238
- "call_id": str(call_id),
239
- "caller_id": str(client_id),
240
- "creation_date": str(datetime.now())
241
- }
242
 
243
- response = create_calls(get_collection_calls(), request_data)
244
- print(response) # BO - print created db call record
245
 
246
  @sio.on("audio_config")
247
  async def audio_config(sid, sample_rate):
@@ -265,19 +265,20 @@ async def answer_call(sid, call_id):
265
  # BO - Get call id from dictionary created during socketio connection
266
  client_id = clients[sid].client_id
267
 
268
- # BO -> Update Call Record with Callee field based on call_id
269
- gunicorn_logger.warning(f"NOW UPDATING MongoDB RECORD FOR Caller with ID: {client_id} for call: {call_id}")
270
- # BO -> Create Call Record with callee_id field (None for callee, duration, terms..)
271
- request_data = {
272
- "callee_id": client_id
273
- }
274
-
275
- response = update_calls(get_collection_calls(), call_id, request_data)
276
- print(response) # BO - print created db call record
277
 
278
 
279
  @sio.on("incoming_audio")
280
  async def incoming_audio(sid, data, call_id):
 
281
  try:
282
  clients[sid].add_bytes(data)
283
 
@@ -305,7 +306,7 @@ async def incoming_audio(sid, data, call_id):
305
  print(f"TRANSLATED TEXT = {translated_text}")
306
 
307
  # BO -> send translated_text to mongodb as caption record update based on call_id
308
- send_captions(clients[sid].client_id, asr_text, translated_text, call_id)
309
 
310
  # TRANSLATED TEXT
311
  # PM - text_output is a list with 1 string
 
232
  # BO - Get call id from dictionary created during socketio connection
233
  client_id = clients[sid].client_id
234
 
235
+ # gunicorn_logger.warning(f"NOW TRYING TO CREATE DB RECORD FOR Caller with ID: {client_id} for call: {call_id}")
236
+ # # BO -> Create Call Record with Caller and call_id field (None for callee, duration, terms..)
237
+ # request_data = {
238
+ # "call_id": str(call_id),
239
+ # "caller_id": str(client_id),
240
+ # "creation_date": str(datetime.now())
241
+ # }
242
 
243
+ # response = create_calls(get_collection_calls(), request_data)
244
+ # print(response) # BO - print created db call record
245
 
246
  @sio.on("audio_config")
247
  async def audio_config(sid, sample_rate):
 
265
  # BO - Get call id from dictionary created during socketio connection
266
  client_id = clients[sid].client_id
267
 
268
+ # # BO -> Update Call Record with Callee field based on call_id
269
+ # gunicorn_logger.warning(f"NOW UPDATING MongoDB RECORD FOR Caller with ID: {client_id} for call: {call_id}")
270
+ # # BO -> Create Call Record with callee_id field (None for callee, duration, terms..)
271
+ # request_data = {
272
+ # "callee_id": client_id
273
+ # }
274
+
275
+ # response = update_calls(get_collection_calls(), call_id, request_data)
276
+ # print(response) # BO - print created db call record
277
 
278
 
279
  @sio.on("incoming_audio")
280
  async def incoming_audio(sid, data, call_id):
281
+ gunicorn_logger.info("RUNNNING INCOMING AUDIO FUNCTION")
282
  try:
283
  clients[sid].add_bytes(data)
284
 
 
306
  print(f"TRANSLATED TEXT = {translated_text}")
307
 
308
  # BO -> send translated_text to mongodb as caption record update based on call_id
309
+ # send_captions(clients[sid].client_id, asr_text, translated_text, call_id)
310
 
311
  # TRANSLATED TEXT
312
  # PM - text_output is a list with 1 string