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 - 接受设备或设备 ID 的实例。这定义了您要使用哪个设备来拨打电话。$callee - 您要呼叫的电话号码。$callerId (可选)- 如果您想向其他被叫方显示不同的号码,请设置此参数。跳过时,将使用$device编号。 $ sipgate -> call ( $ device , $ callee , $ callerId );返回呼叫的会话 ID。
挂断正在进行的通话:
使用hangup()方法挂断正在进行的通话。方法接受呼叫 ID 作为参数:
$ sipgate -> hangup ( ' ABC-123 ' );记录正在进行的通话:
使用record()方法记录正在进行的通话。方法接受 3 个参数:
$callId - 唯一的呼叫 ID。$value - true或false ,定义记录的开始或停止。$announcement - true或false ,定义是否要播放有关正在录制的呼叫的通知。 $ sipgate -> record ( $ callId , $ value , $ announcement );通话记录:
使用history()方法获取通话记录。方法接受选项数组:
connectionIds - array ,定义扩展列表types - array ,定义您想要在历史记录中接收的类型列表,可能包含以下多个值之一:“CALL”、“VOICEMAIL”、“SMS”、“FAX”directions - array ,定义您想要在历史记录中接收的呼叫方向列表,可能包含以下多个值之一:“INCOMING”、“OUTGOING”、“MISSED_INCOMING”、“MISSED_OUTGOING”archived - bool ,如果您只想接收存档的历史项目,则设置truestarred - 定义您是否要接收已加星标或未加星标的历史记录项目,其中之一:“已加星标”、“未加星标”from - 定义历史记录的开始日期。必须采用 ISO8601 格式to - 定义历史记录的结束日期。必须采用 ISO8601 格式phonenumber - 定义要在历史记录中搜索的电话号码limit - 定义历史项目的“每页”值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 请参阅变更日志以了解最近更改的更多信息。
详细信息请参阅贡献。
如果您发现任何与安全相关的问题,请发送电子邮件至 [email protected],而不是使用问题跟踪器。
麻省理工学院许可证 (MIT)。请参阅许可证文件以获取更多信息。