Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
40c983be
提交
40c983be
authored
8月 01, 2013
作者:
Chris Rienzo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
FS-5657 --resolve fix mod_rayo build errors in CentOS 5
上级
fed93fd4
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
221 行增加
和
164 行删除
+221
-164
Makefile
src/mod/event_handlers/mod_rayo/Makefile
+2
-0
iks_helpers.c
src/mod/event_handlers/mod_rayo/iks_helpers.c
+87
-0
iks_helpers.h
src/mod/event_handlers/mod_rayo/iks_helpers.h
+8
-89
rayo_elements.c
src/mod/event_handlers/mod_rayo/rayo_elements.c
+117
-0
rayo_elements.h
src/mod/event_handlers/mod_rayo/rayo_elements.h
+7
-75
没有找到文件。
src/mod/event_handlers/mod_rayo/Makefile
浏览文件 @
40c983be
...
...
@@ -10,6 +10,7 @@ LOCAL_OBJS= $(IKS_LA) \
iks_helpers.o
\
nlsml.o
\
rayo_components.o
\
rayo_elements.o
\
rayo_input_component.o
\
rayo_output_component.o
\
rayo_prompt_component.o
\
...
...
@@ -21,6 +22,7 @@ LOCAL_SOURCES= \
iks_helpers.c
\
nlsml.c
\
rayo_components.c
\
rayo_elements.c
\
rayo_input_component.c
\
rayo_output_component.c
\
rayo_prompt_component.c
\
...
...
src/mod/event_handlers/mod_rayo/iks_helpers.c
浏览文件 @
40c983be
...
...
@@ -305,6 +305,93 @@ int value_matches(const char *value, const char *rule)
return
0
;
}
/**
* Validate boolean
* @param value
* @return SWTICH_TRUE if boolean
*/
int
iks_attrib_is_bool
(
const
char
*
value
)
{
if
(
value
&&
*
value
&&
(
!
strcasecmp
(
"true"
,
value
)
||
!
strcasecmp
(
"false"
,
value
)))
{
return
SWITCH_TRUE
;
}
return
SWITCH_FALSE
;
}
/**
* Validate integer
* @param value
* @return SWTICH_TRUE if not negative
*/
int
iks_attrib_is_not_negative
(
const
char
*
value
)
{
if
(
value
&&
*
value
&&
switch_is_number
(
value
))
{
int
value_i
=
atoi
(
value
);
if
(
value_i
>=
0
)
{
return
SWITCH_TRUE
;
}
}
return
SWITCH_FALSE
;
}
/**
* Validate integer
* @param value
* @return SWTICH_TRUE if positive
*/
int
iks_attrib_is_positive
(
const
char
*
value
)
{
if
(
value
&&
*
value
&&
switch_is_number
(
value
))
{
int
value_i
=
atoi
(
value
);
if
(
value_i
>
0
)
{
return
SWITCH_TRUE
;
}
}
return
SWITCH_FALSE
;
}
/**
* Validate integer
* @param value
* @return SWTICH_TRUE if positive or -1
*/
int
iks_attrib_is_positive_or_neg_one
(
const
char
*
value
)
{
if
(
value
&&
*
value
&&
switch_is_number
(
value
))
{
int
value_i
=
atoi
(
value
);
if
(
value_i
==
-
1
||
value_i
>
0
)
{
return
SWITCH_TRUE
;
}
}
return
SWITCH_FALSE
;
}
/**
* Validate string
* @param value
* @return SWTICH_TRUE
*/
int
iks_attrib_is_any
(
const
char
*
value
)
{
return
SWITCH_TRUE
;
}
/**
* Validate decimal
* @param value
* @return SWTICH_TRUE if 0.0 <= x <= 1.0
*/
int
iks_attrib_is_decimal_between_zero_and_one
(
const
char
*
value
)
{
if
(
value
&&
*
value
&&
switch_is_number
(
value
))
{
double
value_d
=
atof
(
value
);
if
(
value_d
>=
0
.
0
||
value_d
<=
1
.
0
)
{
return
SWITCH_TRUE
;
}
}
return
SWITCH_FALSE
;
}
#define IKS_SHA256_HEX_DIGEST_LENGTH ((SHA256_DIGEST_LENGTH * 2) + 1)
/**
...
...
src/mod/event_handlers/mod_rayo/iks_helpers.h
浏览文件 @
40c983be
...
...
@@ -73,101 +73,20 @@ extern char *iks_server_dialback_key(const char *secret, const char *receiving_s
/** A function to validate attribute value */
typedef
int
(
*
iks_attrib_validation_function
)(
const
char
*
);
#define ELEMENT(name) inline int VALIDATE_##name(iks *node) { int result = 1; if (!node) return 0;
#define ELEMENT_DECL(name) extern int VALIDATE_##name(iks *node);
#define ELEMENT(name) int VALIDATE_##name(iks *node) { int result = 1; if (!node) return 0;
#define ATTRIB(name, def, rule) result &= iks_attrib_is_##rule(iks_find_attrib_default(node, #name, #def));
#define STRING_ATTRIB(name, def, rule) result &= value_matches(iks_find_attrib_default(node, #name, #def), rule);
#define ELEMENT_END return result; }
extern
int
value_matches
(
const
char
*
value
,
const
char
*
rule
);
#define ATTRIB_RULE(rule) inline int iks_attrib_is_ ## rule (const char *value)
/**
* Validate boolean
* @param value
* @return SWTICH_TRUE if boolean
*/
ATTRIB_RULE
(
bool
)
{
if
(
value
&&
*
value
&&
(
!
strcasecmp
(
"true"
,
value
)
||
!
strcasecmp
(
"false"
,
value
)))
{
return
SWITCH_TRUE
;
}
return
SWITCH_FALSE
;
}
/**
* Validate integer
* @param value
* @return SWTICH_TRUE if not negative
*/
ATTRIB_RULE
(
not_negative
)
{
if
(
value
&&
*
value
&&
switch_is_number
(
value
))
{
int
value_i
=
atoi
(
value
);
if
(
value_i
>=
0
)
{
return
SWITCH_TRUE
;
}
}
return
SWITCH_FALSE
;
}
/**
* Validate integer
* @param value
* @return SWTICH_TRUE if positive
*/
ATTRIB_RULE
(
positive
)
{
if
(
value
&&
*
value
&&
switch_is_number
(
value
))
{
int
value_i
=
atoi
(
value
);
if
(
value_i
>
0
)
{
return
SWITCH_TRUE
;
}
}
return
SWITCH_FALSE
;
}
/**
* Validate integer
* @param value
* @return SWTICH_TRUE if positive or -1
*/
ATTRIB_RULE
(
positive_or_neg_one
)
{
if
(
value
&&
*
value
&&
switch_is_number
(
value
))
{
int
value_i
=
atoi
(
value
);
if
(
value_i
==
-
1
||
value_i
>
0
)
{
return
SWITCH_TRUE
;
}
}
return
SWITCH_FALSE
;
}
/**
* Validate string
* @param value
* @return SWTICH_TRUE
*/
ATTRIB_RULE
(
any
)
{
return
SWITCH_TRUE
;
}
/**
* Validate decimal
* @param value
* @return SWTICH_TRUE if 0.0 <= x <= 1.0
*/
ATTRIB_RULE
(
decimal_between_zero_and_one
)
{
if
(
value
&&
*
value
&&
switch_is_number
(
value
))
{
double
value_d
=
atof
(
value
);
if
(
value_d
>=
0
.
0
||
value_d
<=
1
.
0
)
{
return
SWITCH_TRUE
;
}
}
return
SWITCH_FALSE
;
}
extern
int
iks_attrib_is_bool
(
const
char
*
value
);
extern
int
iks_attrib_is_not_negative
(
const
char
*
value
);
extern
int
iks_attrib_is_positive
(
const
char
*
value
);
extern
int
iks_attrib_is_positive_or_neg_one
(
const
char
*
value
);
extern
int
iks_attrib_is_any
(
const
char
*
value
);
extern
int
iks_attrib_is_decimal_between_zero_and_one
(
const
char
*
value
);
#endif
...
...
src/mod/event_handlers/mod_rayo/rayo_elements.c
0 → 100644
浏览文件 @
40c983be
/*
* mod_rayo for FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
* Copyright (C) 2013, Grasshopper
*
* Version: MPL 1.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mod_rayo for FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
*
* The Initial Developer of the Original Code is Grasshopper
* Portions created by the Initial Developer are Copyright (C)
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Chris Rienzo <chris.rienzo@grasshopper.com>
*
* rayo_elements.c -- Rayo XML element definition
*
*/
#include "rayo_elements.h"
/**
* <input> component validation
*/
ELEMENT
(
RAYO_INPUT
)
STRING_ATTRIB
(
mode
,
any
,
"any,dtmf,voice"
)
ATTRIB
(
terminator
,,
any
)
ATTRIB
(
recognizer
,,
any
)
ATTRIB
(
language
,
en
-
US
,
any
)
ATTRIB
(
initial
-
timeout
,
-
1
,
positive_or_neg_one
)
ATTRIB
(
inter
-
digit
-
timeout
,
-
1
,
positive_or_neg_one
)
ATTRIB
(
sensitivity
,
0
.
5
,
decimal_between_zero_and_one
)
ATTRIB
(
min
-
confidence
,
0
,
decimal_between_zero_and_one
)
ATTRIB
(
max
-
silence
,
-
1
,
positive_or_neg_one
)
/* for now, only NLSML */
STRING_ATTRIB
(
match
-
content
-
type
,
application
/
nlsml
+
xml
,
"application/nlsml+xml"
)
/* internal attribs for prompt support */
ATTRIB
(
barge
-
event
,
false
,
bool
)
ATTRIB
(
start
-
timers
,
true
,
bool
)
ELEMENT_END
/**
* <output> component validation
*/
ELEMENT
(
RAYO_OUTPUT
)
ATTRIB
(
start
-
offset
,
0
,
not_negative
)
ATTRIB
(
start
-
paused
,
false
,
bool
)
ATTRIB
(
repeat
-
interval
,
0
,
not_negative
)
ATTRIB
(
repeat
-
times
,
1
,
not_negative
)
ATTRIB
(
max
-
time
,
-
1
,
positive_or_neg_one
)
ATTRIB
(
renderer
,,
any
)
ATTRIB
(
voice
,,
any
)
ELEMENT_END
/**
* <output><seek> validation
*/
ELEMENT
(
RAYO_OUTPUT_SEEK
)
STRING_ATTRIB
(
direction
,,
"forward,back"
)
ATTRIB
(
amount
,
-
1
,
positive
)
ELEMENT_END
/**
* <prompt> component validation
*/
ELEMENT
(
RAYO_PROMPT
)
ATTRIB
(
barge
-
in
,
true
,
bool
)
ELEMENT_END
/**
* <record> component validation
*/
ELEMENT
(
RAYO_RECORD
)
ATTRIB
(
format
,
mp3
,
any
)
ATTRIB
(
start
-
beep
,
false
,
bool
)
ATTRIB
(
stop
-
beep
,
false
,
bool
)
ATTRIB
(
start
-
paused
,
false
,
bool
)
ATTRIB
(
max
-
duration
,
-
1
,
positive_or_neg_one
)
ATTRIB
(
initial
-
timeout
,
-
1
,
positive_or_neg_one
)
ATTRIB
(
final
-
timeout
,
-
1
,
positive_or_neg_one
)
STRING_ATTRIB
(
direction
,
duplex
,
"duplex,send,recv"
)
ATTRIB
(
mix
,
false
,
bool
)
ELEMENT_END
/**
* <join> command validation
*/
ELEMENT
(
RAYO_JOIN
)
/* for now, only allow duplex
STRING_ATTRIB(direction, duplex, "send,recv,duplex"); */
STRING_ATTRIB
(
direction
,
duplex
,
"duplex"
)
STRING_ATTRIB
(
media
,
bridge
,
"bridge,direct"
)
ATTRIB
(
call
-
uri
,,
any
)
ATTRIB
(
mixer
-
name
,,
any
)
ELEMENT_END
/* For Emacs:
* Local Variables:
* mode:c
* indent-tabs-mode:t
* tab-width:4
* c-basic-offset:4
* End:
* For VIM:
* vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet
*/
src/mod/event_handlers/mod_rayo/rayo_elements.h
浏览文件 @
40c983be
...
...
@@ -23,7 +23,7 @@
* Contributor(s):
* Chris Rienzo <chris.rienzo@grasshopper.com>
*
* rayo_elements.h -- Rayo XML element
definition
* rayo_elements.h -- Rayo XML element
s
*
*/
#ifndef RAYO_ELEMENTS_H
...
...
@@ -31,80 +31,12 @@
#include "iks_helpers.h"
/**
* <input> component validation
*/
ELEMENT
(
RAYO_INPUT
)
STRING_ATTRIB
(
mode
,
any
,
"any,dtmf,voice"
)
ATTRIB
(
terminator
,,
any
)
ATTRIB
(
recognizer
,,
any
)
ATTRIB
(
language
,
en
-
US
,
any
)
ATTRIB
(
initial
-
timeout
,
-
1
,
positive_or_neg_one
)
ATTRIB
(
inter
-
digit
-
timeout
,
-
1
,
positive_or_neg_one
)
ATTRIB
(
sensitivity
,
0
.
5
,
decimal_between_zero_and_one
)
ATTRIB
(
min
-
confidence
,
0
,
decimal_between_zero_and_one
)
ATTRIB
(
max
-
silence
,
-
1
,
positive_or_neg_one
)
/* for now, only NLSML */
STRING_ATTRIB
(
match
-
content
-
type
,
application
/
nlsml
+
xml
,
"application/nlsml+xml"
)
/* internal attribs for prompt support */
ATTRIB
(
barge
-
event
,
false
,
bool
)
ATTRIB
(
start
-
timers
,
true
,
bool
)
ELEMENT_END
/**
* <output> component validation
*/
ELEMENT
(
RAYO_OUTPUT
)
ATTRIB
(
start
-
offset
,
0
,
not_negative
)
ATTRIB
(
start
-
paused
,
false
,
bool
)
ATTRIB
(
repeat
-
interval
,
0
,
not_negative
)
ATTRIB
(
repeat
-
times
,
1
,
not_negative
)
ATTRIB
(
max
-
time
,
-
1
,
positive_or_neg_one
)
ATTRIB
(
renderer
,,
any
)
ATTRIB
(
voice
,,
any
)
ELEMENT_END
/**
* <output><seek> validation
*/
ELEMENT
(
RAYO_OUTPUT_SEEK
)
STRING_ATTRIB
(
direction
,,
"forward,back"
)
ATTRIB
(
amount
,
-
1
,
positive
)
ELEMENT_END
/**
* <prompt> component validation
*/
ELEMENT
(
RAYO_PROMPT
)
ATTRIB
(
barge
-
in
,
true
,
bool
)
ELEMENT_END
/**
* <record> component validation
*/
ELEMENT
(
RAYO_RECORD
)
ATTRIB
(
format
,
mp3
,
any
)
ATTRIB
(
start
-
beep
,
false
,
bool
)
ATTRIB
(
stop
-
beep
,
false
,
bool
)
ATTRIB
(
start
-
paused
,
false
,
bool
)
ATTRIB
(
max
-
duration
,
-
1
,
positive_or_neg_one
)
ATTRIB
(
initial
-
timeout
,
-
1
,
positive_or_neg_one
)
ATTRIB
(
final
-
timeout
,
-
1
,
positive_or_neg_one
)
STRING_ATTRIB
(
direction
,
duplex
,
"duplex,send,recv"
)
ATTRIB
(
mix
,
false
,
bool
)
ELEMENT_END
/**
* <join> command validation
*/
ELEMENT
(
RAYO_JOIN
)
/* for now, only allow duplex
STRING_ATTRIB(direction, duplex, "send,recv,duplex"); */
STRING_ATTRIB
(
direction
,
duplex
,
"duplex"
)
STRING_ATTRIB
(
media
,
bridge
,
"bridge,direct"
)
ATTRIB
(
call
-
uri
,,
any
)
ATTRIB
(
mixer
-
name
,,
any
)
ELEMENT_END
ELEMENT_DECL
(
RAYO_INPUT
)
ELEMENT_DECL
(
RAYO_OUTPUT
)
ELEMENT_DECL
(
RAYO_OUTPUT_SEEK
)
ELEMENT_DECL
(
RAYO_PROMPT
)
ELEMENT_DECL
(
RAYO_RECORD
)
ELEMENT_DECL
(
RAYO_JOIN
)
#endif
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论