跳轉到主要內容
POST
https://api.pathors.com
/
project
/
{projectId}
/
integration
/
phone
/
call
/
outbound
建立通話
curl --request POST \
  --url https://api.pathors.com/project/{projectId}/integration/phone/call/outbound \
  --header 'Authorization: <authorization>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "fromNumber": "<string>",
  "toNumber": "<string>",
  "dynamicVariables": {}
}
'
{
  "success": true
}
建立外撥電話,從已設定的電話號碼向目標號碼發起電話通話。

基礎 URL

https://api.pathors.com

端點

POST https://api.pathors.com/project/{projectId}/integration/phone/call/outbound

路徑參數

projectId
string
必填
您的專案 ID

請求標頭

Authorization
string
必填
使用您的 API 金鑰進行 Bearer 令牌認證

請求體

fromNumber
string
必填
撥打電話的來源號碼。此號碼必須在您專案的 SIP 中繼設定中配置,且外呼狀態設為 ‘active’
toNumber
string
必填
要撥打的目標電話號碼。應使用 E.164 格式(例如:+1234567890)。台灣電話號碼請使用本地格式,無需 +886 國家碼前綴(例如:0912345678)。
dynamicVariables
object
可選的動態變數,傳遞給通話流程。這些變數可在您的通話流程配置中使用
請求範例:
curl -X POST \
  -H "Authorization: Bearer <your_api_key>" \
  -H "Content-Type: application/json" \
  -d '{
    "fromNumber": "+1234567890",
    "toNumber": "+0987654321",
    "dynamicVariables": {
      "customerName": "John Doe",
      "orderId": "12345"
    }
  }' \
  https://api.pathors.com/project/proj_abc123/integration/phone/call/outbound

回應

返回成功回應,表示外呼電話事件已建立。
success
boolean
指示通話事件是否成功建立
回應範例:
{
  "success": true
}

錯誤回應

狀態碼描述
400缺少必要欄位(fromNumbertoNumber)或請求體無效
401無效的身份驗證(API 金鑰無效或缺失)
404指定的電話號碼(fromNumber)未配置為外呼電話,或外呼狀態未啟用
409目標電話號碼(toNumber)已在通話佇列中
500內部伺服器錯誤
錯誤回應範例:
{
  "error": "The given phone number is not configured for outbound"
}

使用說明

  • 電話號碼配置fromNumber 必須在您專案的 SIP 中繼設定中配置,且需滿足:
    • 外呼 SIP 狀態設為 ‘active’
  • 通話佇列:每個 toNumber 在佇列中一次只能有一個活動通話。如果您嘗試建立一個已存在於佇列中的號碼通話,將收到 409 錯誤。
  • 動態變數:使用 dynamicVariables 將自訂資料傳遞給您的通話流程。這些變數在整個通話會話中可用,可用於個人化或通話路由邏輯。