Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
d22db18b
提交
d22db18b
authored
3月 26, 2006
作者:
Anthony Minessale
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update
git-svn-id:
http://svn.freeswitch.org/svn/freeswitch/trunk@930
d0543943-73ff-0310-b7d9-9358b9ac24b2
上级
bcb9d08d
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
39 行增加
和
9 行删除
+39
-9
Makefile
src/mod/endpoints/mod_wanpipe/Makefile
+1
-1
mod_wanpipe.c
src/mod/endpoints/mod_wanpipe/mod_wanpipe.c
+35
-6
switch_console.c
src/switch_console.c
+3
-2
没有找到文件。
src/mod/endpoints/mod_wanpipe/Makefile
浏览文件 @
d22db18b
...
...
@@ -12,7 +12,7 @@ endif
all
:
depends $(MODNAME).$(DYNAMIC_LIB_EXTEN)
depends
:
MAKE
=
$(MAKE)
$(BASE)
/build/buildlib.sh
$(BASE)
install
libsangoma
--prefix
=
$(PREFIX)
MAKE
=
$(MAKE)
$(BASE)
/build/buildlib.sh
$(BASE)
install
libsangoma
--prefix
=
$(PREFIX)
--with-libpri
=
/usr/src/libpri
$(MODNAME).$(DYNAMIC_LIB_EXTEN)
:
$(MODNAME).c
$(CC)
$(CFLAGS)
-fPIC
-c
$(MODNAME)
.c
-o
$(MODNAME)
.o
...
...
src/mod/endpoints/mod_wanpipe/mod_wanpipe.c
浏览文件 @
d22db18b
...
...
@@ -61,7 +61,8 @@ typedef enum {
TFLAG_DESTROY
=
(
1
<<
7
),
TFLAG_ABORT
=
(
1
<<
8
),
TFLAG_SWITCH
=
(
1
<<
9
),
TFLAG_NOSIG
=
(
1
<<
10
)
TFLAG_NOSIG
=
(
1
<<
10
),
TFLAG_BYE
=
(
1
<<
11
)
}
TFLAGS
;
...
...
@@ -336,6 +337,7 @@ static switch_status wanpipe_on_hangup(switch_core_session *session)
tech_pvt
=
switch_core_session_get_private
(
session
);
assert
(
tech_pvt
!=
NULL
);
switch_set_flag
(
tech_pvt
,
TFLAG_BYE
);
if
(
!
switch_test_flag
(
tech_pvt
,
TFLAG_NOSIG
))
{
chanmap
=
tech_pvt
->
spri
->
private_info
;
...
...
@@ -397,9 +399,11 @@ static switch_status wanpipe_outgoing_channel(switch_core_session *session, swit
switch_core_session
**
new_session
,
switch_memory_pool
*
pool
)
{
char
*
bchan
=
NULL
;
char
name
[
128
]
=
""
;
if
(
outbound_profile
&&
outbound_profile
->
destination_number
)
{
bchan
=
strchr
(
outbound_profile
->
destination_number
,
'
%
'
);
bchan
=
strchr
(
outbound_profile
->
destination_number
,
'
=
'
);
}
else
{
return
SWITCH_STATUS_FALSE
;
}
...
...
@@ -434,7 +438,6 @@ static switch_status wanpipe_outgoing_channel(switch_core_session *session, swit
if
(
outbound_profile
)
{
char
name
[
128
];
switch_caller_profile
*
caller_profile
;
struct
sangoma_pri
*
spri
;
int
span
=
0
,
autospan
=
0
,
autochan
=
0
;
...
...
@@ -496,6 +499,9 @@ static switch_status wanpipe_outgoing_channel(switch_core_session *session, swit
return
SWITCH_STATUS_GENERR
;
}
switch_set_flag
(
tech_pvt
,
TFLAG_NOSIG
);
snprintf
(
name
,
sizeof
(
name
),
"WanPipe/%s/nosig-%04x"
,
bchan
,
rand
()
&
0xffff
);
switch_channel_set_name
(
channel
,
name
);
}
else
{
switch_console_printf
(
SWITCH_CHANNEL_CONSOLE
,
"Invalid address
\n
"
);
switch_core_session_destroy
(
new_session
);
...
...
@@ -628,7 +634,8 @@ static switch_status wanpipe_read_frame(switch_core_session *session, switch_fra
tech_pvt
=
switch_core_session_get_private
(
session
);
assert
(
tech_pvt
!=
NULL
);
if
(
tech_pvt
->
socket
<=
0
)
{
if
(
switch_test_flag
(
tech_pvt
,
TFLAG_BYE
)
||
tech_pvt
->
socket
<
0
)
{
return
SWITCH_STATUS_GENERR
;
}
...
...
@@ -637,6 +644,9 @@ static switch_status wanpipe_read_frame(switch_core_session *session, switch_fra
*
frame
=
NULL
;
memset
(
tech_pvt
->
databuf
,
0
,
sizeof
(
tech_pvt
->
databuf
));
while
(
bytes
<
globals
.
mtu
)
{
if
(
switch_test_flag
(
tech_pvt
,
TFLAG_BYE
)
||
tech_pvt
->
socket
<
0
)
{
return
SWITCH_STATUS_GENERR
;
}
if
((
res
=
sangoma_socket_waitfor
(
tech_pvt
->
socket
,
timeout
,
POLLIN
|
POLLERR
))
<
0
)
{
return
SWITCH_STATUS_GENERR
;
}
else
if
(
res
==
0
)
{
...
...
@@ -657,6 +667,11 @@ static switch_status wanpipe_read_frame(switch_core_session *session, switch_fra
bytes
+=
res
;
bp
+=
bytes
;
}
if
(
switch_test_flag
(
tech_pvt
,
TFLAG_BYE
)
||
tech_pvt
->
socket
<
0
)
{
return
SWITCH_STATUS_GENERR
;
}
tech_pvt
->
read_frame
.
datalen
=
bytes
;
tech_pvt
->
read_frame
.
samples
=
bytes
/
2
;
...
...
@@ -706,11 +721,17 @@ static switch_status wanpipe_write_frame(switch_core_session *session, switch_fr
while
(
tech_pvt
->
dtmf_buffer
&&
bwrote
<
frame
->
datalen
&&
bytes
>
0
&&
(
inuse
=
switch_buffer_inuse
(
tech_pvt
->
dtmf_buffer
))
>
0
)
{
if
(
switch_test_flag
(
tech_pvt
,
TFLAG_BYE
)
||
tech_pvt
->
socket
<
0
)
{
return
SWITCH_STATUS_GENERR
;
}
if
((
bread
=
switch_buffer_read
(
tech_pvt
->
dtmf_buffer
,
dtmf
,
globals
.
mtu
))
<
globals
.
mtu
)
{
while
(
bread
<
globals
.
mtu
)
{
dtmf
[
bread
++
]
=
0
;
}
}
sangoma_socket_waitfor
(
tech_pvt
->
socket
,
-
1
,
POLLOUT
|
POLLERR
|
POLLHUP
);
...
...
@@ -737,6 +758,10 @@ static switch_status wanpipe_write_frame(switch_core_session *session, switch_fr
}
}
if
(
switch_test_flag
(
tech_pvt
,
TFLAG_BYE
)
||
tech_pvt
->
socket
<
0
)
{
return
SWITCH_STATUS_GENERR
;
}
if
(
tech_pvt
->
skip_write_frames
)
{
tech_pvt
->
skip_write_frames
--
;
return
SWITCH_STATUS_SUCCESS
;
...
...
@@ -744,6 +769,11 @@ static switch_status wanpipe_write_frame(switch_core_session *session, switch_fr
while
(
bytes
>
0
)
{
unsigned
int
towrite
;
if
(
switch_test_flag
(
tech_pvt
,
TFLAG_BYE
)
||
tech_pvt
->
socket
<
0
)
{
return
SWITCH_STATUS_GENERR
;
}
sangoma_socket_waitfor
(
tech_pvt
->
socket
,
-
1
,
POLLOUT
|
POLLERR
|
POLLHUP
);
#ifdef DOTRACE
write
(
tech_pvt
->
fd
,
bp
,
(
int
)
globals
.
mtu
);
...
...
@@ -823,10 +853,9 @@ static switch_status wanpipe_kill_channel(switch_core_session *session, int sig)
tech_pvt
=
switch_core_session_get_private
(
session
);
assert
(
tech_pvt
!=
NULL
);
switch_set_flag
(
tech_pvt
,
TFLAG_BYE
);
switch_clear_flag
(
tech_pvt
,
TFLAG_MEDIA
);
return
SWITCH_STATUS_SUCCESS
;
}
...
...
src/switch_console.c
浏览文件 @
d22db18b
...
...
@@ -31,11 +31,12 @@
*/
#include <switch_console.h>
#include <switch.h>
#define CMD_BUFLEN SWITCH_RECCOMMENDED_BUFFER_SIZE * 10
static
int
switch_console_process
(
char
*
cmd
)
{
char
*
arg
=
NULL
;
char
*
retbuf
=
(
char
*
)
malloc
(
SWITCH_RECCOMMENDED_BUFFER_SIZE
*
10
);
char
*
retbuf
=
(
char
*
)
malloc
(
CMD_BUFLEN
);
#ifdef EMBED_PERL
const
char
*
perlhelp
=
"perl - execute some perl. (print to STDERR if you want to see it.)
\n
"
;
...
...
@@ -73,7 +74,7 @@ static int switch_console_process(char *cmd)
if
((
arg
=
strchr
(
cmd
,
' '
))
!=
0
)
{
*
arg
++
=
'\0'
;
}
if
(
switch_api_execute
(
cmd
,
arg
,
retbuf
,
sizeof
(
retbuf
)
)
==
SWITCH_STATUS_SUCCESS
)
{
if
(
switch_api_execute
(
cmd
,
arg
,
retbuf
,
CMD_BUFLEN
)
==
SWITCH_STATUS_SUCCESS
)
{
switch_console_printf
(
SWITCH_CHANNEL_CONSOLE_CLEAN
,
"API CALL [%s(%s)] output:
\n
%s
\n
"
,
cmd
,
arg
?
arg
:
""
,
retbuf
);
}
else
{
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论