Background: #fff
Foreground: #000
PrimaryPale: #8cf
PrimaryLight: #18f
PrimaryMid: #04b
PrimaryDark: #014
SecondaryPale: #ffc
SecondaryLight: #fe8
SecondaryMid: #db4
SecondaryDark: #841
TertiaryPale: #eee
TertiaryLight: #ccc
TertiaryMid: #999
TertiaryDark: #666
Error: #f88
<!--{{{-->
<div class='toolbar' macro='toolbar [[ToolbarCommands::EditToolbar]]'></div>
<div class='title' macro='view title'></div>
<div class='editor' macro='edit title'></div>
<div macro='annotations'></div>
<div class='editor' macro='edit text'></div>
<div class='editor' macro='edit tags'></div><div class='editorFooter'><span macro='message views.editor.tagPrompt'></span><span macro='tagChooser excludeLists'></span></div>
<!--}}}-->
To get started with this blank [[TiddlyWiki]], you'll need to modify the following tiddlers:
* [[SiteTitle]] & [[SiteSubtitle]]: The title and subtitle of the site, as shown above (after saving, they will also appear in the browser title bar)
* [[MainMenu]]: The menu (usually on the left)
* [[DefaultTiddlers]]: Contains the names of the tiddlers that you want to appear when the TiddlyWiki is opened
You'll also need to enter your username for signing your edits: <<option txtUserName>>
<<importTiddlers>>
<!--{{{-->
<link rel='alternate' type='application/rss+xml' title='RSS' href='index.xml' />
<!--}}}-->
<<option chkRegExpSearch>> [[RegExpSearch]]
<<option chkCaseSensitiveSearch>> [[CaseSensitiveSearch]]
<<option chkAnimate>> [[EnableAnimations]]
<!--{{{-->
<div class='header' role='banner' macro='gradient vert [[ColorPalette::PrimaryLight]] [[ColorPalette::PrimaryMid]]'>
<div class='headerShadow'>
<span class='siteTitle' refresh='content' tiddler='SiteTitle'></span>&nbsp;
<span class='siteSubtitle' refresh='content' tiddler='SiteSubtitle'></span>
</div>
<div class='headerForeground'>
<span class='siteTitle' refresh='content' tiddler='SiteTitle'></span>&nbsp;
<span class='siteSubtitle' refresh='content' tiddler='SiteSubtitle'></span>
</div>
</div>
<div id='mainMenu' role='navigation' refresh='content' tiddler='MainMenu'></div>
<div id='sidebar'>
<div id='sidebarOptions' role='navigation' refresh='content' tiddler='SideBarOptions'></div>
<div id='sidebarTabs' role='complementary' refresh='content' force='true' tiddler='SideBarTabs'></div>
</div>
<div id='displayArea' role='main'>
<div id='messageArea'></div>
<div id='tiddlerDisplay'></div>
</div>
<!--}}}-->
/*{{{*/
body {background:[[ColorPalette::Background]]; color:[[ColorPalette::Foreground]];}

a {color:[[ColorPalette::PrimaryMid]];}
a:hover {background-color:[[ColorPalette::PrimaryMid]]; color:[[ColorPalette::Background]];}
a img {border:0;}

h1,h2,h3,h4,h5,h6 {color:[[ColorPalette::SecondaryDark]]; background:transparent;}
h1 {border-bottom:2px solid [[ColorPalette::TertiaryLight]];}
h2,h3 {border-bottom:1px solid [[ColorPalette::TertiaryLight]];}

.button {color:[[ColorPalette::PrimaryDark]]; border:1px solid [[ColorPalette::Background]];}
.button:hover {color:[[ColorPalette::PrimaryDark]]; background:[[ColorPalette::SecondaryLight]]; border-color:[[ColorPalette::SecondaryMid]];}
.button:active {color:[[ColorPalette::Background]]; background:[[ColorPalette::SecondaryMid]]; border:1px solid [[ColorPalette::SecondaryDark]];}

.header {background:[[ColorPalette::PrimaryMid]];}
.headerShadow {color:[[ColorPalette::Foreground]];}
.headerShadow a {font-weight:normal; color:[[ColorPalette::Foreground]];}
.headerForeground {color:[[ColorPalette::Background]];}
.headerForeground a {font-weight:normal; color:[[ColorPalette::PrimaryPale]];}

.tabSelected {color:[[ColorPalette::PrimaryDark]];
	background:[[ColorPalette::TertiaryPale]];
	border-left:1px solid [[ColorPalette::TertiaryLight]];
	border-top:1px solid [[ColorPalette::TertiaryLight]];
	border-right:1px solid [[ColorPalette::TertiaryLight]];
}
.tabUnselected {color:[[ColorPalette::Background]]; background:[[ColorPalette::TertiaryMid]];}
.tabContents {color:[[ColorPalette::PrimaryDark]]; background:[[ColorPalette::TertiaryPale]]; border:1px solid [[ColorPalette::TertiaryLight]];}
.tabContents .button {border:0;}

#sidebar {}
#sidebarOptions input {border:1px solid [[ColorPalette::PrimaryMid]];}
#sidebarOptions .sliderPanel {background:[[ColorPalette::PrimaryPale]];}
#sidebarOptions .sliderPanel a {border:none;color:[[ColorPalette::PrimaryMid]];}
#sidebarOptions .sliderPanel a:hover {color:[[ColorPalette::Background]]; background:[[ColorPalette::PrimaryMid]];}
#sidebarOptions .sliderPanel a:active {color:[[ColorPalette::PrimaryMid]]; background:[[ColorPalette::Background]];}

.wizard {background:[[ColorPalette::PrimaryPale]]; border:1px solid [[ColorPalette::PrimaryMid]];}
.wizard h1 {color:[[ColorPalette::PrimaryDark]]; border:none;}
.wizard h2 {color:[[ColorPalette::Foreground]]; border:none;}
.wizardStep {background:[[ColorPalette::Background]]; color:[[ColorPalette::Foreground]];
	border:1px solid [[ColorPalette::PrimaryMid]];}
.wizardStep.wizardStepDone {background:[[ColorPalette::TertiaryLight]];}
.wizardFooter {background:[[ColorPalette::PrimaryPale]];}
.wizardFooter .status {background:[[ColorPalette::PrimaryDark]]; color:[[ColorPalette::Background]];}
.wizard .button {color:[[ColorPalette::Foreground]]; background:[[ColorPalette::SecondaryLight]]; border: 1px solid;
	border-color:[[ColorPalette::SecondaryPale]] [[ColorPalette::SecondaryDark]] [[ColorPalette::SecondaryDark]] [[ColorPalette::SecondaryPale]];}
.wizard .button:hover {color:[[ColorPalette::Foreground]]; background:[[ColorPalette::Background]];}
.wizard .button:active {color:[[ColorPalette::Background]]; background:[[ColorPalette::Foreground]]; border: 1px solid;
	border-color:[[ColorPalette::PrimaryDark]] [[ColorPalette::PrimaryPale]] [[ColorPalette::PrimaryPale]] [[ColorPalette::PrimaryDark]];}

.wizard .notChanged {background:transparent;}
.wizard .changedLocally {background:#80ff80;}
.wizard .changedServer {background:#8080ff;}
.wizard .changedBoth {background:#ff8080;}
.wizard .notFound {background:#ffff80;}
.wizard .putToServer {background:#ff80ff;}
.wizard .gotFromServer {background:#80ffff;}

#messageArea {border:1px solid [[ColorPalette::SecondaryMid]]; background:[[ColorPalette::SecondaryLight]]; color:[[ColorPalette::Foreground]];}
#messageArea .button {color:[[ColorPalette::PrimaryMid]]; background:[[ColorPalette::SecondaryPale]]; border:none;}

.popupTiddler {background:[[ColorPalette::TertiaryPale]]; border:2px solid [[ColorPalette::TertiaryMid]];}

.popup {background:[[ColorPalette::TertiaryPale]]; color:[[ColorPalette::TertiaryDark]]; border-left:1px solid [[ColorPalette::TertiaryMid]]; border-top:1px solid [[ColorPalette::TertiaryMid]]; border-right:2px solid [[ColorPalette::TertiaryDark]]; border-bottom:2px solid [[ColorPalette::TertiaryDark]];}
.popup hr {color:[[ColorPalette::PrimaryDark]]; background:[[ColorPalette::PrimaryDark]]; border-bottom:1px;}
.popup li.disabled {color:[[ColorPalette::TertiaryMid]];}
.popup li a, .popup li a:visited {color:[[ColorPalette::Foreground]]; border: none;}
.popup li a:hover {background:[[ColorPalette::SecondaryLight]]; color:[[ColorPalette::Foreground]]; border: none;}
.popup li a:active {background:[[ColorPalette::SecondaryPale]]; color:[[ColorPalette::Foreground]]; border: none;}
.popupHighlight {background:[[ColorPalette::Background]]; color:[[ColorPalette::Foreground]];}
.listBreak div {border-bottom:1px solid [[ColorPalette::TertiaryDark]];}

.tiddler .defaultCommand {font-weight:bold;}

.shadow .title {color:[[ColorPalette::TertiaryDark]];}

.title {color:[[ColorPalette::SecondaryDark]];}
.subtitle {color:[[ColorPalette::TertiaryDark]];}

.toolbar {color:[[ColorPalette::PrimaryMid]];}
.toolbar a {color:[[ColorPalette::TertiaryLight]];}
.selected .toolbar a {color:[[ColorPalette::TertiaryMid]];}
.selected .toolbar a:hover {color:[[ColorPalette::Foreground]];}

.tagging, .tagged {border:1px solid [[ColorPalette::TertiaryPale]]; background-color:[[ColorPalette::TertiaryPale]];}
.selected .tagging, .selected .tagged {background-color:[[ColorPalette::TertiaryLight]]; border:1px solid [[ColorPalette::TertiaryMid]];}
.tagging .listTitle, .tagged .listTitle {color:[[ColorPalette::PrimaryDark]];}
.tagging .button, .tagged .button {border:none;}

.footer {color:[[ColorPalette::TertiaryLight]];}
.selected .footer {color:[[ColorPalette::TertiaryMid]];}

.error, .errorButton {color:[[ColorPalette::Foreground]]; background:[[ColorPalette::Error]];}
.warning {color:[[ColorPalette::Foreground]]; background:[[ColorPalette::SecondaryPale]];}
.lowlight {background:[[ColorPalette::TertiaryLight]];}

.zoomer {background:none; color:[[ColorPalette::TertiaryMid]]; border:3px solid [[ColorPalette::TertiaryMid]];}

.imageLink, #displayArea .imageLink {background:transparent;}

.annotation {background:[[ColorPalette::SecondaryLight]]; color:[[ColorPalette::Foreground]]; border:2px solid [[ColorPalette::SecondaryMid]];}

.viewer .listTitle {list-style-type:none; margin-left:-2em;}
.viewer .button {border:1px solid [[ColorPalette::SecondaryMid]];}
.viewer blockquote {border-left:3px solid [[ColorPalette::TertiaryDark]];}

.viewer table, table.twtable {border:2px solid [[ColorPalette::TertiaryDark]];}
.viewer th, .viewer thead td, .twtable th, .twtable thead td {background:[[ColorPalette::SecondaryMid]]; border:1px solid [[ColorPalette::TertiaryDark]]; color:[[ColorPalette::Background]];}
.viewer td, .viewer tr, .twtable td, .twtable tr {border:1px solid [[ColorPalette::TertiaryDark]];}

.viewer pre {border:1px solid [[ColorPalette::SecondaryLight]]; background:[[ColorPalette::SecondaryPale]];}
.viewer code {color:[[ColorPalette::SecondaryDark]];}
.viewer hr {border:0; border-top:dashed 1px [[ColorPalette::TertiaryDark]]; color:[[ColorPalette::TertiaryDark]];}

.highlight, .marked {background:[[ColorPalette::SecondaryLight]];}

.editor input {border:1px solid [[ColorPalette::PrimaryMid]];}
.editor textarea {border:1px solid [[ColorPalette::PrimaryMid]]; width:100%;}
.editorFooter {color:[[ColorPalette::TertiaryMid]];}
.readOnly {background:[[ColorPalette::TertiaryPale]];}

#backstageArea {background:[[ColorPalette::Foreground]]; color:[[ColorPalette::TertiaryMid]];}
#backstageArea a {background:[[ColorPalette::Foreground]]; color:[[ColorPalette::Background]]; border:none;}
#backstageArea a:hover {background:[[ColorPalette::SecondaryLight]]; color:[[ColorPalette::Foreground]]; }
#backstageArea a.backstageSelTab {background:[[ColorPalette::Background]]; color:[[ColorPalette::Foreground]];}
#backstageButton a {background:none; color:[[ColorPalette::Background]]; border:none;}
#backstageButton a:hover {background:[[ColorPalette::Foreground]]; color:[[ColorPalette::Background]]; border:none;}
#backstagePanel {background:[[ColorPalette::Background]]; border-color: [[ColorPalette::Background]] [[ColorPalette::TertiaryDark]] [[ColorPalette::TertiaryDark]] [[ColorPalette::TertiaryDark]];}
.backstagePanelFooter .button {border:none; color:[[ColorPalette::Background]];}
.backstagePanelFooter .button:hover {color:[[ColorPalette::Foreground]];}
#backstageCloak {background:[[ColorPalette::Foreground]]; opacity:0.6; filter:alpha(opacity=60);}
/*}}}*/
/*{{{*/
* html .tiddler {height:1%;}

body {font-size:.75em; font-family:arial,helvetica; margin:0; padding:0;}

h1,h2,h3,h4,h5,h6 {font-weight:bold; text-decoration:none;}
h1,h2,h3 {padding-bottom:1px; margin-top:1.2em;margin-bottom:0.3em;}
h4,h5,h6 {margin-top:1em;}
h1 {font-size:1.35em;}
h2 {font-size:1.25em;}
h3 {font-size:1.1em;}
h4 {font-size:1em;}
h5 {font-size:.9em;}

hr {height:1px;}

a {text-decoration:none;}

dt {font-weight:bold;}

ol {list-style-type:decimal;}
ol ol {list-style-type:lower-alpha;}
ol ol ol {list-style-type:lower-roman;}
ol ol ol ol {list-style-type:decimal;}
ol ol ol ol ol {list-style-type:lower-alpha;}
ol ol ol ol ol ol {list-style-type:lower-roman;}
ol ol ol ol ol ol ol {list-style-type:decimal;}

.txtOptionInput {width:11em;}

#contentWrapper .chkOptionInput {border:0;}

.externalLink {text-decoration:underline;}

.indent {margin-left:3em;}
.outdent {margin-left:3em; text-indent:-3em;}
code.escaped {white-space:nowrap;}

.tiddlyLinkExisting {font-weight:bold;}
.tiddlyLinkNonExisting {font-style:italic;}

/* the 'a' is required for IE, otherwise it renders the whole tiddler in bold */
a.tiddlyLinkNonExisting.shadow {font-weight:bold;}

#mainMenu .tiddlyLinkExisting,
	#mainMenu .tiddlyLinkNonExisting,
	#sidebarTabs .tiddlyLinkNonExisting {font-weight:normal; font-style:normal;}
#sidebarTabs .tiddlyLinkExisting {font-weight:bold; font-style:normal;}

.header {position:relative;}
.header a:hover {background:transparent;}
.headerShadow {position:relative; padding:4.5em 0 1em 1em; left:-1px; top:-1px;}
.headerForeground {position:absolute; padding:4.5em 0 1em 1em; left:0; top:0;}

.siteTitle {font-size:3em;}
.siteSubtitle {font-size:1.2em;}

#mainMenu {position:absolute; left:0; width:10em; text-align:right; line-height:1.6em; padding:1.5em 0.5em 0.5em 0.5em; font-size:1.1em;}

#sidebar {position:absolute; right:3px; width:16em; font-size:.9em;}
#sidebarOptions {padding-top:0.3em;}
#sidebarOptions a {margin:0 0.2em; padding:0.2em 0.3em; display:block;}
#sidebarOptions input {margin:0.4em 0.5em;}
#sidebarOptions .sliderPanel {margin-left:1em; padding:0.5em; font-size:.85em;}
#sidebarOptions .sliderPanel a {font-weight:bold; display:inline; padding:0;}
#sidebarOptions .sliderPanel input {margin:0 0 0.3em 0;}
#sidebarTabs .tabContents {width:15em; overflow:hidden;}

.wizard {padding:0.1em 1em 0 2em;}
.wizard h1 {font-size:2em; font-weight:bold; background:none; padding:0; margin:0.4em 0 0.2em;}
.wizard h2 {font-size:1.2em; font-weight:bold; background:none; padding:0; margin:0.4em 0 0.2em;}
.wizardStep {padding:1em 1em 1em 1em;}
.wizard .button {margin:0.5em 0 0; font-size:1.2em;}
.wizardFooter {padding:0.8em 0.4em 0.8em 0;}
.wizardFooter .status {padding:0 0.4em; margin-left:1em;}
.wizard .button {padding:0.1em 0.2em;}

#messageArea {position:fixed; top:2em; right:0; margin:0.5em; padding:0.5em; z-index:2000; _position:absolute;}
.messageToolbar {display:block; text-align:right; padding:0.2em;}
#messageArea a {text-decoration:underline;}

.tiddlerPopupButton {padding:0.2em;}
.popupTiddler {position: absolute; z-index:300; padding:1em; margin:0;}

.popup {position:absolute; z-index:300; font-size:.9em; padding:0; list-style:none; margin:0;}
.popup .popupMessage {padding:0.4em;}
.popup hr {display:block; height:1px; width:auto; padding:0; margin:0.2em 0;}
.popup li.disabled {padding:0.4em;}
.popup li a {display:block; padding:0.4em; font-weight:normal; cursor:pointer;}
.listBreak {font-size:1px; line-height:1px;}
.listBreak div {margin:2px 0;}

.tabset {padding:1em 0 0 0.5em;}
.tab {margin:0 0 0 0.25em; padding:2px;}
.tabContents {padding:0.5em;}
.tabContents ul, .tabContents ol {margin:0; padding:0;}
.txtMainTab .tabContents li {list-style:none;}
.tabContents li.listLink { margin-left:.75em;}

#contentWrapper {display:block;}
#splashScreen {display:none;}

#displayArea {margin:1em 17em 0 14em;}

.toolbar {text-align:right; font-size:.9em;}

.tiddler {padding:1em 1em 0;}

.missing .viewer,.missing .title {font-style:italic;}

.title {font-size:1.6em; font-weight:bold;}

.missing .subtitle {display:none;}
.subtitle {font-size:1.1em;}

.tiddler .button {padding:0.2em 0.4em;}

.tagging {margin:0.5em 0.5em 0.5em 0; float:left; display:none;}
.isTag .tagging {display:block;}
.tagged {margin:0.5em; float:right;}
.tagging, .tagged {font-size:0.9em; padding:0.25em;}
.tagging ul, .tagged ul {list-style:none; margin:0.25em; padding:0;}
.tagClear {clear:both;}

.footer {font-size:.9em;}
.footer li {display:inline;}

.annotation {padding:0.5em; margin:0.5em;}

* html .viewer pre {width:99%; padding:0 0 1em 0;}
.viewer {line-height:1.4em; padding-top:0.5em;}
.viewer .button {margin:0 0.25em; padding:0 0.25em;}
.viewer blockquote {line-height:1.5em; padding-left:0.8em;margin-left:2.5em;}
.viewer ul, .viewer ol {margin-left:0.5em; padding-left:1.5em;}

.viewer table, table.twtable {border-collapse:collapse; margin:0.8em 1.0em;}
.viewer th, .viewer td, .viewer tr,.viewer caption,.twtable th, .twtable td, .twtable tr,.twtable caption {padding:3px;}
table.listView {font-size:0.85em; margin:0.8em 1.0em;}
table.listView th, table.listView td, table.listView tr {padding:0 3px 0 3px;}

.viewer pre {padding:0.5em; margin-left:0.5em; font-size:1.2em; line-height:1.4em; overflow:auto;}
.viewer code {font-size:1.2em; line-height:1.4em;}

.editor {font-size:1.1em;}
.editor input, .editor textarea {display:block; width:100%; font:inherit;}
.editorFooter {padding:0.25em 0; font-size:.9em;}
.editorFooter .button {padding-top:0; padding-bottom:0;}

.fieldsetFix {border:0; padding:0; margin:1px 0px;}

.zoomer {font-size:1.1em; position:absolute; overflow:hidden;}
.zoomer div {padding:1em;}

* html #backstage {width:99%;}
* html #backstageArea {width:99%;}
#backstageArea {display:none; position:relative; overflow: hidden; z-index:150; padding:0.3em 0.5em;}
#backstageToolbar {position:relative;}
#backstageArea a {font-weight:bold; margin-left:0.5em; padding:0.3em 0.5em;}
#backstageButton {display:none; position:absolute; z-index:175; top:0; right:0;}
#backstageButton a {padding:0.1em 0.4em; margin:0.1em;}
#backstage {position:relative; width:100%; z-index:50;}
#backstagePanel {display:none; z-index:100; position:absolute; width:90%; margin-left:3em; padding:1em;}
.backstagePanelFooter {padding-top:0.2em; float:right;}
.backstagePanelFooter a {padding:0.2em 0.4em;}
#backstageCloak {display:none; z-index:20; position:absolute; width:100%; height:100px;}

.whenBackstage {display:none;}
.backstageVisible .whenBackstage {display:block;}
/*}}}*/
/***
StyleSheet for use when a translation requires any css style changes.
This StyleSheet can be used directly by languages such as Chinese, Japanese and Korean which need larger font sizes.
***/
/*{{{*/
body {font-size:0.8em;}
#sidebarOptions {font-size:1.05em;}
#sidebarOptions a {font-style:normal;}
#sidebarOptions .sliderPanel {font-size:0.95em;}
.subtitle {font-size:0.8em;}
.viewer table.listView {font-size:0.95em;}
/*}}}*/
/*{{{*/
@media print {
#mainMenu, #sidebar, #messageArea, .toolbar, #backstageButton, #backstageArea {display: none !important;}
#displayArea {margin: 1em 1em 0em;}
noscript {display:none;} /* Fixes a feature in Firefox 1.5.0.2 where print preview displays the noscript content */
}
/*}}}*/
<!--{{{-->
<div class='toolbar' role='navigation' macro='toolbar [[ToolbarCommands::ViewToolbar]]'></div>
<div class='title' macro='view title'></div>

<div class='tagging' macro='tagging'></div>
<div class='tagged' macro='tags'></div>
<div class='viewer' macro='view text wikified'></div>
<div class='tagClear'></div>
<!--}}}-->
[[前言]]
#[[登录认证]]
#获取[[系统信息]]
#定时查询[[运行信息]]
#[[查询下载录音记录|录音查询]]
#[[查询下载录音文件|录音下载]]
#[[查询下载告警记录|告警信息]]
#回到步骤3:定时查询[[运行信息]]
[[前言]]

!!<<gradient vert #ccffff #66bbbb #006666>>HTTP接口&nbsp;>>
!!!杂项
[[HTTP 接口流程]]
[[线路状态]]
[[录音状态]]
[[最大录音记录ID]]
[[last_record_id]] 
[[最大告警记录ID]]
[[last_alarm_id]]

!!!登录
[[登录认证]]

!!!系统管理
[[系统信息]]
[[运行信息]]

!!!参数设置
[[获取分机号码]]
[[设置分机号码]]

!!!录音管理
[[录音查询]]
[[录音下载]]
[[删除录音]]

!!!用户管理
[[修改密码]]
[[权限管理]]
[[增加用户]]
[[删除用户]]

!!!通道状态
[[通道状态]]
[[实时监听]]

!!!告警信息
[[告警信息]]

!!!软件拨号
[[软件拨号]]
[[无认证软件拨号]]

!!<<gradient vert #ccffff #66bbbb #006666>>组播接口&nbsp;>>
[[设备心跳消息]]
[[来话报告消息]]


!!<<gradient vert #ccffff #66bbbb #006666>>RTM/UDP&nbsp;>>
!!!登录
[[认证请求|RTM 认证请求消息]]
[[登录|RTM 登录]]
[[退出|RTM 退出]]


!!!心跳消息
[[心跳消息|RTM 心跳消息]]

!!!实时监听
[[实时语音流|RTM 实时语音流消息]]
[[语音编码]]


!!!呼叫消息
[[电话呼入|RTM 电话呼入]]
[[来话应答|RTM 来话应答]]
[[摘机呼出|RTM 摘机呼出]]
[[电话挂机|RTM 电话挂机]]
[[线路空闲|RTM 线路空闲]]
[[线路悬空|RTM 线路悬空]]




RTM 实时语音流消息与其他消息不同:其他的 RTM 消息是 JSON 格式的文本消息,但是 RTM 实时语音流消息是二进制格式:
| RTM 实时语音流消息格式 |c
|! offset |! size |! name |! 说明 |
| 0 | 4 | ~ZERO_tag | 0x00000000 |
| 4 | 4 | ~RTMV_tag | 'RTMV' |
| 8 | 2 | channel | 0 ~ 7 |
| 10 | 2 | voice_coder | [[语音编码]] |
| 12 | 2 | voice_sn | 语音包序号 |
| 14 | 2 | payload | 语音长度(字节) |
| 16 | payload | | 语音数据 |

其中 “语音包序号” 是每通道独立、循环增长的数值,同一时刻同一个通道发送的不同的 RTM 的 “语音包序号” 是相同的 。


[[登录|RTM 登录]] 成功之后,客户端应定时发送 “RTM 心跳” 消息到 EBOX。

如果 EBOX 超过 60 秒钟未收到客户端的心跳消息,EBOX 关闭此客户端的连接, 该客户端需要重新登录认证才能继续接收到 EBOX 的 RTM 消息。

心跳消息同时还用于将 RTM 客户端要实时监听的通道通知 EBOX, EBOX 会将该通道的语音通过 [[实时语音流|RTM 实时语音流消息]] 传送到客户端。

!!!<<gradient horiz #6666ff #ccccff #ffffff>>&nbsp;RTM 心跳消息格式>>
{{{
{
  "message_kind" : "realtime_monitor",
  "message" : "alive",

  "data" : {
    "monitor_channel": N
  }
}
}}}

其中 "monitor_channel" 表示需要实时监听的通道( 0 ~ 7 )。如果不想实时监听任何通道则不设置 "monitor_channel"。



!!!<<gradient horiz #6666ff #ccccff #ffffff>>&nbsp;RTM 心跳响应消息格式>>
{{{
{
  "message_kind" : "realtime_monitor",
  "message" : "alive_ack",

  "data" : {
    "monitor_channel": N
  }
}
}}}

!!!!消息格式
{{{
{
  "message_kind" : "realtime_monitor",
  "message" : "outgoing",

  "data" : {
    "channel": N,
    "phone": "13912345678"
  }
}
}}}

!!!!消息格式
{{{
{
  "message_kind" : "realtime_monitor",
  "message" : "answer",

  "data" : {
    "channel": N,
  }
}
}}}

!!!!消息格式
{{{
{
  "message_kind" : "realtime_monitor",
  "message" : "incoming",

  "data" : {
    "channel": N,
    "phone" : "13912345678"
  }
}
}}}

!!!!消息格式
{{{
{
  "message_kind" : "realtime_monitor",
  "message" : "hangup",

  "data" : {
    "channel": N
  }
}
}}}

!!!<<gradient horiz #6666ff #ccccff #ffffff>>&nbsp;登录消息格式>>
{{{
{
  "message_kind" : "realtime_monitor",
  "message" : "login",

  "data" : {
    "username": "admin",
    "password" : "12345"
  }
}
}}}

如果认证成功,EBOX 将以 “认证成功” 消息作为响应,否则 EBOX 将返回  “认证失败” 消息。


!!!<<gradient horiz #6666ff #ccccff #ffffff>>&nbsp;认证成功消息格式>>
{{{
{
  "message_kind" : "realtime_monitor",
  "message" : "login_success",

  "data" : {
    "channel_number": 8,
    "serialno" : "12345678"
  }
}
}}}

其中:
*channel_number: 设备通道数
*serialno: 设备系列号



!!!<<gradient horiz #6666ff #ccccff #ffffff>>&nbsp;认证失败消息格式>>
{{{
{
  "message_kind" : "realtime_monitor",
  "message" : "login_fail",

  "data" : {
    "reason": “...”
  }
}
}}}

其中 "reason" 是认证失败的原因,可能是:
*"format_error: not found username" : 缺少用户名字段
*"format_error: not found password" : 缺少密码字段
*"forbidden": 该用户不具备实时监听权限
*“busy”: 设备忙:登录的用户太多
*"authentication_failure": 用户名或密码错误


!!!!消息格式
{{{
{
  "message_kind" : "realtime_monitor",
  "message" : "hanging",

  "data" : {
    "channel": N
  }
}
}}}



!!!!消息格式
{{{
{
  "message_kind" : "realtime_monitor",
  "message" : "idle",

  "data" : {
    "channel": N
  }
}
}}}

RTM 客户端首先需要发送 [[登录|RTM 登录]] 进行登录,如果 RTM 客户端未登录就发送消息到 EBOX,那么  EBOX 将发送 “RTM 认证请求消息” 要求登录认证。

!!!!消息格式
{{{
{
  "message_kind" : "realtime_monitor",
  "message" : "unauthorized",
}
}}}

客户端收到此消息后,应该发送 [[登录|RTM 登录]] 进行登录。
!!!!消息格式
{{{
{
  "message_kind" : "realtime_monitor",
  "message" : "logout"
}
}}}

电话录音仪开发手册
~EBOX-8108
last_alarm_id 即"最大告警记录ID"。

last_alarm_id 是 EBOX 内告警记录数据库告警记录数据表 'id' 字段的最大值,'id' 字段是字段增长的数值型主键,所以对于每一条记录来说,其 id 字段都是唯一的而且是顺序增长的。

通过此 id 我们就可以实现增量备份。

last_alarm_id 通过 [[运行信息]] 获取。


last_record_id 即"最大录音记录ID"。

last_record_id 是 EBOX 内录音记录数据库录音记录数据表 'id' 字段的最大值,'id' 字段是字段增长的数值型主键,所以对于每一条记录来说,其 id 字段都是唯一的而且是顺序增长的。

通过此 id 我们就可以实现增量备份。

last_record_id 通过 [[运行信息]] 获取。


!!!!指令
{{{
PUT /service/user/USERNAME/passwd?passwd=PASSWORD
}}}

其中:
*USERNAME 是要修改密码的用户名
*PASSWORD 是新密码

!!!!规则
#用户不能修改自身的权限,只能修改自己的密码。
#修改其他用户的资料,需要具有"[[权限管理]]"的权限。


!!!!指令
{{{
DELETE /service/record/~/条件1/条件2/.../条件n
}}}

删除录音的指令与[[录音查询]]的指令格式一样,只是 HTTP 方法必需是 DELETE。

关于指令格式的详细解释,请参考[[录音查询]]。


!!!!指令
{{{
DELETE /service/user/USERNAME	
}}}

上述指令删除用户名为 USERNAME  的用户。
执行此指令需要“用户管理”权限。


!!!<<gradient horiz #6666ff #ccccff #ffffff>>&nbsp;EBOX 使用建议>>
EBOX 内置了 Web 服务器,可以通过浏览器进行设备管理、用户管理、录音查询播放和下载等。

EBOX 内置 Web 服务器是一个嵌入式的  Web 服务器,处理能力有一定的限制,无法与常规 Web 服务器比肩。因此如果进行大量的 Web 访问,将占用设备资源,严重的话有可能影响到 EBOX 的本职核心工作:电话录音。

建议勿将 EBOX 当作一个常规的、大规模的 Web 服务器使用,也不将 EBOX 当作一个数据库服务器使用。

如果需要管理、查询长期的、大量的录音数据,建议将录音数据从 EBOX 备份下载到电脑上,使用电脑上的常规 Web 服务器和数据库来进行管理查询。

有两个方案实现上述目的:
#使用我公司提供的录音数据备份管理平台。
#使用本手册所描述的接口(HTTP 接口)自行开发录音数据备份管理平台。


!!!<<gradient horiz #6666ff #ccccff #ffffff>>&nbsp;接口方式>>
EBOX 提供 HTTP、RTM/UDP、组播三种访问方式:

*HTTP 接口: 
**系统管理
**录音管理
**状态监控
*RTM/UDP 接口::
**来话通知
**线路监控
**实时监听
*组播接口:
**来话通知


!!!<<gradient horiz #6666ff #ccccff #ffffff>>&nbsp;HTTP 协议>>
用户如果想要通过 HTTP 来开发 EBOX 客户端程序,开发者需要熟悉 HTTP 协议。

本手册假定读者已经了解 HTTP 协议,因此不再对 HTTP 协议本身作说明,例如对于下列指令:
{{{
GET /authorize?username=admin&password=12345
}}}
本手册只会对这条指令的功能做出说明:
>进行登录认证、返回认证 cookie。
至于这条指令的格式、其中的问号、& 符号、= 号是什么意思等等问题将不做解释,了解 HTTP 协议的读者应该完全能够理解这条指令。


!!!<<gradient horiz #6666ff #ccccff #ffffff>>&nbsp;HTTP 接口数据格式>>
EBOX 的 HTTP 接口采用 REST 方式:
*使用 GET、PUT、POST、DELETE 向 EBOX 发送指令
*EBOX 返回  JSON

本手册在描述 HTTP 指令时将省略地址部分,例如:
{{{
GET /service/sys
}}}

表示向 EBOX 发送 GET 请求,URI 是 /service/sys,如果你在浏览器地址栏输入此指令,那么你需要输入完整的 URL,可能是这样:
{{{
http://192.168.0.190/service/sys
}}}

这条指令将返回 JSON。
本手册只解释 JSON 内容,不描述 HTTP 响应头部分。



To get started with this blank [[TiddlyWiki]], you'll need to modify the following tiddlers:
* [[SiteTitle]] & [[SiteSubtitle]]: The title and subtitle of the site, as shown above (after saving, they will also appear in the browser title bar)
* [[MainMenu]]: The menu (usually on the left)
* [[DefaultTiddlers]]: Contains the names of the tiddlers that you want to appear when the TiddlyWiki is opened
You'll also need to enter your username for signing your edits: <<option txtUserName>>

!!!<<gradient horiz #6666ff #ccccff #ffffff>>&nbsp;获得 last_alarm_id>>
通过[[运行信息]]获得最后一条告警记录的ID,即 [[last_alarm_id]],有了[[last_alarm_id]],我们就可以实现增量备份。


!!!<<gradient horiz #6666ff #ccccff #ffffff>>&nbsp;查询告警记录>>

!!!!查询指令格式
{{{
GET /service/alarm/?offset=START&limit=LIMIT
}}}

其中:
*START: 是要查询的起始位置,即你上次查询的最后位置,如果尚未查询过,则可以设置 START=0。
*LIMIT: 限制查询的记录数量。


!!!!响应
{{{
[
  {"time":1358392800,"status":0,"remark":"","event":"device_boot","id":1},
  {"time":1358392801,"status":1,"remark":"channel=1","event":"line_pull_out","id":2},
  {"time":1358392801,"status":1,"remark":"channel=2","event":"line_pull_out","id":3},
  {"time":1358392802,"status":1,"remark":"channel=3","event":"line_pull_out","id":4},
  {"time":1358392802,"status":1,"remark":"channel=4","event":"line_pull_out","id":5},
  {"time":1358392802,"status":1,"remark":"channel=5","event":"line_pull_out","id":6},
  {"time":1358392802,"status":1,"remark":"channel=6","event":"line_pull_out","id":7},
  {"time":1358392802,"status":1,"remark":"channel=7","event":"line_pull_out","id":8},
  {"time":1358392802,"status":1,"remark":"channel=8","event":"line_pull_out","id":9},
  {"time":1358402641,"status":0,"remark":"","event":"device_boot","id":10}
]
}}}

其中 status = 1 表示告警态,而 status = 0 表示告警解除态。


!!!<<gradient horiz #6666ff #ccccff #ffffff>>&nbsp;告警事件列表>>
|! &nbsp;&nbsp;&nbsp;&nbsp;event&nbsp;&nbsp;&nbsp;&nbsp; |! &nbsp;&nbsp;&nbsp;&nbsp;status&nbsp;&nbsp;&nbsp;&nbsp;  |! &nbsp;&nbsp;&nbsp;&nbsp;含义&nbsp;&nbsp;&nbsp;&nbsp; |! 说明 |
|device_boot&nbsp;&nbsp;&nbsp;&nbsp; | - |设备启动  |上电启动、掉电之后重启、按复位键之后重启、通过软件指令重启、设备检测到严重错误之后重启   |
|line_pull_out&nbsp;&nbsp;&nbsp;&nbsp; | 1  |线路拔出&nbsp;&nbsp;&nbsp;&nbsp; |告警 |
|line_plug_in&nbsp;&nbsp;&nbsp;&nbsp; | 0  |线路插入&nbsp;&nbsp;&nbsp;&nbsp; |告警解除  |
|line_error&nbsp;&nbsp;&nbsp;&nbsp; | 1  |线路故障&nbsp;&nbsp;&nbsp;&nbsp; |告警  |
|device_restore_factory | 0 |通过设备复位按钮恢复出厂设置 |
|rtc_power_fail | 0 |设备掉电 |
|http_restore_factory | 0 | 通过 http 请求设备恢复出厂设置 |
|http_reboot | 0 | 通过 http 请求设备重启 |




!!!!指令
{{{
PUT /service/setting/softdial?p=[{"ch":1, "phone":"10000"}]
}}}

其中:
该方法需要登陆认证才能调用
*ch 是需要拨号的通道 1-32
*phone 外呼的电话号码 比如中国电信的10000

!!!!规则
#必须要先拿起电话机,才能拨号。
#可以控制多通道拨号  /service/setting/softdial?p=[{"ch":1, "phone":"10000"},{"ch":2, "phone":"10086"}]

返回JSON 数据格式
  {
     "errmsg":""
	 "channels":
	 [
	   {"ch":1, "result":"OK"}
	 ]
  }
errmsg 字段为空,没有错误,channels会每个通道返回接口,拨号是否成功,返回结果是不清楚的,这里返回接口,只是表示接口调用是成功的。
result: OK 发送号码成功,其它值失败。
如果不成功,需要调整一下拨号参数,参考“录放音设置-》拨号参数设置”

!!!!指令
{{{
PUT /phoneDial?p=[{"ch":1, "phone":"10000"}]
}}}

其中:
本方法不需要登陆认证,可以直接用
PUT 和POST都支持
*ch 是需要拨号的通道 1-32
*phone 外呼的电话号码 比如中国电信的10000

!!!!规则
#必须要先拿起电话机,才能拨号。
#可以控制多通道拨号  /phoneDial?p=[{"ch":1, "phone":"10000"},{"ch":2, "phone":"10086"}]

返回JSON 数据格式
  {
     "code":0,
     "errmsg":""
	 "channels":
	 [
	   {"ch":1, "result":"OK"}
	 ]
  }
code 0:数据传输正常,其他,发生错误。
errmsg 字段为空,没有错误,其它值,表示错误的原因
channels会每个通道返回接口,拨号是否成功,返回结果是不清楚的,这里返回接口,只是表示接口调用是成功的。
result: OK 发送号码成功
        failed, not hookoff   失败,电话没有摘机
		failed, no channel    失败,没有对应的通道,ch的数值不对

如果不成功,需要调整一下拨号参数,参考“录放音设置-》拨号参数设置”

!!!!指令
{{{
POST /service/user/USERNAME?passwd=PASSWORD&usermgr=0&sysmgr=0&record_param=0&record_query=1&record_delete=1&record_playdown=1&realtime_monitor=1
}}}


其中:
*USERNAME 是新建立的用户名
*PASSWORD 是新用户的密码
*其他项表示各种权限,参考[[权限管理]]。


!!!!指令
{{{
GET /rtm_stream.wav?ch=N
}}}


其中 N = 1 ~ 8,表示要监听的通道。

每次最多监听 1 个小时,如需继续监听,需要再次发送指令。


通过[[录音查询]]获得录音记录后,就可以根据录音记录内的 file 字段下载语音了:
{{{
GET /record/2013/07/23/OUT-20130723_102406_CH02-90000.wav
}}}

!!!!注意:
这个指令返回的不是 JSON,而是语音文件。


!!!<<gradient horiz #6666ff #ccccff #ffffff>>&nbsp;获得last_record_id>>
通过[[运行信息]]获得最后一条录音记录的ID,即 [[last_record_id]],有了[[last_record_id]],我们就可以实现增量备份。

!!!<<gradient horiz #6666ff #ccccff #ffffff>>&nbsp;查询指令格式>>
{{{
GET /service/record/~/条件1/条件2/.../条件n/!LIMIT{限制记录数}
}}}

所有的“条件”都是逻辑“与”的关系,“条件”是对数据表字段所做出的限定:

| 录音查询条件 |c
| !条件 | !含义 | !说明 | !用法 |
|id |数据记录 id |数值型主键 | id[N], id[N,M], id{ a,b,c,d, ..., n } |
|begtime |起始录音时间 |UTC 时间 | |
|time |begtime 的别名 | | time[1374483917], time[1374480000, 1374483917]  |
|endtime |结束录音时间 | |
|state     |[[录音状态]] |表示电话的方向, 请使用 type 来表示 |
|type      |state 的别名 | | type{in,out} |
|channel |线路通道 |1 ~ 8 | channel{ a,b, ..., n } |
|answer  |是否应答 | | answer{yes} |
|record   |是否录音 | |
|phone |电话号码 |支持通配符 | phone{ 9*, *0 } |
|&#33;LIMIT |限制查询的记录数 | | &#33;LIMIT{N} |


!!!!查询条件区间表示法(以 time 为例)
| !表达式 | !含义 |
|time(1374480000, 1374483917) |time 从1374480000 到 1374483917 区间的记录 |
|time(1374480000, 1374483917] |time 从1374480000 到 1374483917(含) 区间的记录 |
|time[1374480000, 1374483917) |time 从1374480000(含) 到 1374483917 区间的记录 |
|time[1374480000, 1374483917] |time 从1374480000(含) 到 1374483917(含) 区间的记录 |
|time[1374480000, ] |time 大于等于1374480000 的记录 |
|time[1374480000 ] |time 大于等于1374480000 的记录 |


!!!!多选一查询条件表示法(以 channel 为例)
| !表达式 | !含义 |
|channel{ 1, 3, 5, 7} |查询 1,3,5,7 通道的记录 |
|channel{ 1} |查询 1 通道的记录 |


!!!<<gradient horiz #6666ff #ccccff #ffffff>>&nbsp;增量查询录音记录>>
!!!!查询 id 从 1 起始的录音记录,最多查询 10 条:
{{{
GET /service/record/~/id[1]/!LIMIT{10}
}}}
 
!!!EBOX 返回:
{{{
[
  {"begtime":1374483917,"id":1,"state":1,"phone":"90000","channel":1,"answer":1,"file":"/record/2013/07/22/OUT-20130722_170517_CH01-90000.wav","record":1,"endtime":1374483942},
  {"begtime":1374484022,"id":2,"state":1,"phone":"90000","channel":1,"answer":1,"file":"/record/2013/07/22/OUT-20130722_170702_CH01-90000.wav","record":1,"endtime":1374484033},
  {"begtime":1374484060,"id":3,"state":1,"phone":"900","channel":1,"answer":1,"file":"/record/2013/07/22/OUT-20130722_170740_CH01-900.wav","record":1,"endtime":1374484070},
  {"begtime":1374484104,"id":4,"state":1,"phone":"298","channel":1,"answer":1,"file":"/record/2013/07/22/OUT-20130722_170824_CH01-298.wav","record":1,"endtime":1374484116},
  {"begtime":1374485434,"id":5,"state":1,"phone":"90000","channel":1,"answer":1,"file":"/record/2013/07/22/OUT-20130722_173034_CH01-90000.wav","record":1,"endtime":1374485451},
  {"begtime":1374486031,"id":6,"state":1,"phone":"90000","channel":1,"answer":1,"file":"/record/2013/07/22/OUT-20130722_174031_CH01-90000.wav","record":1,"endtime":1374486044},
  {"begtime":1374542930,"id":7,"state":1,"phone":"90000","channel":1,"answer":1,"file":"/record/2013/07/23/OUT-20130723_092850_CH01-90000.wav","record":1,"endtime":1374542943},
  {"begtime":1374542963,"id":8,"state":1,"phone":"333","channel":1,"answer":1,"file":"/record/2013/07/23/OUT-20130723_092923_CH01-333.wav","record":1,"endtime":1374542970},
  {"begtime":1374542973,"id":9,"state":1,"phone":"6","channel":1,"answer":1,"file":"/record/2013/07/23/OUT-20130723_092933_CH01-6.wav","record":1,"endtime":1374542979},
  {"begtime":1374543014,"id":10,"state":1,"phone":"32","channel":1,"answer":1,"file":"/record/2013/07/23/OUT-20130723_093014_CH01-32.wav","record":1,"endtime":1374543024}
]
}}}


!!!!查询 id 从 30 起始的录音记录,最多查询 10 条:
{{{
GET /service/record/~/id[30]/!LIMIT{10}
}}}

!!!EBOX 返回:
{{{
[
  {"begtime":1374546246,"id":30,"state":1,"phone":"90000","channel":2,"answer":1,"file":"/record/2013/07/23/OUT-20130723_102406_CH02-90000.wav","record":1,"endtime":1374546253},
  {"begtime":1374546278,"id":31,"state":1,"phone":"","channel":2,"answer":1,"file":"/record/2013/07/23/OUT-20130723_102438_CH02-.wav","record":1,"endtime":1374546284},
  {"begtime":1374546296,"id":32,"state":1,"phone":"910000","channel":3,"answer":1,"file":"/record/2013/07/23/OUT-20130723_102456_CH03-910000.wav","record":1,"endtime":1374546303},
  {"begtime":1374546385,"id":33,"state":1,"phone":"","channel":2,"answer":1,"file":"/record/2013/07/23/OUT-20130723_102625_CH02-.wav","record":1,"endtime":1374546391},
  {"begtime":1374546423,"id":34,"state":1,"phone":"90000","channel":1,"answer":1,"file":"/record/2013/07/23/OUT-20130723_102703_CH01-90000.wav","record":1,"endtime":1374546431},
  {"begtime":1374546432,"id":35,"state":1,"phone":"910000","channel":1,"answer":1,"file":"/record/2013/07/23/OUT-20130723_102712_CH01-910000.wav","record":1,"endtime":1374546443},
  {"begtime":1374546513,"id":36,"state":1,"phone":"321","channel":1,"answer":1,"file":"/record/2013/07/23/OUT-20130723_102833_CH01-321.wav","record":1,"endtime":1374546519},
  {"begtime":1374547338,"id":37,"state":1,"phone":"12345","channel":3,"answer":1,"file":"/record/2013/07/23/OUT-20130723_104218_CH03-12345.wav","record":1,"endtime":1374547344},
  {"begtime":1374547762,"id":38,"state":1,"phone":"","channel":6,"answer":1,"file":"/record/2013/07/23/OUT-20130723_104922_CH06-.wav","record":1,"endtime":1374547768}
]
}}}



录音状态表示录音的方向

| 录音状态 |c
|! &nbsp;&nbsp;&nbsp;state&nbsp;&nbsp;&nbsp; |! &nbsp;&nbsp;&nbsp;方向&nbsp;&nbsp;&nbsp; |! &nbsp;&nbsp;&nbsp;answer&nbsp;&nbsp;&nbsp; |! 说明 |! 查询表达式 |
| 1         | 去话 | 1 |去话  |/type{out} |
| 2         | 来话 | 0 |来话未接 | /type{in}/answer{no} |
|~|~| 1 |来话应答  |/type{in}/answer{yes} |



即 [[last_alarm_id]]。
即 [[last_record_id]]。


!!!<<gradient horiz #6666ff #ccccff #ffffff>>获取全部用户信息>>
!!!!指令
{{{
GET /service/user
}}}

!!!!响应
{{{
[
    {
        "name":"admin",
        "record_query":1,
        "record_delete":1,
        "realtime_monitor":1,
        "record_playdown":1,
        "sysmgr":1,
        "usermgr":1,
        "record_param":1
    },
    {
        "name":"test",
        "record_query":1,
        "record_delete":0,
        "realtime_monitor":1,
        "record_playdown":1,
        "sysmgr":0,
        "usermgr":0,
        "record_param":0
    }
]
}}}


上述查询的权限如下:
| 用户权限 |c
|! &nbsp;&nbsp;&nbsp;用户名&nbsp;&nbsp;&nbsp;  |! &nbsp;sysmgr&nbsp; | !&nbsp;usermgr&nbsp; | !&nbsp;record_param&nbsp; | !&nbsp;record_query&nbsp; | !&nbsp;record_playdown&nbsp; | !&nbsp;record_delete&nbsp; | !&nbsp;realtime_monitor&nbsp; |
|~| !系统管理 | !用户管理 | !参数设置 | !录音查询 | !播放下载 | !录音删除 | !实时监听 |
|admin | yes | yes | yes | yes | yes | yes | yes |
|test |     |  |   |  yes | yes |     | yes |


!!!<<gradient horiz #6666ff #ccccff #ffffff>>修改用户权限>>
!!!!指令
{{{
PUT /service/user/test/authority?usermgr=0&sysmgr=0&record_param=0&record_query=1&record_delete=1&record_playdown=1&realtime_monitor=1
}}}

上述指令设置名为 test 的用户的权限是:允许录音查询、播放、下载、删除以及实时监听,其他权限禁止。



!!!!消息格式(JSON)
{{{
{
    "message_kind": "call_report",
    "message": "call_incoming",

    "from"         : "12345678@192.168.0.190",

    "timestamp"    : 1306224506,

    "data"   : {
            "channel" : 8,
	    "ext":"801",
            "calling":"13912345678"
        }
    }
}
}}}

其中:
*from: 设备系列号@设备地址
*timestamp: 时间戳
*channel: 线路通道号
*ext: 分机号码
*calling: 主叫电话号码


要通过 HTTP 接口访问 EBOX,第一件事情就是登录认证。

向 EBOX 发送 HTTP 登录认证请求:
{{{
GET /authorize?username=admin&password=admin
}}}

如果认证成功,EBOX 将响应:
{{{
HTTP/1.1 302 Found
Set-Cookie: Authorization=PuoNryUCcY0E7ZACtMN5Fg==
Set-Cookie: browsermark=a5lvJtPkRePH7Hhkdh+yTA==; expires=Thu Jul 24 11:09:30 2014 GMT
Set-Cookie: orgurl=; max-age=0
Location: /
}}}

其中的 ‘Authorization=~PuoNryUCcY0E7ZACtMN5Fg==’ 就是认证成功后返回的 cookie,记录下来以备后用。

如果认证失败,那么可能返回:
{{{
HTTP/1.1 302 Found
Set-Cookie: orgurl=/authorize
Location: /login.lgi?orgurl=/authorize
}}}

可以看到,其中没有 Authorization 的 cookie。


!!!!请求指令:
{{{
GET /service/sys
}}}


!!!!响应(返回 JSON):
{{{
{
    "product_type":"8108",
    "product_version":"1.0",
    "serialno":0,
    "userid":0,

    "channel_number":8,
    "built_date":"May 23 2012 17:09:45",

    "port":"80",
    "ipaddr":"192.168.0.190",
    "gwaddr":"192.168.0.1",
    "mask":"255.255.255.0",
    "macaddr":"00:00:00:00:00:00",

    "timezone":-8,
    "start_time":1337764348,
    "nowtime":1337765800,

    "last_alarm_id":32,
    "last_record_id":22,

    "rtc_power_fail":1,

    "total_space":8192
    "remain_space":4096,
}
}}}



线路状态表示电话线路当前时刻的状态,可以通过[[运行信息]]获取:

| 线路状态 |c
| !状态值 | !状态 | !说明 |
| 0 | 未检测到模块 |
| 1 | 通道空闲 |
| 2 | 呼出通话 |
| 3 | 呼入振铃 |
| 4 | 呼入通话 |
| 5 | 线路悬空 |电话线被拔出|

线路状态不会被记录在数据库内。


!!!!指令
{{{
GET /service/setting/ext_number
}}}


!!!!响应
{{{
[801,802,803,804,805,806,807,808]
}}}


!!!!消息格式(JSON)
{{{
{
    "message_kind" : "alive",
    "message"      : "alive",

    "from"         : "12345678@192.168.0.190",

    "timestamp"    : 1306224506,

    "data"   : {
            "channel_number" : 8,
	    "rtm_port": 6637
    }
}
}}}

其中:
*from: 设备系列号@设备地址
*timestamp: 时间戳
*channel_number : 设备通道数 
*rtm_port: RTM/UDP 端口


!!!!指令
{{{
PUT /service/setting/ext_number/[601,602,603,604,605,606,607,608]
}}}

其中 601 ~ 608 是新的分机号码。

!!!返回
{{{
0
}}}


| EBOX 语音编码表 |c
|! 数值 |! 语音编码 |
| 0 | ~CCITT-aLaw |
| 3 | G.729 |
| 38 | ~MP3 |
| 16 | PCM |


!!!!指令
{{{
GET /service/running
}}}

!!!!响应
{{{
{
    "channel":[
        {"state":5,"ch":1},
        {"state":5,"ch":2},
        {"state":5,"ch":3},
        {"state":5,"ch":4},
        {"state":5,"ch":5},
        {"state":1,"ch":6},
        {"state":5,"ch":7},
        {"state":5,"ch":8}],
    "last_alarm_id":113,
    "last_record_id":38
}
}}}

其中:
*state:表示[[线路状态]]。
*[[last_record_id]]: 表示 [[最大录音记录ID]],在 [[录音查询]] 时需要用到。
*last_alarm_id:表示最大告警记录 ID。


!!!!指令
{{{
GET /service/running/channel
}}}


!!!!响应
{{{
[
  {"state":5,"ch":1},
  {"state":5,"ch":2},
  {"state":5,"ch":3},
  {"state":5,"ch":4},
  {"state":5,"ch":5},
  {"state":2,"phone":"298","timelen":16,"ch":6},
  {"state":5,"ch":7},
  {"state":5,"ch":8}
]
}}}

其中:
*state: [[线路状态]]
*phone: 电话号码
*timelen: 通话时间(UTC 秒)