PHP 7.1 ขึ้นไป และส่วนขยาย json
composer require innoscripta/ sipgate เริ่มต้นคลาส sipgate :
$ sipgate = Orkhanahmadov sipgate sipgate ();การรับรองความถูกต้องขั้นพื้นฐาน
คุณสามารถส่งชื่อผู้ใช้และรหัสผ่านการรับรองความถูกต้องพื้นฐานเมื่อเริ่มต้นคลาส:
$ sipgate = Orkhanahmadov sipgate sipgate ( ' [email protected] ' , ' secret ' ); หรือคุณสามารถตั้งค่าการรับรองความถูกต้องพื้นฐานด้วยวิธี setBasicAuthCredentials() :
$ sipgate = Orkhanahmadov sipgate sipgate ();
$ sipgate -> setBasicAuthCredentials ( ' [email protected] ' , ' secret ' );ข้อมูลบัญชี:
$ sipgate -> account ();ส่งกลับอาร์เรย์ของรายละเอียดบัญชี
รับผู้ใช้:
$ sipgate -> users (); ส่งคืนอาร์เรย์ของผู้ใช้ที่ลงทะเบียนภายใต้บัญชี แต่ละรายการในอาร์เรย์เป็นอินสแตนซ์ของ Orkhanahmadov sipgate ResourcesUser และมีคุณสมบัติดังต่อไปนี้:
$ user -> id ; // string
$ user -> firstname ; // string
$ user -> lastname ; // string
$ user -> email ; // string
$ user -> defaultDevice ; // string
$ user -> busyOnBusy ; // bool
$ user -> addressId ; // string
$ user -> directDialIds ; // array
$ user -> admin ; // boolรับอุปกรณ์ของผู้ใช้:
ในการรับอุปกรณ์ของผู้ใช้ให้ใช้เมธอด devices() และส่งอินสแตนซ์ผู้ใช้หรือ ID ผู้ใช้
$ sipgate -> devices ( $ user );
// or
$ sipgate -> devices ( ' ABC-123 ' ); ส่งคืนอาร์เรย์ของอุปกรณ์ที่ลงทะเบียนสำหรับผู้ใช้ที่กำหนด แต่ละรายการในอาร์เรย์เป็นอินสแตนซ์ของ Orkhanahmadov sipgate ResourcesDevice และมีคุณสมบัติดังต่อไปนี้:
$ device -> id ; // string
$ device -> alias ; // string
$ device -> type ; // string
$ device -> online ; // bool
$ device -> dnd ; // bool
$ device -> activePhonelines ; // array
$ device -> activeGroups ; // array
$ device -> credentials ; // array
$ device -> registered ; // array
$ device -> emergencyAddressId ; // string
$ device -> addressUrl ; // stringสายที่ใช้งานอยู่:
ใช้เมธอด calls() เพื่อรับรายการการโทรที่มีอยู่ในปัจจุบัน
$ sipgate -> calls (); ส่งคืนอาร์เรย์ของการโทรที่มีอยู่ในปัจจุบัน แต่ละรายการในอาร์เรย์เป็นอินสแตนซ์ของ Orkhanahmadov sipgate ResourcesCall และมีคุณสมบัติดังต่อไปนี้:
$ call -> id ; // string
$ call -> firstname ; // string
$ call -> lastname ; // string
$ call -> email ; // string
$ call -> defaultDevice ; // string
$ call -> busyOnBusy ; // bool
$ call -> addressId ; // string
$ call -> directDialIds ; // array
$ call -> admin ; // boolเริ่มการโทรใหม่:
ใช้เมธอด call() เพื่อเริ่มต้นการโทรใหม่ วิธีการยอมรับ 3 พารามิเตอร์:
$device - ยอมรับอินสแตนซ์ของอุปกรณ์หรือรหัสอุปกรณ์ นี่เป็นการกำหนดอุปกรณ์ที่คุณต้องการใช้ในการโทรออก$callee - หมายเลขโทรศัพท์ที่คุณต้องการโทร$callerId (เป็นทางเลือก) - ตั้งค่าพารามิเตอร์นี้หากคุณต้องการแสดงหมายเลขอื่นแก่ผู้โทรรายอื่น เมื่อข้ามหมายเลข $device จะถูกนำมาใช้ $ sipgate -> call ( $ device , $ callee , $ callerId );ส่งคืน ID เซสชันการโทร
วางสายที่กำลังสนทนาอยู่:
ใช้เมธอด hangup() เพื่อวางสายที่กำลังสนทนาอยู่ วิธีการยอมรับรหัสการโทรเป็นพารามิเตอร์:
$ sipgate -> hangup ( ' ABC-123 ' );บันทึกการโทรที่กำลังดำเนินอยู่:
ใช้เมธอด record() เพื่อบันทึกการโทรที่กำลังสนทนาอยู่ วิธีการยอมรับ 3 พารามิเตอร์:
$callId - รหัสการโทรที่ไม่ซ้ำ$value - true หรือ false กำหนดจุดเริ่มต้นหรือหยุดการบันทึก$announcement - true หรือ false กำหนดว่าคุณต้องการเล่นประกาศเกี่ยวกับการบันทึกการโทรหรือไม่ $ sipgate -> record ( $ callId , $ value , $ announcement );ประวัติการโทร:
ใช้เมธอด history() เพื่อรับประวัติการโทร วิธีการยอมรับอาร์เรย์ของตัวเลือก:
connectionIds - array กำหนดรายการส่วนขยายtypes - array กำหนดรายการประเภทที่คุณต้องการรับในประวัติ อาจมีค่าใดค่าหนึ่งต่อไปนี้: "CALL", "ข้อความเสียง", "SMS", "แฟกซ์"directions - array กำหนดรายการเส้นทางการโทรที่คุณต้องการรับในประวัติศาสตร์ อาจมีค่าใดค่าหนึ่งต่อไปนี้: "INCOMING", "OUTGOING", "MISSED_INCOMING", "MISSED_OUTGOING"archived - bool ตั้งค่าเป็น true หากคุณต้องการรับเฉพาะรายการประวัติที่เก็บถาวรstarred - กำหนดว่าคุณต้องการรับรายการที่ติดดาวของรายการประวัติที่ยังไม่ได้ติดดาวหรือไม่ หนึ่งในนั้น: "ติดดาว", "ไม่ได้ติดดาว"from - กำหนดวันที่เริ่มต้นของประวัติ ต้องอยู่ในรูปแบบ ISO8601to - กำหนดวันที่สิ้นสุดของประวัติ ต้องอยู่ในรูปแบบ ISO8601phonenumber - กำหนดหมายเลขโทรศัพท์เพื่อค้นหาในประวัติlimit - กำหนดค่า "ต่อหน้า" สำหรับรายการประวัติoffset - กำหนดค่า "offset" สำหรับรายการประวัติ $ sipgate -> history ([ ' from ' => ' 2019-07-10T19:32:18Z ' , ' to ' => ' 2019-07-22T19:32:18Z ' ]); ส่งกลับอาร์เรย์ของรายการประวัติ แต่ละรายการในอาร์เรย์เป็นอินสแตนซ์ของ Orkhanahmadov sipgate ResourcesHistory และมีคุณสมบัติดังต่อไปนี้:
$ history -> id ; // string
$ history -> source ; // string
$ history -> target ; // string
$ history -> sourceAlias ; // string
$ history -> targetAlias ; // string
$ history -> type ; // string
$ history -> created ; // string
$ history -> lastModified ; // string
$ history -> direction ; // string
$ history -> incoming ; // bool
$ history -> status ; // string
$ history -> connectionIds ; // array
$ history -> read ; // bool
$ history -> archived ; // bool
$ history -> note ; // string
$ history -> endpoints ; // array
$ history -> starred ; // bool
$ history -> labels ; // array
$ history -> callId ; // string
$ history -> recordingUrl ; // string
$ history -> recordings ; // array
$ history -> duration ; // int
$ history -> responder ; // string
$ history -> responderAlias ; // string composer test โปรดดู CHANGELOG สำหรับข้อมูลเพิ่มเติมว่ามีอะไรเปลี่ยนแปลงเมื่อเร็วๆ นี้
โปรดดูการมีส่วนร่วมเพื่อดูรายละเอียด
หากคุณพบปัญหาที่เกี่ยวข้องกับความปลอดภัย โปรดส่งอีเมลไปที่ [email protected] แทนการใช้ตัวติดตามปัญหา
ใบอนุญาตเอ็มไอที (MIT) โปรดดูไฟล์ใบอนุญาตสำหรับข้อมูลเพิ่มเติม