Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch-contrib
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch-contrib
Commits
1b97f2f2
提交
1b97f2f2
authored
1月 21, 2012
作者:
Raymond Chandler
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
now with more working action
上级
93d11bb9
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
218 行增加
和
16 行删除
+218
-16
disa.php
intralanman/PHP/phttapi/example/disa.php
+22
-0
index.php
intralanman/PHP/phttapi/example/index.php
+39
-0
login.php
intralanman/PHP/phttapi/example/login.php
+44
-0
main_menu.php
intralanman/PHP/phttapi/example/main_menu.php
+58
-0
record.php
intralanman/PHP/phttapi/example/record.php
+16
-0
phttapi.php
intralanman/PHP/phttapi/phttapi.php
+39
-16
没有找到文件。
intralanman/PHP/phttapi/example/disa.php
0 → 100644
浏览文件 @
1b97f2f2
<?php
include
(
'login.php'
);
$api
=
new
phttapi
();
$api
->
start_work
();
$b
=
new
phttapi_action_binding
(
'~\d+#'
);
$b
->
strip
(
'#'
);
$pb
=
new
phttapi_playback
();
$pb
->
file
(
sprintf
(
'http://%s%s/exten.wav'
,
$_SERVER
[
'HTTP_HOST'
],
dirname
(
$_SERVER
[
'PHP_SELF'
]
)
)
);
$pb
->
error_file
(
sprintf
(
'http://%s%s/invalid.wav'
,
$_SERVER
[
'HTTP_HOST'
],
dirname
(
$_SERVER
[
'PHP_SELF'
]
)
)
);
$pb
->
input_timeout
(
'15000'
);
$pb
->
digit_timeout
(
'5000'
);
$pb
->
action
(
'dial:disa:XML'
);
$pb
->
add_binding
(
$b
);
$api
->
add_action
(
$pb
);
$api
->
end_work
();
print
$api
->
output
();
intralanman/PHP/phttapi/example/index.php
0 → 100644
浏览文件 @
1b97f2f2
<?php
require_once
(
'../phttapi.php'
);
if
(
array_key_exists
(
'session_id'
,
$_REQUEST
)
)
{
session_id
(
$_REQUEST
[
'session_id'
]
);
}
session_start
();
if
(
array_key_exists
(
'exiting'
,
$_REQUEST
)
)
{
header
(
'Content-Type: text/plain'
);
print
"OK"
;
exit
();
}
header
(
'Content-Type: text/xml'
);
if
(
array_key_exists
(
'ivr_path'
,
$_REQUEST
)
)
{
$ivr_path
=
$_REQUEST
[
'ivr_path'
];
}
else
{
$ivr_path
=
'main_menu'
;
}
if
(
file_exists
(
"
$ivr_path
.php"
)
)
{
include
(
"
$ivr_path
.php"
);
}
else
{
$api
=
new
phttapi
();
$api
->
start_work
();
$h
=
new
phttapi_hangup
();
$h
->
cause
(
'NORMAL_CLEARING'
);
$api
->
add_action
(
$h
);
$api
->
end_work
();
print
$api
->
output
();
}
intralanman/PHP/phttapi/example/login.php
0 → 100644
浏览文件 @
1b97f2f2
<?php
if
(
!
array_key_exists
(
'authenticated'
,
$_SESSION
)
||
$_SESSION
[
'authenticated'
]
!=
'true'
)
{
if
(
array_key_exists
(
'user_pin_authenticated'
,
$_REQUEST
)
)
{
$_SESSION
[
'authenticated'
]
=
true
;
$_SESSION
[
'authenticated_user'
]
=
$_REQUEST
[
'user_pin_authenticated_user'
];
$api
=
new
phttapi
();
$api
->
start_variables
();
$api
->
add_variable
(
'authenticated_user'
,
$_REQUEST
[
'user_pin_authenticated_user'
]
);
$api
->
end_variables
();
unset
(
$_SESSION
[
'authenticating'
]
);
}
elseif
(
array_key_exists
(
'authenticating'
,
$_SESSION
)
)
{
$class
=
new
phttapi
();
$class
->
start_work
();
$authed
=
new
phttapi_getVariable
(
'user_pin_authenticated'
);
$class
->
add_action
(
$authed
);
$auth_user
=
new
phttapi_getVariable
(
'user_pin_authenticated_user'
);
$class
->
add_action
(
$auth_user
);
$class
->
end_work
();
print
$class
->
output
();
exit
();
}
else
{
$_SESSION
[
'authenticating'
]
=
true
;
$class
=
new
phttapi
();
$class
->
start_work
();
$vm
=
new
phttapi_voicemail
();
$vm
->
auth_only
(
'true'
);
$vm
->
domain
(
'home.intralanman.com'
);
$class
->
add_action
(
$vm
);
$class
->
end_work
();
print
$class
->
output
();
exit
();
}
}
intralanman/PHP/phttapi/example/main_menu.php
0 → 100644
浏览文件 @
1b97f2f2
<?php
if
(
array_key_exists
(
'option'
,
$_REQUEST
)
)
{
$option
=
$_REQUEST
[
'option'
];
}
else
{
$option
=
''
;
}
if
(
$option
)
{
switch
(
$option
)
{
case
'1'
:
$menu_ivr_path
=
'disa'
;
break
;
case
'2'
:
$menu_ivr_path
=
'record'
;
break
;
// case '':
// $menu_ivr_path = '';
// break;
}
$api
=
new
phttapi
();
$api
->
start_variables
();
$api
->
add_variable
(
'ivr_path'
,
$menu_ivr_path
);
$api
->
end_variables
();
$api
->
start_work
();
$var
=
new
phttapi_getVariable
(
'ivr_path'
);
$var
->
permanent
(
'true'
);
$api
->
add_action
(
$var
);
$api
->
end_work
();
print
$api
->
output
();
}
else
{
$api
=
new
phttapi
();
$api
->
start_work
();
$bind1
=
new
phttapi_action_binding
(
'1'
);
$bind2
=
new
phttapi_action_binding
(
'2'
);
$play
=
new
phttapi_speak
(
"to make an outbound call, press 1,, to record a file, press 2,, "
);
$play
->
engine
(
'flite'
);
$play
->
voice
(
'slt'
);
$play
->
name
(
'option'
);
$play
->
input_timeout
(
'5000'
);
$play
->
add_binding
(
$bind1
);
$play
->
add_binding
(
$bind2
);
$api
->
add_action
(
$play
);
$api
->
end_work
();
print
$api
->
output
();
}
intralanman/PHP/phttapi/example/record.php
0 → 100644
浏览文件 @
1b97f2f2
<?php
require_once
(
'login.php'
);
$api
=
new
phttapi
();
$api
->
start_work
();
$h
=
new
phttapi_hangup
();
if
(
is_array
(
$_FILES
)
)
{
$api
->
add_action
(
$h
);
}
else
{
$api
->
add_action
(
$h
);
}
$api
->
end_work
();
print
$api
->
output
();
\ No newline at end of file
intralanman/PHP/phttapi/phttapi.php
浏览文件 @
1b97f2f2
...
@@ -34,21 +34,35 @@ class phttapi_xml_blob {
...
@@ -34,21 +34,35 @@ class phttapi_xml_blob {
}
}
public
function
raw
(
$xml
)
{
public
function
raw
(
$xml
)
{
$this
->
xml
->
writeRaw
(
"
$xml
"
);
$this
->
xml
->
writeRaw
(
$xml
);
}
}
}
}
class
phttapi
extends
phttapi_xml_blob
{
class
phttapi
extends
phttapi_xml_blob
{
private
$logptr
;
public
function
__construct
()
{
public
function
__construct
()
{
$this
->
logptr
=
fopen
(
'/tmp/phttapi.log'
,
'a'
);
$this
->
dlog
(
print_r
(
$_REQUEST
,
true
)
);
parent
::
__construct
();
parent
::
__construct
();
$this
->
xml
->
setIndent
(
true
);
$this
->
xml
->
setIndent
(
true
);
$this
->
xml
->
setIndentString
(
' '
);
$this
->
xml
->
setIndentString
(
" "
);
$this
->
open
(
'document'
);
$this
->
open
(
'document'
);
$this
->
attr
(
'type'
,
'text/freeswitch-httapi'
);
$this
->
attr
(
'type'
,
'text/freeswitch-httapi'
);
}
}
public
function
dlog
(
$debug
=
null
)
{
fwrite
(
$this
->
logptr
,
$debug
);
}
public
function
output
()
{
$xml
=
parent
::
output
();
$this
->
dlog
(
$xml
);
return
$xml
;
}
public
function
start_work
()
{
public
function
start_work
()
{
$this
->
open
(
'work'
);
$this
->
open
(
'work'
);
}
}
...
@@ -143,7 +157,7 @@ class phttapi_action_binding extends phttapi_xml_blob{
...
@@ -143,7 +157,7 @@ class phttapi_action_binding extends phttapi_xml_blob{
parent
::
__construct
();
parent
::
__construct
();
$this
->
open
(
'bind
ing
'
);
$this
->
open
(
'bind'
);
$this
->
action_text
=
$text
;
$this
->
action_text
=
$text
;
}
}
...
@@ -152,9 +166,8 @@ class phttapi_action_binding extends phttapi_xml_blob{
...
@@ -152,9 +166,8 @@ class phttapi_action_binding extends phttapi_xml_blob{
}
}
public
function
output
()
{
public
function
output
()
{
$this
->
raw
(
$this
->
action_text
);
$this
->
text
(
$this
->
action_text
);
$this
->
raw
(
'blah WTF'
);
return
parent
::
output
();
parent
::
output
();
}
}
}
}
...
@@ -192,10 +205,9 @@ class phttapi_dial extends phttapi_action {
...
@@ -192,10 +205,9 @@ class phttapi_dial extends phttapi_action {
}
}
class
phttapi_execute
extends
phttapi_action
{
class
phttapi_execute
extends
phttapi_action
{
public
function
application
(
$app
,
$data
)
{
public
$attributes
=
array
(
$this
->
open
(
$app
);
'application'
=>
true
,
$this
->
text
(
$data
);
);
}
}
}
if
(
class_exists
(
'PHPUnit_Framework_TestCase'
)
)
{
if
(
class_exists
(
'PHPUnit_Framework_TestCase'
)
)
{
class
phttapi_executeTest
extends
PHPUnit_Framework_TestCase
{
class
phttapi_executeTest
extends
PHPUnit_Framework_TestCase
{
...
@@ -215,11 +227,19 @@ if ( class_exists( 'PHPUnit_Framework_TestCase' ) ) {
...
@@ -215,11 +227,19 @@ if ( class_exists( 'PHPUnit_Framework_TestCase' ) ) {
}
}
}
}
class
phttapi_getVar
extends
phttapi_action
{
class
phttapi_getVar
iable
extends
phttapi_action
{
public
$attributes
=
array
(
public
$attributes
=
array
(
'permanent'
=>
true
,
'permanent'
=>
true
,
);
);
public
function
__construct
(
$text
=
null
)
{
if
(
!
$text
)
throw
new
NullDataException
(
"no data passed"
);
}
public
function
__construct
(
$var
=
null
)
{
if
(
!
$var
)
{
throw
new
NullDataException
(
"getVariable must be instantiated with a variable name"
);
}
else
{
parent
::
__construct
();
$this
->
attr
(
'name'
,
$var
);
}
}
}
}
class
phttapi_hangup
extends
phttapi_action
{
class
phttapi_hangup
extends
phttapi_action
{
...
@@ -269,7 +289,7 @@ class phttapi_recordCall extends phttapi_action {
...
@@ -269,7 +289,7 @@ class phttapi_recordCall extends phttapi_action {
);
);
}
}
class
phttapi_say
extends
phttapi_
action
{
class
phttapi_say
extends
phttapi_
prompt
{
public
$attributes
=
array
(
public
$attributes
=
array
(
'gender'
=>
true
,
'gender'
=>
true
,
'method'
=>
true
,
'method'
=>
true
,
...
@@ -278,10 +298,13 @@ class phttapi_say extends phttapi_action {
...
@@ -278,10 +298,13 @@ class phttapi_say extends phttapi_action {
);
);
}
}
class
phttapi_speak
extends
phttapi_
action
{
class
phttapi_speak
extends
phttapi_
prompt
{
public
$attributes
=
array
(
public
$attributes
=
array
(
'engine'
=>
true
,
'engine'
=>
true
,
'voice'
=>
true
,
'voice'
=>
true
,
'digit-timeout'
=>
true
,
'input-timeout'
=>
true
,
'loops'
=>
true
,
);
);
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论