FreeSWITCH调用接口 监听 多方通话 强转 抢接等
1. 查询分机状态
curl -H "Authorization:Nway token " http://192.168.1.115:8082/api/extension_info/1002
2. 设置分机忙闲
//idle or busy //idle意为设置为闲 //busy意为设置为忙
curl -H "Content-Type: application/json" -d '{"Extension":"1002","Value":"idle" }' -H "Authorization:Nway token " http://192.168.1.115:8082/api/extension_seatstatus
3. 设置分机上线下线
//up or down //up为上线
//down为下线
curl -H "Content-Type: application/json" -d '{"Extension":"1002","Value":"up" }' -H "Authorization:Nway token " http://192.168.1.115:8082/api/extension_seatstate
4. 设置分机呼叫状态
//ring,talking,ivr,ready //ring 振铃中 //talking通话中 //ivr 语音导航中 //ready 准备就绪,可以通话
curl -H "Content-Type: application/json" -d '{"Extension":"1002","Value":"ring" }' -H "Authorization:Nway token " http://192.168.1.115:8082/api/extension_callstate
5 token 认证:
curl -d '{"username": "admin", "password": "admin"}' -H "Content-Type:application/json" http://192.168.1.115:8082/api/login
6 获取一个系统生成的uuid:
curl -H "Authorization:Nway token " http://192.168.1.115:8082/api/get_uuid
7 获取一个正在通话中的电话的uuid:
curl -H "Authorization:Nway token " http://192.168.1.115:8082/api/get_phone_uuid/1002
8 挂断一个正通话中电话
curl -H "Authorization:Nway token " http://192.168.1.115:8082/api/hangup/1002
9 hold一个通话
curl -H "Authorization:Nway token " http://192.168.1.115:8082/api/hold/1002
10 unhold一个通话
curl -H "Authorization:Nway token " http://192.168.1.115:8082/api/unhold/1002
11 发起一个呼叫
//Job_uuid 源主叫uuid get_uuid获得
Callername sip里的name
Callernum aleg 号码
Calleenum bleg 号码
A_gatewayname 如果a是外线,则要指定a的出局网关
B_gatewayname 如果b是外线,则要指定b的出局网关
A_effective_caller_id_num a到b显示的号码
B_effective_caller_id_num b到a在a上显示的号码
A_external false,true,标记a是不是外线
B_external false,true,标记b是不是外线
curl -H "Content-Type: application/json" -d '{"Job_uuid":"1234","Callername":"1002","Callernum":"1002","Calleenum":"1000","A_gatewayname":"","B_gatewayname":"","A_effective_caller_id_num":"1002","B_effective_caller_id_num":"1000","A_external":"false","B_external":"false"}' -H "Authorization:Nway token " http://192.168.1.115:8082/api/originate
12 按uuid桥接两个通话通道
A_uuid A的uuid
B_uuid B的uuid
curl -H "Content-Type: application/json" -d '{"A_uuid":"aleguuid","B_uuid":"bleguuid"}' -H "Authorization:Nway token " http://192.168.1.115:8082/api/bridge
13 按号码桥接两个通话通道
同上,把uuid直接使用号码
curl -H "Content-Type: application/json" -d '{"A_phone":"1002","B_phone":"1003"}' -H "Authorization:Nway token " http://192.168.1.115:8082/api/bridge_phone
14 park一个通话
挂起一个号码
curl -H "Authorization:Nway token " http://192.168.1.115:8082/api/park/1002
15 抢接一个来电
把最后一个来电抢接过来
curl -H "Authorization:Nway token " http://192.168.1.115:8082/api/intercept/1002
16 由平台应答
curl -H "Authorization:Nway token " http://192.168.1.115:8082/api/answer/1002
17 按号码监听
EvdedPhone 被监听的号码
EvdPhone 由哪个号码监听
EvdGateway 如果是外线号码进行监听,则需要指定网关
curl -H "Content-Type: application/json" -d '{"EvdedPhone":"1002","EvdPhone":"1003","EvdGateway":""}' -H "Authorization:Nway token " http://192.168.1.115:8082/api/eavesdrop
18 多方通话
为了减少代码量,所以使用了和监听一样的名称
EvdedPhone 邀请加入多方通话的的号码
EvdPhone 邀请加入的多方通话里有哪个号码在通话
EvdGateway 如果是外线号码,则需要指定网关
curl -H "Content-Type: application/json" -d '{"EvdedPhone":"1002","EvdPhone":"1003","EvdGateway":""}' -H "Authorization:Nway token " http://192.168.1.115:8082/api/threeway
19 耳语
为了减少代码量,所以使用了和监听一样的名称
EvdedPhone 被监听的的号码
EvdPhone 监听的号码
EvdGateway 如果是外线号码,则需要指定网关
curl -H "Content-Type: application/json" -d '{"EvdedPhone":"1002","EvdPhone":"1003","EvdGateway":""}' -H "Authorization:Nway token " http://192.168.1.115:8082/api/whisper
20 preanswer
curl -H "Authorization:Nway token. . " http://192.168.1.115:8082/api/preanswer/1002
21 给已answer的通道放音
PhoneNumber 准备放音的号码
FilePath 语音文件路径
Loopplay 不间断循环
curl -H "Content-Type: application/json" -d '{"PhoneNumber":"1002","FilePath":"D:\nwaytest.wav","Loopplay":"true"}' -H "Authorization:Nway . . " http://192.168.1.115:8082/api/playback
22 中止相关操作
curl -H "Authorization:Nway token " http://192.168.1.115:8082/api/break/1002
23 录音
PhoneNumber 准备录音的号码
FilePath 语音文件路径
Flag 开始就录制
Limit 0即通话哪怕是一秒也录制,如果是5,则如果通话低于5就不保存
curl -H "Content-Type: application/json" -d '{"PhoneNumber":"1002","Filepath":"nwaytestr.wav","Flag":"start","Limit":"0"}' -H "Authorization:Nway token " http://192.168.1.115:8082/api/record
24 发送dtmf
PhoneNumber 准备发送dtmf的号码
Dtmf dtmf
curl -H "Content-Type: application/json" -d '{"PhoneNumber":"1002","Dtmf":"18621575908"}' -H "Authorization:Nway token " http://192.168.1.115:8082/api/senddtmf
25 发送传真
PhoneNumber 目标号码
GatewayName gw名称,如果为空,则只是发到内线的
FaxFile 传真文件名,是转成的tiff文件
curl -H "Content-Type: application/json" -d '{"PhoneNumber":"02112345678","GatewayName":"fax","FaxFile","/tmp/av.tiff" }' -H "Authorization:Nway token " http://192.168.1.115:8082/api/send_fax