Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
98a95016
提交
98a95016
authored
3月 28, 2011
作者:
Rupa Schomaker
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-1792 - add API uuid_limit - thanks to François Delawarde
上级
084819a3
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
83 行增加
和
0 行删除
+83
-0
mod_commands.c
src/mod/applications/mod_commands/mod_commands.c
+83
-0
没有找到文件。
src/mod/applications/mod_commands/mod_commands.c
浏览文件 @
98a95016
...
...
@@ -4843,6 +4843,87 @@ end:
return
SWITCH_STATUS_SUCCESS
;
}
#define LIMIT_SYNTAX "<uuid> <backend> <realm> <resource> [<max>[/interval]] [number [dialplan [context]]]"
SWITCH_STANDARD_API
(
uuid_limit_function
)
{
int
argc
=
0
;
char
*
argv
[
8
]
=
{
0
};
char
*
mydata
=
NULL
;
char
*
realm
=
NULL
;
char
*
resource
=
NULL
;
char
*
xfer_exten
=
NULL
;
int
max
=
-
1
;
int
interval
=
0
;
switch_core_session_t
*
sess
=
NULL
;
switch_status_t
res
=
SWITCH_STATUS_SUCCESS
;
if
(
!
zstr
(
cmd
))
{
mydata
=
strdup
(
cmd
);
switch_assert
(
mydata
);
argc
=
switch_separate_string
(
mydata
,
' '
,
argv
,
(
sizeof
(
argv
)
/
sizeof
(
argv
[
0
])));
}
if
(
argc
<
4
)
{
stream
->
write_function
(
stream
,
"USAGE: uuid_limit %s
\n
"
,
LIMIT_SYNTAX
);
goto
end
;
}
realm
=
argv
[
2
];
resource
=
argv
[
3
];
/* If max is omitted or negative, only act as a counter and skip maximum checks */
if
(
argc
>
4
)
{
if
(
argv
[
4
][
0
]
==
'-'
)
{
max
=
-
1
;
}
else
{
char
*
szinterval
=
NULL
;
if
((
szinterval
=
strchr
(
argv
[
4
],
'/'
)))
{
*
szinterval
++
=
'\0'
;
interval
=
atoi
(
szinterval
);
}
max
=
atoi
(
argv
[
4
]);
if
(
max
<
0
)
{
max
=
0
;
}
}
}
if
(
argc
>
5
)
{
xfer_exten
=
argv
[
5
];
}
else
{
xfer_exten
=
LIMIT_DEF_XFER_EXTEN
;
}
sess
=
switch_core_session_locate
(
argv
[
0
]);
if
(
!
sess
)
{
stream
->
write_function
(
stream
,
"-ERR did not find a session with uuid %s
\n
"
,
argv
[
0
]);
goto
end
;
}
res
=
switch_limit_incr
(
argv
[
1
],
sess
,
realm
,
resource
,
max
,
interval
);
if
(
res
!=
SWITCH_STATUS_SUCCESS
)
{
/* Limit exceeded */
if
(
*
xfer_exten
==
'!'
)
{
switch_channel_t
*
channel
=
switch_core_session_get_channel
(
sess
);
switch_channel_hangup
(
channel
,
switch_channel_str2cause
(
xfer_exten
+
1
));
}
else
{
switch_ivr_session_transfer
(
sess
,
xfer_exten
,
argv
[
6
],
argv
[
7
]);
}
}
switch_core_session_rwunlock
(
sess
);
stream
->
write_function
(
stream
,
"+OK"
);
end
:
switch_safe_free
(
mydata
);
return
SWITCH_STATUS_SUCCESS
;
}
#define LIMIT_RELEASE_SYNTAX "<uuid> <backend> [realm] [resource]"
SWITCH_STANDARD_API
(
uuid_limit_release_function
)
{
...
...
@@ -5063,6 +5144,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load)
SWITCH_ADD_API
(
commands_api_interface
,
"uuid_getvar"
,
"uuid_getvar"
,
uuid_getvar_function
,
GETVAR_SYNTAX
);
SWITCH_ADD_API
(
commands_api_interface
,
"uuid_hold"
,
"hold"
,
uuid_hold_function
,
HOLD_SYNTAX
);
SWITCH_ADD_API
(
commands_api_interface
,
"uuid_kill"
,
"Kill Channel"
,
kill_function
,
KILL_SYNTAX
);
SWITCH_ADD_API
(
commands_api_interface
,
"uuid_limit"
,
"Increase limit resource"
,
uuid_limit_function
,
LIMIT_SYNTAX
);
SWITCH_ADD_API
(
commands_api_interface
,
"uuid_limit_release"
,
"Release limit resource"
,
uuid_limit_release_function
,
LIMIT_RELEASE_SYNTAX
);
SWITCH_ADD_API
(
commands_api_interface
,
"uuid_loglevel"
,
"set loglevel on session"
,
uuid_loglevel
,
UUID_LOGLEVEL_SYNTAX
);
SWITCH_ADD_API
(
commands_api_interface
,
"uuid_media"
,
"media"
,
uuid_media_function
,
MEDIA_SYNTAX
);
...
...
@@ -5181,6 +5263,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_commands_load)
switch_console_set_complete
(
"add uuid_hold ::console::list_uuid"
);
switch_console_set_complete
(
"add uuid_jitterbuffer ::console::list_uuid"
);
switch_console_set_complete
(
"add uuid_kill ::console::list_uuid"
);
switch_console_set_complete
(
"add uuid_limit ::console::list_uuid"
);
switch_console_set_complete
(
"add uuid_limit_release ::console::list_uuid"
);
switch_console_set_complete
(
"add uuid_loglevel ::console::list_uuid console"
);
switch_console_set_complete
(
"add uuid_loglevel ::console::list_uuid alert"
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论