Have a default transfer
This commit is contained in:
@@ -37,7 +37,16 @@ Run `bot_runner.py` to handle incoming HTTP requests:
|
||||
|
||||
Then target the following URL:
|
||||
|
||||
`POST /daily_start_bot`
|
||||
```bash
|
||||
curl -X POST 'http://localhost:7860/daily_start_bot' \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{
|
||||
"callId": "callId-from-call",
|
||||
"callDomain": "callDomain-from-call"
|
||||
}'
|
||||
```
|
||||
|
||||
Use [this guide](https://docs.pipecat.ai/guides/telephony/daily-webrtc) to connect a phone number purchased from Daily to the bot.
|
||||
|
||||
For more configuration options, please consult Daily's API documentation.
|
||||
|
||||
@@ -82,4 +91,4 @@ If you're using Twilio as a number vendor:
|
||||
|
||||
## Need to do something more advanced?
|
||||
|
||||
This demo covers the basics of bot telephony. If you want to know more about working with PSTN / SIP, please ping us on [Discord](https://discord.gg/pipecat).
|
||||
This demo covers the basics of bot telephony. If you want to know more about working with PSTN / SIP, please ping us on [Discord](https://discord.gg/pipecat).
|
||||
|
||||
@@ -13,7 +13,7 @@ from loguru import logger
|
||||
from openai.types.chat import ChatCompletionToolParam
|
||||
|
||||
from pipecat.audio.vad.silero import SileroVADAnalyzer
|
||||
from pipecat.frames.frames import EndFrame
|
||||
from pipecat.frames.frames import EndFrame, TextFrame
|
||||
from pipecat.pipeline.pipeline import Pipeline
|
||||
from pipecat.pipeline.runner import PipelineRunner
|
||||
from pipecat.pipeline.task import PipelineParams, PipelineTask
|
||||
@@ -103,6 +103,22 @@ Provide a concise summary in 3-5 sentences. Highlight any important details or
|
||||
context = OpenAILLMContext(messages, tools)
|
||||
context_aggregator = llm.create_context_aggregator(context)
|
||||
|
||||
async def default_transfer_call(
|
||||
function_name, tool_call_id, args, llm: LLMService, context, result_callback
|
||||
):
|
||||
logger.debug(f"default_transfer_call: {function_name} {tool_call_id} {args}")
|
||||
await result_callback(
|
||||
{
|
||||
"transfer_call": False,
|
||||
"reason": "To transfer call calls, please dial in to the room using a phone or a SIP client.",
|
||||
}
|
||||
)
|
||||
|
||||
llm.register_function(
|
||||
function_name="transfer_call",
|
||||
callback=default_transfer_call,
|
||||
)
|
||||
|
||||
pipeline = Pipeline(
|
||||
[
|
||||
transport.input(),
|
||||
@@ -119,6 +135,7 @@ Provide a concise summary in 3-5 sentences. Highlight any important details or
|
||||
@transport.event_handler("on_first_participant_joined")
|
||||
async def on_first_participant_joined(transport, participant):
|
||||
await transport.capture_participant_transcription(participant["id"])
|
||||
logger.info(participant)
|
||||
await task.queue_frames([context_aggregator.user().get_context_frame()])
|
||||
|
||||
@transport.event_handler("on_participant_left")
|
||||
|
||||
Reference in New Issue
Block a user