Open Vortigern-source opened 4 hours ago
I encountered the same issue with:
await llm.push_frame(EndTaskFrame(), FrameDirection.UPSTREAM)
So, I had to create a function and ask the bot to execute it with function calling:
async def hangup_call(function_name, tool_call_id, args, llm, context, result_callback):
url = f"https://api.twilio.com/2010-04-01/Accounts/{TWILIO_ACCOUNT_SID}/Calls/{call_sid}.json"
data = {"Status": "completed"}
response = requests.post(
url,
data=data,
auth=HTTPBasicAuth(TWILIO_ACCOUNT_SID, TWILIO_AUTH_TOKEN),
)
# Check the response
if response.status_code == 200:
print(f"Call ended successfully: {call_sid}.")
else:
print(f"Error ending call: {response.status_code} - {response.text}")
await result_callback()
However, with this approach, I always had to say "bye" to trigger the function. I haven't managed to make the bot trigger it when needed automatically.
But if you tell the bot to use the function wont it use it automatically?
Description
Is this reporting a bug or feature request? Bug
If reporting a bug, please fill out the following:
Environment
Issue description
Provide a clear description of the issue.
Trying to end call from the bot side doesnt end the call. It just ends the websocket connection with causes the call to stay on. It should ideally end the call as in hang it up.
Function used:
`import os from twilio.rest import Client from pipecat.frames.frames import EndFrame, TTSSpeakFrame, EndTaskFrame from pipecat.processors.frame_processor import FrameDirection
async def hangup_call(function_name, tool_call_id, args, llm, context, result_callback): print("End call function called") print(f"Function name: {function_name}") print(f"Context: {context}") for key, value in args.items(): print(f"{key}: {value}")
Repro steps
List the steps to reproduce the issue.
Expected behavior
Call Should be hung / ended.
Actual behavior
The call isnt being ended, instead it just ends the websocket connection and the call is still connected.
Logs