Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
93ce1e64
提交
93ce1e64
authored
1月 06, 2012
作者:
Raymond Chandler
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
php examples
上级
743dbbf9
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
317 行增加
和
0 行删除
+317
-0
dialer.php
src/mod/applications/mod_httapi/examples/PHP/dialer.php
+42
-0
ext_pin.php
src/mod/applications/mod_httapi/examples/PHP/ext_pin.php
+111
-0
record_name.php
src/mod/applications/mod_httapi/examples/PHP/record_name.php
+71
-0
speech.php
src/mod/applications/mod_httapi/examples/PHP/speech.php
+93
-0
没有找到文件。
src/mod/applications/mod_httapi/examples/PHP/dialer.php
0 → 100644
浏览文件 @
93ce1e64
<?php
$xml
=
new
XMLWriter
();
$xml
->
openMemory
();
$xml
->
setIndent
(
1
);
$xml
->
startDocument
();
if
(
$_REQUEST
[
'exiting'
]
)
{
header
(
'Content-Type: text/plain'
);
print
"OK"
;
exit
();
}
header
(
'Content-Type: text/xml'
);
$xml
->
startElement
(
'document'
);
$xml
->
writeAttribute
(
'type'
,
'xml/freeswitch-httapi'
);
$xml
->
startElement
(
'work'
);
$xml
->
startElement
(
'pause'
);
$xml
->
writeAttribute
(
'milliseconds'
,
'1500'
);
$xml
->
endElement
();
// </pause>
$xml
->
startElement
(
'playback'
);
$xml
->
writeAttribute
(
'name'
,
'digits'
);
$xml
->
writeAttribute
(
'file'
,
'http://sidious.freeswitch.org/sounds/exten.wav'
);
$xml
->
writeAttribute
(
'error-file'
,
'http://sidious.freeswitch.org/sounds/invalid.wav'
);
$xml
->
writeAttribute
(
'input-timeout'
,
'5000'
);
$xml
->
writeAttribute
(
'action'
,
'dial:default:XML'
);
$xml
->
startElement
(
"bind"
);
$xml
->
writeAttribute
(
'strip'
,
"#"
);
$xml
->
text
(
"~
\\
d+\#"
);
$xml
->
endElement
();
// </bind>
$xml
->
endElement
();
// </playback>
$xml
->
endElement
();
// </work>
$xml
->
endElement
();
// </document>
print
$xml
->
outputMemory
();
src/mod/applications/mod_httapi/examples/PHP/ext_pin.php
0 → 100644
浏览文件 @
93ce1e64
<?php
if
(
array_key_exists
(
'session_id'
,
$_REQUEST
)
)
{
session_id
(
$_REQUEST
[
'session_id'
]
);
}
session_start
();
$xml
=
new
XMLWriter
();
$xml
->
openMemory
();
$xml
->
setIndent
(
1
);
$xml
->
startDocument
();
if
(
array_key_exists
(
'exten'
,
$_REQUEST
)
)
{
$exten
=
$_REQUEST
[
'exten'
];
}
elseif
(
array_key_exists
(
'exten'
,
$_SESSION
)
)
{
$exten
=
$_SESSION
[
'exten'
];
}
else
{
$exten
=
''
;
}
if
(
array_key_exists
(
'pin'
,
$_REQUEST
)
)
{
$pin
=
$_REQUEST
[
'pin'
];
}
elseif
(
array_key_exists
(
'pin'
,
$_SESSION
)
)
{
$pin
=
$_SESSION
[
'pin'
];
}
else
{
$pin
=
''
;
}
if
(
array_key_exists
(
'exiting'
,
$_REQUEST
)
)
{
$exiting
=
$_REQUEST
[
'exiting'
];
}
elseif
(
array_key_exists
(
'exiting'
,
$_SESSION
)
)
{
$exiting
=
$_SESSION
[
'exiting'
];
}
else
{
$exiting
=
''
;
}
if
(
$exiting
)
{
header
(
'Content-Type: text/plain'
);
print
"OK"
;
exit
();
}
header
(
'Content-Type: text/xml'
);
$xml
->
startElement
(
'document'
);
$xml
->
writeAttribute
(
'type'
,
'xml/freeswitch-httapi'
);
if
(
$exten
&&
$pin
)
{
$xml
->
startElement
(
'work'
);
$xml
->
writeElement
(
"playback"
,
"http://sidious.freeswitch.org/sounds/ext_num.wav"
);
$xml
->
startElement
(
"say"
);
$xml
->
writeAttribute
(
'language'
,
"en"
);
$xml
->
writeAttribute
(
'type'
,
"name_spelled"
);
$xml
->
writeAttribute
(
'method'
,
"pronounced"
);
$xml
->
text
(
$exten
);
$xml
->
endElement
();
// </say>
$xml
->
startElement
(
'pause'
);
$xml
->
writeAttribute
(
'milliseconds'
,
"1500"
);
$xml
->
endElement
();
// </pause>
$xml
->
startElement
(
"say"
);
$xml
->
writeAttribute
(
'language'
,
"en"
);
$xml
->
writeAttribute
(
'type'
,
"name_spelled"
);
$xml
->
writeAttribute
(
'method'
,
"pronounced"
);
$xml
->
text
(
$pin
);
$xml
->
endElement
();
// </say>
$xml
->
writeElement
(
'hangup'
);
$xml
->
endElement
();
// </work>
}
elseif
(
$exten
)
{
$_SESSION
[
'exten'
]
=
$exten
;
$xml
->
startElement
(
'work'
);
$xml
->
startElement
(
'playback'
);
$xml
->
writeAttribute
(
'name'
,
"pin"
);
$xml
->
writeAttribute
(
'file'
,
"http://sidious.freeswitch.org/sounds/pin.wav"
);
$xml
->
writeAttribute
(
'error-file'
,
"http://sidious.freeswitch.org/sounds/bad-pin.wav"
);
$xml
->
writeAttribute
(
'input-timeout'
,
"5000"
);
$xml
->
startElement
(
"bind"
);
$xml
->
writeAttribute
(
'strip'
,
"#"
);
$xml
->
text
(
"~
\\
d+\#"
);
$xml
->
endElement
();
// </bind>
$xml
->
endElement
();
// </playback>
$xml
->
endElement
();
// </work>
}
else
{
$xml
->
startElement
(
'work'
);
$xml
->
startElement
(
'playback'
);
$xml
->
writeAttribute
(
'name'
,
"exten"
);
$xml
->
writeAttribute
(
'file'
,
"http://sidious.freeswitch.org/sounds/exten.wav"
);
$xml
->
writeAttribute
(
'loops'
,
"3"
);
$xml
->
writeAttribute
(
'error-file'
,
"http://sidious.freeswitch.org/sounds/invalid.wav"
);
$xml
->
writeAttribute
(
'input-timeout'
,
"5000"
);
$xml
->
startElement
(
"bind"
);
$xml
->
writeAttribute
(
'strip'
,
"#"
);
$xml
->
text
(
"~
\\
d+\#"
);
$xml
->
endElement
();
// </bind>
$xml
->
endElement
();
// </playback>
$xml
->
endElement
();
// </work>
}
$xml
->
endElement
();
// </document>
print
$xml
->
outputMemory
();
src/mod/applications/mod_httapi/examples/PHP/record_name.php
0 → 100644
浏览文件 @
93ce1e64
<?php
if
(
array_key_exists
(
'session_id'
,
$_REQUEST
)
)
{
session_id
(
$_REQUEST
[
'session_id'
]
);
}
session_start
();
$xml
=
new
XMLWriter
();
$xml
->
openMemory
();
$xml
->
setIndent
(
1
);
$xml
->
startDocument
();
if
(
array_key_exists
(
'exiting'
,
$_REQUEST
)
)
{
$exiting
=
$_REQUEST
[
'exiting'
];
}
elseif
(
array_key_exists
(
'exiting'
,
$_SESSION
)
)
{
$exiting
=
$_SESSION
[
'exiting'
];
}
else
{
$exiting
=
''
;
}
if
(
$_FILES
&&
array_key_exists
(
'recorded_file'
,
$_FILES
)
)
{
move_uploaded_file
(
$_FILES
[
'recorded_file'
][
'tmp_name'
],
'/tmp/'
.
$_FILES
[
'recorded_file'
][
'name'
]);
trigger_error
(
print_r
(
$_FILES
,
true
)
);
header
(
'Content-Type: text/plain'
);
print
"OK
\n
"
;
exit
();
}
if
(
$exiting
)
{
header
(
'Content-Type: text/plain'
);
print
"OK"
;
exit
();
}
header
(
'Content-Type: text/xml'
);
$xml
->
startElement
(
'document'
);
$xml
->
writeAttribute
(
'type'
,
'xml/freeswitch-httapi'
);
$xml
->
startElement
(
'work'
);
$xml
->
startElement
(
'pause'
);
$xml
->
writeAttribute
(
'milliseconds'
,
"1500"
);
$xml
->
endElement
();
$xml
->
startElement
(
'playback'
);
$xml
->
writeAttribute
(
'file'
,
"http://sidious.freeswitch.org/eg/ivr-say_name.wav"
);
$xml
->
endElement
();
$xml
->
startElement
(
'record'
);
$xml
->
writeAttribute
(
'name'
,
"recorded_file"
);
$xml
->
writeAttribute
(
'file'
,
$_REQUEST
[
'session_id'
]
.
".wav"
);
$xml
->
writeAttribute
(
'error-file'
,
"http://sidious.freeswitch.org/sounds/invalid.wav"
);
$xml
->
writeAttribute
(
'input-timeout'
,
"5000"
);
$xml
->
writeAttribute
(
'beep-file'
,
"tone_stream://%(1000,0,460)"
);
$xml
->
endElement
();
$xml
->
startElement
(
"bind"
);
$xml
->
writeAttribute
(
'strip'
,
"#"
);
$xml
->
text
(
"~
\\
d+\#"
);
$xml
->
endElement
();
$xml
->
endElement
();
// </work>
$xml
->
endElement
();
// </document>
print
$xml
->
outputMemory
();
src/mod/applications/mod_httapi/examples/PHP/speech.php
0 → 100644
浏览文件 @
93ce1e64
<?php
if
(
array_key_exists
(
'session_id'
,
$_REQUEST
)
)
{
session_id
(
$_REQUEST
[
'session_id'
]
);
}
session_start
();
$xml
=
new
XMLWriter
();
$xml
->
openMemory
();
$xml
->
setIndent
(
1
);
$xml
->
startDocument
();
if
(
array_key_exists
(
'exiting'
,
$_REQUEST
)
)
{
$exiting
=
$_REQUEST
[
'exiting'
];
}
elseif
(
array_key_exists
(
'exiting'
,
$_SESSION
)
)
{
$exiting
=
$_SESSION
[
'exiting'
];
}
else
{
$exiting
=
''
;
}
if
(
array_key_exists
(
'result'
,
$_REQUEST
)
)
{
$result
=
$_REQUEST
[
'result'
];
}
elseif
(
array_key_exists
(
'result'
,
$_SESSION
)
)
{
$result
=
$_SESSION
[
'result'
];
}
else
{
$result
=
''
;
}
if
(
array_key_exists
(
'input_type'
,
$_REQUEST
)
)
{
$input_type
=
$_REQUEST
[
'input_type'
];
}
elseif
(
array_key_exists
(
'input_type'
,
$_SESSION
)
)
{
$input_type
=
$_SESSION
[
'input_type'
];
}
else
{
$input_type
=
''
;
}
if
(
$exiting
)
{
header
(
'Content-Type: text/plain'
);
print
"OK"
;
exit
();
}
header
(
'Content-Type: text/xml'
);
$xml
->
startElement
(
'document'
);
$xml
->
writeAttribute
(
'type'
,
'xml/freeswitch-httapi'
);
if
(
$result
)
{
$xml
->
startElement
(
'work'
);
if
(
$type
==
"dtmf"
)
{
$xml
->
startElement
(
"say"
);
$xml
->
writeAttribute
(
'language'
,
"en"
);
$xml
->
writeAttribute
(
'type'
,
"name_spelled"
);
$xml
->
writeAttribute
(
'method'
,
"pronounced"
);
$xml
->
text
(
$result
);
}
$xml
->
startElement
(
"log"
);
$xml
->
writeAttribute
(
'level'
,
"crit"
);
$xml
->
text
(
$result
);
$xml
->
endElement
();
$xml
->
writeElement
(
'hangup'
);
$xml
->
endElement
();
}
else
{
$xml
->
startElement
(
'work'
);
$xml
->
startElement
(
'pause'
);
$xml
->
writeAttribute
(
'milliseconds'
,
"1500"
);
$xml
->
endElement
();
$xml
->
startElement
(
'playback'
);
$xml
->
writeAttribute
(
'name'
,
"result"
);
$xml
->
writeAttribute
(
'asr-engine'
,
"pocketsphinx"
);
$xml
->
writeAttribute
(
'asr-grammar'
,
"pizza_yesno"
);
$xml
->
writeAttribute
(
'file'
,
"http://sidious.freeswitch.org/sounds/ConfirmDelivery.wav"
);
$xml
->
writeAttribute
(
'error-file'
,
"http://sidious.freeswitch.org/sounds/invalid.wav"
);
$xml
->
startElement
(
"bind"
);
$xml
->
writeAttribute
(
'strip'
,
"#"
);
$xml
->
text
(
"~
\\
d+\#"
);
$xml
->
endElement
();
$xml
->
endElement
();
$xml
->
endElement
();
}
$xml
->
endElement
();
// </document>
print
$xml
->
outputMemory
();
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论