Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
79cfacd1
提交
79cfacd1
authored
7月 07, 2009
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
get boost up to date
git-svn-id:
http://svn.openzap.org/svn/openzap/trunk@759
a93c3328-9c30-0410-af19-c9cd2b2d52af
上级
92a6bc5d
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
103 行增加
和
47 行删除
+103
-47
ozmod_ss7_boost.c
libs/openzap/src/ozmod/ozmod_ss7_boost/ozmod_ss7_boost.c
+91
-45
ss7_boost_client.c
libs/openzap/src/ozmod/ozmod_ss7_boost/ss7_boost_client.c
+12
-2
没有找到文件。
libs/openzap/src/ozmod/ozmod_ss7_boost/ozmod_ss7_boost.c
浏览文件 @
79cfacd1
...
...
@@ -38,6 +38,9 @@
#include <sys/select.h>
#endif
#define MAX_TRUNK_GROUPS 64
static
time_t
congestion_timeouts
[
MAX_TRUNK_GROUPS
];
/**
* \brief Strange flag
*/
...
...
@@ -180,46 +183,41 @@ static zap_channel_t *find_zchan(zap_span_t *span, ss7bc_short_event_t *event, i
for
(
i
=
1
;
i
<=
span
->
chan_count
;
i
++
)
{
if
(
span
->
channels
[
i
]
->
physical_span_id
==
event
->
span
+
1
&&
span
->
channels
[
i
]
->
physical_chan_id
==
event
->
chan
+
1
)
{
zchan
=
span
->
channels
[
i
];
if
(
force
)
{
if
(
force
||
(
zchan
->
state
==
ZAP_CHANNEL_STATE_DOWN
&&
!
zap_test_flag
(
zchan
,
ZAP_CHANNEL_INUSE
)))
{
break
;
}
else
{
zchan
=
NULL
;
zap_log
(
ZAP_LOG_ERROR
,
"Channel %d:%d ~ %d:%d is already in use.
\n
"
,
span
->
channels
[
i
]
->
span_id
,
span
->
channels
[
i
]
->
chan_id
,
span
->
channels
[
i
]
->
physical_span_id
,
span
->
channels
[
i
]
->
physical_chan_id
);
break
;
}
if
(
zap_test_flag
(
zchan
,
ZAP_CHANNEL_INUSE
)
||
zchan
->
state
!=
ZAP_CHANNEL_STATE_DOWN
)
{
if
(
zchan
->
state
==
ZAP_CHANNEL_STATE_DOWN
||
zchan
->
state
>=
ZAP_CHANNEL_STATE_TERMINATING
)
{
int
x
=
0
;
zap_log
(
ZAP_LOG_WARNING
,
"Channel %d:%d ~ %d:%d is already in use waiting for it to become available.
\n
"
,
span
->
channels
[
i
]
->
span_id
,
span
->
channels
[
i
]
->
chan_id
,
span
->
channels
[
i
]
->
physical_span_id
,
span
->
channels
[
i
]
->
physical_chan_id
);
zap_mutex_unlock
(
signal_mutex
);
for
(
x
=
0
;
x
<
200
;
x
++
)
{
if
(
!
zap_test_flag
(
zchan
,
ZAP_CHANNEL_INUSE
))
{
break
;
}
zap_sleep
(
5
);
}
zap_mutex_lock
(
signal_mutex
);
}
if
(
zap_test_flag
(
zchan
,
ZAP_CHANNEL_INUSE
))
{
zchan
=
NULL
;
zap_log
(
ZAP_LOG_ERROR
,
"Channel %d:%d ~ %d:%d is already in use.
\n
"
,
span
->
channels
[
i
]
->
span_id
,
span
->
channels
[
i
]
->
chan_id
,
span
->
channels
[
i
]
->
physical_span_id
,
span
->
channels
[
i
]
->
physical_chan_id
);
}
}
break
;
}
}
zap_mutex_unlock
(
signal_mutex
);
return
zchan
;
}
static
int
check_congestion
(
int
trunk_group
)
{
if
(
congestion_timeouts
[
trunk_group
])
{
time_t
now
=
time
(
NULL
);
if
(
now
>=
congestion_timeouts
[
trunk_group
])
{
congestion_timeouts
[
trunk_group
]
=
0
;
}
else
{
return
1
;
}
}
return
0
;
}
/**
* \brief Requests an ss7 boost channel on a span (outgoing call)
* \param span Span where to get a channel
...
...
@@ -240,12 +238,33 @@ static ZIO_CHANNEL_REQUEST_FUNCTION(ss7_boost_channel_request)
char
ani
[
128
]
=
""
;
char
*
gr
=
NULL
;
uint32_t
count
=
0
;
int
tg
=
0
;
if
(
zap_test_flag
(
span
,
ZAP_SPAN_SUSPENDED
))
{
zap_log
(
ZAP_LOG_CRIT
,
"SPAN is not online.
\n
"
);
*
zchan
=
NULL
;
return
ZAP_FAIL
;
}
zap_set_string
(
ani
,
caller_data
->
ani
.
digits
);
if
((
gr
=
strchr
(
ani
,
'@'
)))
{
*
gr
++
=
'\0'
;
}
if
(
gr
&&
*
(
gr
+
1
))
{
tg
=
atoi
(
gr
+
1
);
if
(
tg
>
0
)
{
tg
--
;
}
}
event
.
trunk_group
=
tg
;
if
(
check_congestion
(
tg
))
{
zap_log
(
ZAP_LOG_CRIT
,
"All circuits are busy. (BOOST REQUESTED BACK OFF)
\n
"
);
*
zchan
=
NULL
;
return
ZAP_FAIL
;
}
zap_span_channel_use_count
(
span
,
&
count
);
...
...
@@ -262,20 +281,9 @@ static ZIO_CHANNEL_REQUEST_FUNCTION(ss7_boost_channel_request)
return
ZAP_FAIL
;
}
zap_set_string
(
ani
,
caller_data
->
ani
.
digits
);
if
((
gr
=
strchr
(
ani
,
'@'
)))
{
*
gr
++
=
'\0'
;
}
ss7bc_call_init
(
&
event
,
caller_data
->
cid_num
.
digits
,
ani
,
r
);
if
(
gr
&&
*
(
gr
+
1
))
{
event
.
trunk_group
=
atoi
(
gr
+
1
);
if
(
event
.
trunk_group
>
0
)
{
event
.
trunk_group
--
;
}
switch
(
*
gr
)
{
case
'g'
:
...
...
@@ -363,6 +371,12 @@ static ZIO_CHANNEL_REQUEST_FUNCTION(ss7_boost_channel_request)
static
ZIO_CHANNEL_OUTGOING_CALL_FUNCTION
(
ss7_boost_outgoing_call
)
{
zap_status_t
status
=
ZAP_SUCCESS
;
if
(
check_congestion
(
0
))
{
zap_log
(
ZAP_LOG_CRIT
,
"All circuits are busy. (BOOST REQUESTED BACK OFF)
\n
"
);
return
ZAP_FAIL
;
}
return
status
;
}
...
...
@@ -464,7 +478,35 @@ static void handle_call_start_nack(zap_span_t *span, ss7bc_connection_t *mcon, s
{
zap_channel_t
*
zchan
;
if
(
event
->
release_cause
==
SIGBOOST_CALL_SETUP_NACK_ALL_CKTS_BUSY
)
{
uint32_t
count
=
0
;
int
delay
=
0
;
int
tg
=
event
->
trunk_group
;
zap_span_channel_use_count
(
span
,
&
count
);
delay
=
(
int
)
(
count
/
100
)
*
2
;
if
(
delay
>
10
)
{
delay
=
10
;
}
else
if
(
delay
<
1
)
{
delay
=
1
;
}
if
(
tg
<
0
||
tg
>=
MAX_TRUNK_GROUPS
)
{
zap_log
(
ZAP_LOG_CRIT
,
"Invalid All Ckt Busy trunk group number %i
\n
"
,
tg
);
tg
=
0
;
}
congestion_timeouts
[
tg
]
=
time
(
NULL
)
+
delay
;
event
->
release_cause
=
17
;
}
else
if
(
event
->
release_cause
==
SIGBOOST_CALL_SETUP_CSUPID_DBL_USE
)
{
event
->
release_cause
=
17
;
}
if
(
event
->
call_setup_id
)
{
ss7bc_exec_command
(
mcon
,
0
,
0
,
...
...
@@ -959,6 +1001,7 @@ static __inline__ void state_advance(zap_channel_t *zchan)
static
__inline__
void
init_outgoing_array
(
void
)
{
memset
(
&
OUTBOUND_REQUESTS
,
0
,
sizeof
(
OUTBOUND_REQUESTS
));
}
/**
...
...
@@ -1090,16 +1133,20 @@ static void *zap_ss7_boost_run(zap_thread_t *me, void *obj)
}
if
(
FD_ISSET
(
pcon
->
socket
,
&
rfds
))
{
if
((
event
=
ss7bc_connection_readp
(
pcon
,
i
)))
{
while
((
event
=
ss7bc_connection_readp
(
pcon
,
i
)))
{
parse_ss7_event
(
span
,
pcon
,
(
ss7bc_short_event_t
*
)
event
);
i
++
;
}
}
i
=
0
;
if
(
FD_ISSET
(
mcon
->
socket
,
&
rfds
))
{
if
((
event
=
ss7bc_connection_read
(
mcon
,
i
)))
{
parse_ss7_event
(
span
,
mcon
,
(
ss7bc_short_event_t
*
)
event
);
i
++
;
}
}
}
...
...
@@ -1127,7 +1174,6 @@ static void *zap_ss7_boost_run(zap_thread_t *me, void *obj)
if
(
zap_running
())
{
check_state
(
span
);
}
}
goto
end
;
...
...
libs/openzap/src/ozmod/ozmod_ss7_boost/ss7_boost_client.c
浏览文件 @
79cfacd1
...
...
@@ -64,7 +64,9 @@ static struct ss7bc_map ss7bc_table[] = {
{
SIGBOOST_EVENT_SYSTEM_RESTART_ACK
,
"SYSTEM_RESTART_ACK"
},
{
SIGBOOST_EVENT_HEARTBEAT
,
"HEARTBEAT"
},
{
SIGBOOST_EVENT_INSERT_CHECK_LOOP
,
"LOOP START"
},
{
SIGBOOST_EVENT_REMOVE_CHECK_LOOP
,
"LOOP STOP"
}
{
SIGBOOST_EVENT_REMOVE_CHECK_LOOP
,
"LOOP STOP"
},
{
SIGBOOST_EVENT_AUTO_CALL_GAP_ABATE
,
"AUTO_CALL_GAP_ABATE"
},
{
SIGBOOST_EVENT_DIGIT_IN
,
"DIGIT_IN"
}
};
...
...
@@ -261,6 +263,10 @@ ss7bc_event_t *__ss7bc_connection_read(ss7bc_connection_t *mcon, int iteration,
bytes
=
recvfrom
(
mcon
->
socket
,
&
mcon
->
event
,
sizeof
(
mcon
->
event
),
MSG_DONTWAIT
,
(
struct
sockaddr
*
)
&
mcon
->
local_addr
,
&
fromlen
);
if
(
bytes
<=
0
)
{
return
NULL
;
}
if
(
mcon
->
event
.
version
!=
SIGBOOST_VERSION
)
{
zap_log
(
ZAP_LOG_CRIT
,
"Invalid Boost Version %i Expecting %i
\n
"
,
mcon
->
event
.
version
,
SIGBOOST_VERSION
);
}
...
...
@@ -338,7 +344,11 @@ ss7bc_event_t *__ss7bc_connection_readp(ss7bc_connection_t *mcon, int iteration,
int
bytes
=
0
;
bytes
=
recvfrom
(
mcon
->
socket
,
&
mcon
->
event
,
sizeof
(
mcon
->
event
),
MSG_DONTWAIT
,
(
struct
sockaddr
*
)
&
mcon
->
local_addr
,
&
fromlen
);
if
(
bytes
<=
0
)
{
return
NULL
;
}
if
(
mcon
->
event
.
version
!=
SIGBOOST_VERSION
)
{
zap_log
(
ZAP_LOG_CRIT
,
"Invalid Boost Version %i Expecting %i
\n
"
,
mcon
->
event
.
version
,
SIGBOOST_VERSION
);
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论