Yeastar P-Series API
🇹🇭 ภาษาไทย
ภาพรวม
Yeastar P-Series มี REST API (Application Programming Interface) สำหรับ integrate กับ third-party applications เช่น Call Center, Hotel PMS, CRM และระบบอื่นๆ ใน enterprise
ข้อจำกัด: API รองรับเฉพาะรุ่น P550, P560, P570 เท่านั้น (ไม่รองรับ P520)
Firmware ขั้นต่ำ: 37.7.0.16 ขึ้นไป
ความต้องการก่อนใช้งาน
เปิดใช้งาน API บน PBX: Integrations > API > เปิด Toggle API
(ไม่บังคับ) เปิด IP Restriction — กำหนด IP ที่อนุญาตเข้าถึง API
ตั้งค่า Extension/Trunk Status Monitor ตามต้องการ
บันทึก Client ID และ Client Secret จาก PBX web portal
รูปแบบการสื่อสาร
API รองรับ 2 รูปแบบ:
รูปแบบ คำอธิบาย API Request/Response Application ส่ง HTTP request → PBX ตอบ response ทันที Event Subscription Application subscribe event → PBX push notification แบบ real-time
Protocol: HTTP (port 80) หรือ HTTPS (port 8088, แนะนำ)
Methods: GET และ POST
ทุก request ต้องใส่ header: User-Agent: OpenAPI
Authentication Flow
1. POST /openapi/v1.0/get_token
→ ส่ง username (Client ID) + password (Client Secret)
→ รับ access_token (หมดอายุ 30 นาที) + refresh_token (หมดอายุ 24 ชั่วโมง)
2. ใช้ access_token ใน URL ทุก request:
GET /openapi/v1.0/{endpoint}?access_token={token}
3. ก่อน token หมดอายุ → POST /openapi/v1.0/refresh_token
4. เสร็จแล้ว → GET /openapi/v1.0/del_token
ข้อจำกัด: แต่ละ application มี valid token พร้อมกันได้สูงสุด 8 tokens
ตัวอย่าง — ขอ Access Token
POST /openapi/v 1.0 /get_token
Host: 192.168 . 5.150 : 8088
Content-Type: application/json
User-Agent: OpenAPI
{
"username" : "UEnH9Dmv6uBJEXsYcag1trNfQThYXXXX" ,
"password" : "ZLcXl63S9EtMnYoHUnjbVo6sA8CbXXXX"
}
{
"errcode" : 0 ,
"errmsg" : "SUCCESS" ,
"access_token_expire_time" : 1800 ,
"access_token" : "EXZMpZAO86mbrKm6rFtgeb3rfcpC9uqS" ,
"refresh_token_expire_time" : 86400 ,
"refresh_token" : "SCduGecwbG9jIusiS8FxFUVn3kf0Q9R8"
}
รูปแบบ URL
{base_url}/{api_path}/{endpoint}?access_token={access_token}
ส่วน รายละเอียด base_urlhttps://{pbx_ip}:8088 หรือ http://{pbx_ip}:80 หรือ FQDNapi_pathopenapi/v1.0 (Call Report ใหม่: openapi/v2.0)endpointชื่อ endpoint เช่น extension/list access_tokenToken ที่ได้จาก get_token
สรุป Endpoints ทั้งหมด
Authentication
Method Endpoint คำอธิบาย POST get_tokenขอ access token POST refresh_tokenต่ออายุ token GET del_tokenยกเลิก token
System
Method Endpoint คำอธิบาย GET system/informationข้อมูล PBX (model, firmware, uptime) GET system/capacityความจุ (จำนวน extension, concurrent calls, AI transcription) GET system/get_menuoptionsดึง option values สำหรับสร้าง/แก้ไข features POST system/sendemailส่ง email
Extension (จัดการผู้ใช้ภายใน)
Method Endpoint คำอธิบาย GET extension/listรายการ extension ทั้งหมด GET extension/searchค้นหา extension GET extension/getดึงข้อมูล extension เดียว GET extension/queryดึงข้อมูลหลาย extension พร้อมกัน GET extension/getpasswordดึง registration password + voicemail PIN POST extension/createเพิ่ม SIP extension POST extension/send_welcome_emailส่ง Linkus welcome email POST extension/updateแก้ไข extension GET extension/deleteลบ extension
Organization
Method Endpoint คำอธิบาย GET/POST `organization/list search
Trunk (SIP Trunk)
Method Endpoint คำอธิบาย GET/POST `trunk/list search
Method Endpoint คำอธิบาย GET/POST `company_contact/list search GET/POST `phonebook/list search
Auto Provisioning (จัดการ IP Phone)
Method Endpoint คำอธิบาย GET phone/search, phone/getค้นหาและดูข้อมูล IP phone GET auto_provisioning/compatibilityดู config options สำหรับ provisioning POST `phone/batchcreate batchupdate
Routing
Method Endpoint คำอธิบาย GET/POST `inbound_route/list search GET/POST `outbound_route/list search
Voicemail
Method Endpoint คำอธิบาย GET/POST `vm/query get
IVR / Queue / Conference / Paging
Method Endpoint คำอธิบาย GET/POST `ivr/list search GET/POST `queue/list …+queue/call_status GET/POST `conference/list …+conference/start_interim GET/POST `paging/list search
Recording & CDR
Method Endpoint คำอธิบาย GET `recording/list search GET/POST `cdr/list search GET `call_report/list detail
Settings
Method Endpoint คำอธิบาย GET/POST `auto_recording/get update` GET/POST pin_list/...CRUD PIN list GET/POST blocked_number/..., allowed_number/...Blocked/Allowed numbers GET/POST `call_note/get update` GET/POST `web_server/get update` GET storage/listStorage list GET/POST certificate/...CRUD certificates GET/POST backup/... + `backup/downloadgetstatus` GET `system_log/list download`
Messaging (SMS/WhatsApp/Facebook/LiveChat)
Method Endpoint คำอธิบาย GET/POST message/channel/..., message/queue/...Message channels + queues GET/POST message/campaign/..., message/session/..., message/message/...Campaigns, sessions, messages POST sms/createส่ง SMS ผ่าน GSM/3G/4G trunk
API Feature Settings
Method Endpoint คำอธิบาย GET/POST extension_status_monitor/...ตั้งค่า extension status monitoring GET/POST trunk_status_monitor/...ตั้งค่า trunk status monitoring GET/POST `webhook/query update
Hotel
Method Endpoint คำอธิบาย GET/POST `wakeupcall/list get POST hotel/checkoutเช็คเอาท์แขก hotel
Call Control (สำคัญมาก)
Method Endpoint คำอธิบาย GET call/queryดูสถานะสายที่กำลัง active POST call/dialโทรออก (หลายประเภท) POST call/accept_inboundรับสายเข้าในโหมด inbound control POST call/refuse_inboundปฏิเสธสายเข้า POST call/listenMonitoring สาย (ดักฟัง) POST call/holdพักสาย POST call/unholdรับสายคืน POST call/muteปิดเสียง POST call/unmuteเปิดเสียง POST call/parkPark สาย GET call/park_statusดูสายที่ park อยู่ POST call/directly_forward_to_voicemailโอนสายไป voicemail POST call/transferโอนสาย (blind/attended) POST call/add_memberเพิ่มคนในสาย POST call/play_promptเล่น audio prompt POST call/hangupวางสาย POST `call/record_start record_pause
uaCSTA Call Control
Method Endpoint คำอธิบาย POST `uacsta_call/accept refuse
Event Monitoring
WebSocket vs Webhook
WebSocket Webhook รูปแบบ Long-lived connection HTTP callback (push) URL wss://{pbx}:{port}/openapi/v1.0/subscribe?access_token=...URL ที่กำหนดใน PBX settings Subscribe ส่ง {"topic_list":[30011,30012]} Auto push ทุก subscribed event Heartbeat ต้องส่งทุก 60 วินาที ไม่ต้องการ เหมาะกับ Real-time dashboard, call center Webhook integration, CRM
รายการ Events ทั้งหมด
Event ID ชื่อ คำอธิบาย 30005 Organization Status Switch State Changed สถานะ organization feature เปลี่ยน 30006 Organization Structure Changed โครงสร้าง organization เปลี่ยน 30007 Extension Registration Status Changed สถานะการลงทะเบียน extension เปลี่ยน (SIP/Linkus) 30008 Extension Call State Changed สถานะสาย extension เปลี่ยน 30009 Extension Presence State Changed Presence status extension เปลี่ยน 30010 Trunk Registration State Changed สถานะ trunk เปลี่ยน 30011 Call State Changed สถานะสายโทรศัพท์เปลี่ยน (real-time) 30012 Call End Details Notification สายวาง → ส่ง CDR ใหม่ 30013 Call Transfer Report มีการโอนสาย 30014 Call Forwarding Report มีการ forward สาย 30015 Call Failure Report สายล้มเหลว 30016 Incoming Call Request สายเข้าจาก monitored trunk 30017 DTMF Digit Report กดปุ่มระหว่างสาย 30018 Prompt Playback Completed Report เล่น audio prompt เสร็จ 30019 Satisfaction Survey Feedback แขกกด DTMF ประเมินความพึงพอใจ 30020 uaCSTA Call Report สถานะ uaCSTA call เปลี่ยน 30022 Extension Information Updated Extension ถูกสร้าง/แก้ไข/ลบ 30023 Trunk Information Updated Trunk ถูกสร้าง/แก้ไข/ลบ 30024 No-hosted Conference Host ออกจาก conference 30025 Agent Automatic Pause Agent ถูก pause อัตโนมัติ (missed calls เกิน limit) 30026 Agent Ringing Timeout Agent พลาดสายเพราะ ringing timeout 30027 Call Report Download Result ดาวน์โหลด report แบบ async เสร็จ 30028 Call Note Status Updated สถานะ call note เปลี่ยน 30029 Agent Status Changed สถานะ agent เปลี่ยน 30030 Bulk Message Sending Failed ส่ง bulk message บางส่วนล้มเหลว 30031 New Message Notification ได้รับ inbound message ใหม่ 30032 Message Sending Result ผลลัพธ์การส่ง message 30033 Recording Download Completed ดาวน์โหลด recording แบบ async เสร็จ 30034 System Event Notification (Information) System event ระดับ info 30035 System Event Notification (Warning) System event ระดับ warning
Use Cases สำหรับออฟฟิค
Scenario Endpoint/Event ที่ใช้ CRM popup เมื่อมีสายเข้าEvent 30016 + call/query Click-to-call จาก CRMcall/dialDashboard live call status Event 30011 + call/query Auto provisioning Yealink T31G phone/batchcreate + phone/batchreprovisionHotel wake-up call wakeupcall/create + hotel/checkoutExport CDR ไป databasecdr/list + Event 30012Queue monitoring queue/agent_status + Event 30029
ความเชื่อมโยง
🇬🇧 English
Overview
Yeastar P-Series provides a RESTful API for integration with third-party applications such as call centers, hotel PMS systems, CRM platforms, and other enterprise software.
Supported models: P550, P560, P570 only (P520 is NOT supported)
Minimum firmware: 37.7.0.16
Prerequisites
Enable API on the PBX: Integrations > API > Toggle API On
(Optional) Enable IP Restriction to whitelist permitted IP addresses
Configure Extension/Trunk Status Monitors as needed
Note down the Client ID and Client Secret from the PBX web portal
Communication Methods
Mode Description API Request/Response Application sends HTTP request → PBX returns response immediately Event Subscription Application subscribes to events → PBX pushes real-time notifications
Protocol: HTTP (port 80) or HTTPS (port 8088, recommended)
HTTP Methods: GET and POST only
Required header on every request: User-Agent: OpenAPI
Authentication Flow
1. POST /openapi/v1.0/get_token
→ Send username (Client ID) + password (Client Secret)
→ Receive access_token (expires in 30 min) + refresh_token (expires in 24 h)
2. Include access_token in every subsequent request URL:
GET /openapi/v1.0/{endpoint}?access_token={token}
3. Before token expires → POST /openapi/v1.0/refresh_token
4. When done → GET /openapi/v1.0/del_token
Limit: Maximum 8 simultaneous valid tokens per application.
Example — Get Access Token
POST /openapi/v 1.0 /get_token
Host: 192.168 . 5.150 : 8088
Content-Type: application/json
User-Agent: OpenAPI
{
"username" : "UEnH9Dmv6uBJEXsYcag1trNfQThYXXXX" ,
"password" : "ZLcXl63S9EtMnYoHUnjbVo6sA8CbXXXX"
}
{
"errcode" : 0 ,
"errmsg" : "SUCCESS" ,
"access_token_expire_time" : 1800 ,
"access_token" : "EXZMpZAO86mbrKm6rFtgeb3rfcpC9uqS" ,
"refresh_token_expire_time" : 86400 ,
"refresh_token" : "SCduGecwbG9jIusiS8FxFUVn3kf0Q9R8"
}
{base_url}/{api_path}/{endpoint}?access_token={access_token}
Component Details base_urlhttps://{pbx_ip}:8088 or http://{pbx_ip}:80 or FQDNapi_pathopenapi/v1.0 (Call Report v2: openapi/v2.0)endpointSpecific endpoint e.g. extension/list access_tokenToken obtained from get_token
API Endpoint Reference
Authentication
Method Endpoint Description POST get_tokenGet API access token POST refresh_tokenRefresh API access token GET del_tokenRevoke API access token
System
Method Endpoint Description GET system/informationQuery PBX info (model, firmware, uptime) GET system/capacityQuery capacity (extensions, concurrent calls, AI transcription quota) GET system/get_menuoptionsQuery option values for creating/updating features POST system/sendemailSend an email
Extension Management
Method Endpoint Description GET extension/listList all extensions GET extension/searchSearch extensions GET extension/getGet single extension details GET extension/queryGet multiple extensions at once GET extension/getpasswordGet registration password + voicemail PIN POST extension/createCreate a SIP extension POST extension/send_welcome_emailSend Linkus welcome email POST extension/updateEdit an extension GET extension/deleteDelete an extension
Organization
Method Endpoint Description GET/POST organization/list|search|get|query|create|update|deleteFull CRUD for organizations
Trunk (SIP Trunks)
Method Endpoint Description GET/POST trunk/list|search|get|query|itsp_list|create|update|deleteCRUD SIP trunks + query ITSP list
Method Endpoint Description GET/POST company_contact/...CRUD company contacts GET/POST phonebook/...CRUD phonebooks
Auto Provisioning
Method Endpoint Description GET phone/search, phone/getSearch/view IP phone details GET auto_provisioning/compatibilityQuery config options for provisioning POST phone/batchcreate|batchupdate|batchreprovision|batchreboot|batchdeleteBulk IP phone management
Routing
Method Endpoint Description GET/POST inbound_route/...CRUD inbound routes GET/POST outbound_route/...CRUD outbound routes
Voicemail
Method Endpoint Description GET/POST vm/query|get|download|create|update|delete|delete_extension_vmVoicemail message management
IVR / Queue / Conference / Paging
Method Endpoint Description GET/POST ivr/...CRUD IVR menus GET/POST queue/... + agent controlsCRUD queues + agent login/pause/status GET/POST conference/... + real-time controlsCRUD conferences + invite/kick/mute members GET/POST paging/...CRUD paging groups
Recording & CDR & Reports
Method Endpoint Description GET recording/list|search|download|playtoextensionRecording file management GET/POST cdr/list|search|download|getoption|updateoptionCDR queries + options GET call_report/list|detail|downloadCall statistics reports GET call_schedule_report/list|downloadScheduled report management
Call Control (Core Integration)
Method Endpoint Description GET call/queryQuery active call details POST call/dialInitiate a call (multiple types) POST call/accept_inboundAccept inbound call (inbound control mode) POST call/refuse_inboundRefuse inbound call POST call/listenMonitor/spy a call POST call/hold / call/unholdHold/resume a call POST call/mute / call/unmuteMute/unmute a call member POST call/park / GET call/park_statusPark a call / query parked calls POST call/directly_forward_to_voicemailForward to voicemail POST call/transferBlind or attended transfer POST call/add_memberInvite member to active call POST call/play_promptPlay audio prompt to a number POST call/hangupHang up a call POST call/record_start|record_pause|record_unpauseControl call recording
uaCSTA Call Control
Method Endpoint Description POST uacsta_call/accept|refuse|hangupControl calls via uaCSTA (IP phones)
Hotel
Method Endpoint Description GET/POST wakeupcall/list|get|query|create|update|deleteWake-up call (alarm) management POST hotel/checkoutPerform hotel guest checkout
Messaging
Method Endpoint Description GET/POST message/channel|queue|campaign|session|message/...Messaging (SMS/WhatsApp/Facebook/LiveChat) POST sms/createSend SMS via GSM/3G/4G trunk
Event Monitoring
WebSocket vs Webhook Comparison
WebSocket Webhook Connection Persistent long-lived connection HTTP callback (no persistent connection) URL wss://{pbx}:{port}/openapi/v1.0/subscribe?access_token=...User-defined URL in PBX settings Subscribe Send {"topic_list":[30011,30012]} Auto-push on subscribed events Heartbeat Required every 60 seconds Not required Best for Real-time dashboard, call control CRM webhook, automation triggers
Complete Events List
Event ID Name Trigger 30005 Organization Status Switch State Changed Organization feature enabled/disabled 30006 Organization Structure Changed Organization config modified 30007 Extension Registration Status Changed SIP/Linkus registration state change 30008 Extension Call State Changed Extension call status change 30009 Extension Presence State Changed Extension presence (DND/available/etc.) changes 30010 Trunk Registration State Changed Trunk registration state change 30011 Call State Changed Any call status change (real-time) 30012 Call End Details Notification Call ends — CDR sent 30013 Call Transfer Report Call transferred 30014 Call Forwarding Report Call forwarded 30015 Call Failure Report Call initiation failed 30016 Incoming Call Request Inbound call on monitored trunk 30017 DTMF Digit Report Key pressed during a call 30018 Prompt Playback Completed Report Audio prompt finished playing 30019 Satisfaction Survey Feedback Caller completed DTMF satisfaction survey 30020 uaCSTA Call Report uaCSTA-controlled call state change 30022 Extension Information Updated Extension created/edited/deleted 30023 Trunk Information Updated Trunk created/edited/deleted 30024 No-hosted Conference Conference host left 30025 Agent Automatic Pause Agent auto-paused (max missed calls reached) 30026 Agent Ringing Timeout Agent missed call due to ringing timeout 30027 Call Report Download Result Async report download URL ready 30028 Call Note Status Updated Call note availability changed 30029 Agent Status Changed Agent status change 30030 Bulk Message Sending Failed Message campaign partial/total failure 30031 New Message Notification Inbound message received via API channel 30032 Message Sending Result Outbound message delivery status changed 30033 Recording Download Completed Async recording download complete 30034 System Event Notification (Information) Info-level system event 30035 System Event Notification (Warning) Warning-level system event
Common Use Cases
Scenario Endpoints / Events CRM screen pop on inbound call Event 30016 + call/query Click-to-call from CRM call/dialLive call dashboard Event 30011 + call/query Auto-provision Yealink T31G phones phone/batchcreate + phone/batchreprovisionHotel wake-up calls wakeupcall/create + hotel/checkoutCDR export to database cdr/list + Event 30012Queue agent monitoring queue/agent_status + Event 30029Call recording on demand call/record_start + recording/download
Related Pages