https://retellai.com/?utm_source=discord&utm_medium=seo logo
- when i forward a sip call to you, i can also sen...
# ❓・ai-evy-support
d
@AI Evy - when i forward a sip call to you, i can also send a unique idenfier for me to recongize the call ?
a
Thanks for tagging me @dj.ufk. I'll look through relevant sources and get back to you shortly.
### Answer Yes, when you forward a SIP call to Retell AI, you can send a unique identifier to recognize the call using the
metadata
field [(1) ]() . When registering a phone call via the Register Phone Call API, you can include an arbitrary object in the
metadata
parameter . This field is for storage purposes only and is not used for processing, but you can retrieve it later from the call object . Here's how you would structure it:
Copy code
json
{
  "agent_id": "oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD",
  "from_number": "+12137771234",
  "to_number": "+12137771235",
  "direction": "inbound",
  "metadata": {
    "your_unique_identifier": "your_value_here"
  }
}
The
metadata
object allows you to put anything you need, like your internal customer ID associated with the call . You can later retrieve this field from the call object to recognize and track your calls . Additionally, you can add custom SIP headers using the
custom_sip_headers
field, which are forwarded to your SIP provider on the SIP INVITE and can be used for custom routing, tagging, or metadata [(2) ]() . All header names must start with
X-
.
​ To learn more, see the sources I considered: [[1] Register Phone Call](https://docs.retellai.com/api-references/register-phone-call) [[2] Call Transfer Node](https://docs.retellai.com/build/conversation-flow/call-transfer-node) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
d
@AI Evy - i don't understand ,so for each call that i send before sending the call i need to send a register phone call request to your servers with the metadata ?
a
Thanks for the follow-up, @dj.ufk. I'll get back to you soon.
### Answer Yes, when using the Dial to SIP URI method with custom telephony, you need to register each phone call with Retell's servers before forwarding the SIP call [(1) ]() . Here's the workflow: 1. Register the call first - Make a POST request to the Register Phone Call API endpoint with your
metadata
and other required parameters [(2) ]() 2. Get the
call_id
- The API returns a
call_id
in the response 3. Forward the SIP call - Use that
call_id
to construct the SIP URI and forward your call to Retell [(1) ]() The SIP URI format is:
sip:{call_id}@sip.retellai.com
Here's an example of registering the call:
Copy code
javascript
import Retell from 'retell-sdk';
const client = new Retell({
 apiKey: 'YOUR_RETELL_API_KEY',
}) ;
const phoneCallResponse = await client.call.registerPhoneCall({
 agent_id: 'oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD',
}) ;
console.log(phoneCallResponse.agent_id) ;
[(2) ]() You can include your unique identifier in the
metadata
field:
Copy code
json
{
  "agent_id": "oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD",
  "from_number": "+12137771234",
  "to_number": "+12137771235",
  "direction": "inbound",
  "metadata": {
    "your_unique_identifier": "your_value_here"
  }
}
The
metadata
object is for storage purposes only and can be retrieved later from the call object . **Note**: If you're using Elastic SIP Trunking instead (the recommended method) , you don't need to register calls manually - the SIP trunk connection handles this automatically [(1) ]() .
​ To learn more, see the sources I considered: [[1] Custom Telephony Overview](https://docs.retellai.com/deploy/custom-telephony) [[2] Register Phone Call](https://docs.retellai.com/api-references/register-phone-call) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.