API工具:Postman
API工具获取:https://dl.pstmn.io/download/latest/win64
密码转换工具:https://www.miraclesalad.com/webtools/md5.php
OIAD大部分的API函数都需要token,所以需要使用登录请求来获取token,该token的有效期为600秒,可以在页面设置有效期的时间。
图2-1 有效期设置界面
选择POST,输入http://设备IP/controller/API函数,在Body栏里输入{"username":"用户名","password":"转换后的密码"},最后点击Send,
图2-2 获取token界面
如果获取的token快超时了,但没有其他API需要使用,但不想重新获取token,可以手动刷新token的有效期时间。在POST栏里输入http://设备IP/controller/API函数,在Body栏里输入{"token":"95c2302f649e366813420cd6567d88b3"},最后点击Send,响应如图所示即刷新成功。
图2-3 刷新时间界面
选择POST,输入http://设备IP/controller/API函数,在Body栏里输入{"username":"用户名","password":"转换后的密码"},最后点击Send,可以通过底部的响应框看到是否发送成功。成功的响应应该是
{
"uri": "auth/login",
"msg": "",
"code": 200,
"data": {
"level": "admin",
"token": "582f5126c311231224922ee980311834"
}
}
图1-1 登录请求示例
登录后获取到token,然后用于VOIP设置和其他接口,下面是VOIP设置的示例
选择POST,输入http://设备IP/controller/API函数,在Body栏里输入
{
"sip_anonymous": "no",
"in_ringtime": 65,
"out_ringtime": 65,
"user_agent": "OIAD",
"timer_t1": 500,
"timer_t2": 4000,
"allow_tx_hash_in_uri": "no",
"timers": "yes",
"timers_min_se": 100,
"timers_sess_expires": 2000,
"cadence": [
"250,250,500,1000,250,250,500,4000",
"250,250,500,1000,250,250,500,4000",
"250,250,500,1000,250,250,500,4000",
"250,250,500,1000,250,250,500,4000",
"250,250,500,1000,250,250,500,4000",
"250,250,500,1000,250,250,500,4000",
"250,250,500,1000,250,250,500,4000",
"250,250,500,1000,250,250,500,4000",
"250,250,500,1000,250,250,500,4000",
"250,250,500,1000,250,250,500,4000"
],
"sip_cid2": 1,
"calltimeout": 43200000,
"net_failover": "no",
"early_media": "yes",
"ring_cadence": 0,
"ring_alert_info": [
{
"Bellcore-dr3": "1"
},
{
"Bellcore-dr5": "4"
}
],
"ring_caller_id": [
{
"10": "1"
},
{
"102": "5"
},
{
"": "1"
},
{
"": "1"
},
{
"1": "1"
}
],
"g723_rate": "63",
"ilbc_mode": "30",
"token":"582f5126c311231224922ee980311834"
}
最后点击Send,可以通过底部的响应框看到是否发送成功。成功的响应应该是
{
"uri": "analog/voip_set",
"msg": "",
"code": 200,
"data": []
}
图4-1 VOIP设置示例
如果API文档里Client→Server Request没有任何提示,就是默认填token即可。