When using agents v1 or higher, how can the agent ...
# ask-ai
s
When using agents v1 or higher, how can the agent grab and print all the SIP headers/metadata passed in the call
t
Thanks for reaching out, Sameer. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
To grab and print all the SIP headers/metadata passed in a call when using agents v1 or higher, you can utilize the
storeMetadata
and
getMetadata
methods of the
AgentCallContext
class. Here's how you can do it:
Copy code
// Store metadata
context.storeMetadata("sipHeaders", headers);

// Retrieve metadata
const sipHeaders = context.getMetadata("sipHeaders");
console.log(sipHeaders); // Print the SIP headers
These methods allow you to store and retrieve arbitrary metadata during an agent call. Sources: AgentCallContext | LiveKit Agents | AgentCallContext | LiveKit Agents