Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch-contrib
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch-contrib
Commits
68d2dc85
提交
68d2dc85
authored
7月 17, 2013
作者:
Emmanuel Schmidbauer
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add confirm parameters to user directory & add confirm-wait parameter
上级
062d978a
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
37 行增加
和
22 行删除
+37
-22
voicemail_originate.conf.xml
...ginate/conf/autoload_configs/voicemail_originate.conf.xml
+5
-3
mod_voicemail_originate.c
...idbauer/mod_voicemail_originate/mod_voicemail_originate.c
+32
-19
没有找到文件。
eschmidbauer/mod_voicemail_originate/conf/autoload_configs/voicemail_originate.conf.xml
浏览文件 @
68d2dc85
...
...
@@ -7,9 +7,9 @@
-->
</settings>
<profiles>
<profile
name=
"default"
>
<!-- define if profile is enabled. default is true -->
<param
name=
"enabled"
value=
"true"
/>
<profile
name=
"default"
>
<!-- define if profile is enabled. default is true -->
<param
name=
"enabled"
value=
"true"
/>
<!-- time in seconds to wait before first originate. default is 1 -->
<param
name=
"first-wait"
value=
"8"
/>
<!-- time in seconds to wait before originate. default is 30 -->
...
...
@@ -28,6 +28,8 @@
<param
name=
"enable-confirm"
value=
"true"
/>
<!-- digit the called party must enter to confirm call. default is 0 -->
<param
name=
"confirm-digits"
value=
"5"
/>
<!-- time in milliseconds to wait for DTMF. default is 5000 milliseconds -->
<param
name=
"confirm-wait"
value=
"5"
/>
<!-- confirm prompt to play before DTMF is entered -->
<param
name=
"confirm-play-file"
value=
"phrase:vm_originate_confirm:5"
/>
<!-- comma seperated list of user variables to pass on to origination channel -->
...
...
eschmidbauer/mod_voicemail_originate/mod_voicemail_originate.c
浏览文件 @
68d2dc85
...
...
@@ -31,7 +31,7 @@
*/
#include <switch.h>
#define VM_ORIGINATE_
EVENT "vm_originate_even
t"
#define VM_ORIGINATE_
INIT "vm_originate::ini
t"
#define VM_ORIGINATE_SQLITE_DB_NAME "voicemail_originate"
/* Prototypes */
...
...
@@ -51,8 +51,8 @@ static char create_sql[] =
" vm_user VARCHAR(255),
\n
"
" vm_domain VARCHAR(255),
\n
"
" originate_state VARCHAR(255) DEFAULT 'WAIT_FOR_NEXT_ATTEMPT',
\n
"
" created INTEGER
NOT NULL
,
\n
"
" next_attempt INTEGER
NOT NULL DEFAULT 0
,
\n
"
" created INTEGER,
\n
"
" next_attempt INTEGER,
\n
"
" attempt_count INTEGER NOT NULL DEFAULT 0
\n
"
" );
\n
"
;
...
...
@@ -74,7 +74,7 @@ typedef enum {
PFLAG_DESTROY
=
1
<<
0
}
flags_t
;
#define PROFILE_CONFIGITEM_COUNT 1
4
#define PROFILE_CONFIGITEM_COUNT 1
5
struct
user_profile
{
switch_status_t
confirm_status
;
...
...
@@ -89,6 +89,7 @@ struct user_profile {
const
char
*
caller_number
;
switch_bool_t
enable_confirm
;
const
char
*
confirm_digits
;
int
confirm_wait
;
const
char
*
confirm_play_file
;
const
char
*
user_variables
;
const
char
*
dial_string
;
...
...
@@ -108,6 +109,7 @@ struct config_profile {
const
char
*
caller_number
;
switch_bool_t
enable_confirm
;
const
char
*
confirm_digits
;
int
confirm_wait
;
const
char
*
confirm_play_file
;
const
char
*
user_variables
;
const
char
*
dial_string
;
...
...
@@ -294,6 +296,7 @@ config_profile_t *profile_set_config(config_profile_t *profile)
SWITCH_CONFIG_SET_ITEM
(
profile
->
config
[
i
++
],
"caller-number"
,
SWITCH_CONFIG_STRING
,
0
,
&
profile
->
caller_number
,
NULL
,
&
profile
->
config_str_pool
,
NULL
,
NULL
);
SWITCH_CONFIG_SET_ITEM
(
profile
->
config
[
i
++
],
"enable-confirm"
,
SWITCH_CONFIG_BOOL
,
0
,
&
profile
->
enable_confirm
,
SWITCH_FALSE
,
NULL
,
NULL
,
NULL
);
SWITCH_CONFIG_SET_ITEM
(
profile
->
config
[
i
++
],
"confirm-digits"
,
SWITCH_CONFIG_STRING
,
0
,
&
profile
->
confirm_digits
,
NULL
,
&
profile
->
config_str_pool
,
NULL
,
NULL
);
SWITCH_CONFIG_SET_ITEM
(
profile
->
config
[
i
++
],
"confirm-wait"
,
SWITCH_CONFIG_INT
,
0
,
&
profile
->
confirm_wait
,
5000
,
&
config_int_0_86400
,
NULL
,
NULL
);
SWITCH_CONFIG_SET_ITEM
(
profile
->
config
[
i
++
],
"confirm-play-file"
,
SWITCH_CONFIG_STRING
,
0
,
&
profile
->
confirm_play_file
,
NULL
,
&
profile
->
config_str_pool
,
NULL
,
NULL
);
SWITCH_CONFIG_SET_ITEM
(
profile
->
config
[
i
++
],
"user-variables"
,
SWITCH_CONFIG_STRING
,
0
,
&
profile
->
user_variables
,
NULL
,
&
profile
->
config_str_pool
,
NULL
,
NULL
);
SWITCH_CONFIG_SET_ITEM
(
profile
->
config
[
i
++
],
"dial-string"
,
SWITCH_CONFIG_STRING
,
0
,
&
profile
->
dial_string
,
NULL
,
&
profile
->
config_str_pool
,
NULL
,
NULL
);
...
...
@@ -463,6 +466,7 @@ static user_profile_t * set_user_profile(const char *user, const char *domain, s
profile
->
wait
=
30
;
profile
->
first_wait
=
1
;
profile
->
confirm_digits
=
"0"
;
profile
->
confirm_wait
=
5000
;
profile
->
confirm_play_file
=
""
;
x_params
=
switch_xml_child
(
x_user
,
"params"
);
...
...
@@ -477,15 +481,6 @@ static user_profile_t * set_user_profile(const char *user, const char *domain, s
}
else
{
profile
->
profile_enabled
=
config_profile
->
profile_enabled
;
profile
->
enable_confirm
=
config_profile
->
enable_confirm
;
if
(
config_profile
->
confirm_digits
)
{
profile
->
confirm_digits
=
config_profile
->
confirm_digits
;
}
if
(
config_profile
->
confirm_play_file
)
{
profile
->
confirm_play_file
=
config_profile
->
confirm_play_file
;
}
if
(
config_profile
->
dial_string
)
{
profile
->
dial_string
=
config_profile
->
dial_string
;
}
if
(
config_profile
->
caller_name
)
{
profile
->
caller_name
=
config_profile
->
caller_name
;
}
...
...
@@ -495,14 +490,26 @@ static user_profile_t * set_user_profile(const char *user, const char *domain, s
if
(
config_profile
->
timeout
)
{
profile
->
timeout
=
config_profile
->
timeout
;
}
if
(
config_profile
->
attempts
)
{
profile
->
attempts
=
config_profile
->
attempts
;
}
if
(
config_profile
->
wait
)
{
profile
->
wait
=
config_profile
->
wait
;
}
if
(
config_profile
->
first_wait
)
{
profile
->
first_wait
=
config_profile
->
first_wait
;
}
if
(
config_profile
->
attempts
)
{
profile
->
attempts
=
config_profile
->
attempts
;
if
(
config_profile
->
confirm_digits
)
{
profile
->
confirm_digits
=
config_profile
->
confirm_digits
;
}
if
(
config_profile
->
confirm_wait
)
{
profile
->
confirm_wait
=
config_profile
->
confirm_wait
;
}
if
(
config_profile
->
confirm_play_file
)
{
profile
->
confirm_play_file
=
config_profile
->
confirm_play_file
;
}
if
(
config_profile
->
dial_string
)
{
profile
->
dial_string
=
config_profile
->
dial_string
;
}
if
(
config_profile
->
transfer
)
{
profile
->
transfer
=
config_profile
->
transfer
;
...
...
@@ -550,6 +557,12 @@ static user_profile_t * set_user_profile(const char *user, const char *domain, s
user_variables
=
strdup
(
val
);
}
else
if
(
!
strcasecmp
(
var
,
"vm-originate-attempts"
))
{
profile
->
attempts
=
atoi
(
val
);
}
else
if
(
!
strcasecmp
(
var
,
"vm-originate-confirm-digits"
))
{
profile
->
confirm_digits
=
strdup
(
val
);
}
else
if
(
!
strcasecmp
(
var
,
"vm-originate-confirm-wait"
))
{
profile
->
confirm_wait
=
atoi
(
val
);
}
else
if
(
!
strcasecmp
(
var
,
"vm-originate-confirm-play-file"
))
{
profile
->
confirm_play_file
=
strdup
(
val
);
}
}
...
...
@@ -729,12 +742,12 @@ static void *SWITCH_THREAD_FUNC originate_call_thread_run(switch_thread_t *threa
if
(
profile
->
enable_confirm
)
{
char
pin_buf
[
80
]
=
""
;
char
*
buf
=
pin_buf
+
strlen
(
pin_buf
);
char
term
=
'\0'
;
char
term
;
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_DEBUG
,
"Confirming originate with DTMF %s
\n
"
,
profile
->
confirm_digits
);
if
(
!
zstr
(
profile
->
confirm_play_file
))
{
switch_ivr_play_file
(
caller_session
,
NULL
,
profile
->
confirm_play_file
,
NULL
);
}
profile
->
confirm_status
=
switch_ivr_collect_digits_count
(
caller_session
,
buf
,
sizeof
(
pin_buf
)
-
strlen
(
pin_buf
),
strlen
(
profile
->
confirm_digits
),
"#"
,
&
term
,
10000
,
0
,
0
);
profile
->
confirm_status
=
switch_ivr_collect_digits_count
(
caller_session
,
buf
,
sizeof
(
pin_buf
)
-
strlen
(
pin_buf
),
strlen
(
profile
->
confirm_digits
),
"#"
,
&
term
,
profile
->
confirm_wait
,
0
,
0
);
if
(
profile
->
confirm_status
==
SWITCH_STATUS_TIMEOUT
)
{
profile
->
confirm_status
=
SWITCH_STATUS_FALSE
;
}
...
...
@@ -949,7 +962,7 @@ SWITCH_STANDARD_API(vm_originate_function)
account
=
argv
[
1
];
if
(
action
&&
!
strcasecmp
(
action
,
"init"
))
{
if
(
switch_event_create_subclass
(
&
event
,
SWITCH_EVENT_CUSTOM
,
VM_ORIGINATE_
EVEN
T
)
==
SWITCH_STATUS_SUCCESS
)
{
if
(
switch_event_create_subclass
(
&
event
,
SWITCH_EVENT_CUSTOM
,
VM_ORIGINATE_
INI
T
)
==
SWITCH_STATUS_SUCCESS
)
{
stream
->
write_function
(
stream
,
"%s"
,
"+OK
\n
"
);
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"Account"
,
account
);
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"Action"
,
"NEW"
);
...
...
@@ -1007,7 +1020,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_voicemail_originate_load)
if
((
switch_event_bind_removable
(
modname
,
SWITCH_EVENT_MESSAGE_WAITING
,
NULL
,
message_waiting_event_handler
,
NULL
,
&
globals
.
message_waiting_event_handler
)
!=
SWITCH_STATUS_SUCCESS
))
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_WARNING
,
"Couldn't bind our message waiting handler!
\n
"
);
}
if
((
switch_event_bind_removable
(
modname
,
SWITCH_EVENT_CUSTOM
,
VM_ORIGINATE_
EVEN
T
,
originate_event_handler
,
NULL
,
&
globals
.
originate_event_handler
)
!=
SWITCH_STATUS_SUCCESS
))
{
if
((
switch_event_bind_removable
(
modname
,
SWITCH_EVENT_CUSTOM
,
VM_ORIGINATE_
INI
T
,
originate_event_handler
,
NULL
,
&
globals
.
originate_event_handler
)
!=
SWITCH_STATUS_SUCCESS
))
{
switch_log_printf
(
SWITCH_CHANNEL_LOG
,
SWITCH_LOG_WARNING
,
"Couldn't bind our message waiting handler!
\n
"
);
}
switch_mutex_unlock
(
globals
.
mutex
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论