Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
d5f9de4f
提交
d5f9de4f
authored
9月 11, 2014
作者:
Dušan Dragić
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
mod_gsmopen: add AT+COPS support to get operator name.
For now expose the info in gsmopen_dump and events.
上级
fffb4e8f
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
31 行增加
和
0 行删除
+31
-0
gsmopen.h
src/mod/endpoints/mod_gsmopen/gsmopen.h
+2
-0
gsmopen_protocol.cpp
src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp
+26
-0
mod_gsmopen.cpp
src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp
+3
-0
没有找到文件。
src/mod/endpoints/mod_gsmopen/gsmopen.h
浏览文件 @
d5f9de4f
...
@@ -449,6 +449,8 @@ struct private_object {
...
@@ -449,6 +449,8 @@ struct private_object {
int
requesting_imei
;
int
requesting_imei
;
char
imsi
[
128
];
char
imsi
[
128
];
int
requesting_imsi
;
int
requesting_imsi
;
char
operator_name
[
128
];
int
requesting_operator_name
;
int
network_creg_not_supported
;
int
network_creg_not_supported
;
char
creg
[
128
];
char
creg
[
128
];
...
...
src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp
浏览文件 @
d5f9de4f
...
@@ -358,6 +358,15 @@ int gsmopen_serial_config_AT(private_t *tech_pvt)
...
@@ -358,6 +358,15 @@ int gsmopen_serial_config_AT(private_t *tech_pvt)
if
(
res
)
{
if
(
res
)
{
DEBUGA_GSMOPEN
(
"AT+CSQ failed
\n
"
,
GSMOPEN_P_LOG
);
DEBUGA_GSMOPEN
(
"AT+CSQ failed
\n
"
,
GSMOPEN_P_LOG
);
}
}
/* operator name */
tech_pvt
->
requesting_operator_name
=
1
;
res
=
gsmopen_serial_write_AT_ack
(
tech_pvt
,
"AT+COPS?"
);
tech_pvt
->
requesting_operator_name
=
0
;
if
(
res
)
{
DEBUGA_GSMOPEN
(
"AT+COPS? failed
\n
"
,
GSMOPEN_P_LOG
);
}
/* IMEI */
/* IMEI */
tech_pvt
->
requesting_imei
=
1
;
tech_pvt
->
requesting_imei
=
1
;
res
=
gsmopen_serial_write_AT_ack
(
tech_pvt
,
"AT+GSN"
);
res
=
gsmopen_serial_write_AT_ack
(
tech_pvt
,
"AT+GSN"
);
...
@@ -1006,6 +1015,23 @@ int gsmopen_serial_read_AT(private_t *tech_pvt, int look_for_ack, int timeout_us
...
@@ -1006,6 +1015,23 @@ int gsmopen_serial_read_AT(private_t *tech_pvt, int look_for_ack, int timeout_us
}
}
if
((
strncmp
(
tech_pvt
->
line_array
.
result
[
i
],
"+COPS:"
,
6
)
==
0
))
{
int
mode
,
format
,
rat
,
err
;
char
oper
[
128
]
=
""
;
mode
=
format
=
rat
=
err
=
0
;
err
=
sscanf
(
&
tech_pvt
->
line_array
.
result
[
i
][
6
],
"%d,%d,%*[
\"
]%[^
\"
]%*[
\"
],%d"
,
&
mode
,
&
format
,
&
oper
,
&
rat
);
if
(
err
<
3
)
{
DEBUGA_GSMOPEN
(
"|%s| is not formatted as: |+COPS: xx,yy,ssss,nn|
\n
"
,
GSMOPEN_P_LOG
,
tech_pvt
->
line_array
.
result
[
i
]);
}
else
if
(
option_debug
>
1
)
{
DEBUGA_GSMOPEN
(
"|%s| +COPS: : Mode %d, Format %d, Operator %s, Rat %d
\n
"
,
GSMOPEN_P_LOG
,
tech_pvt
->
line_array
.
result
[
i
],
mode
,
format
,
oper
,
rat
);
}
/* if we are requesting the operator name, copy it over */
if
(
tech_pvt
->
requesting_operator_name
)
strncpy
(
tech_pvt
->
operator_name
,
oper
,
sizeof
(
tech_pvt
->
operator_name
));
}
if
((
strncmp
(
tech_pvt
->
line_array
.
result
[
i
],
"+CMGW:"
,
6
)
==
0
))
{
if
((
strncmp
(
tech_pvt
->
line_array
.
result
[
i
],
"+CMGW:"
,
6
)
==
0
))
{
int
err
;
int
err
;
...
...
src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp
浏览文件 @
d5f9de4f
...
@@ -2422,6 +2422,7 @@ SWITCH_STANDARD_API(gsmopen_dump_function)
...
@@ -2422,6 +2422,7 @@ SWITCH_STANDARD_API(gsmopen_dump_function)
stream
->
write_function
(
stream
,
"got_signal = %s
\n
"
,
value
);
stream
->
write_function
(
stream
,
"got_signal = %s
\n
"
,
value
);
snprintf
(
value
,
sizeof
(
value
)
-
1
,
"%d"
,
tech_pvt
->
running
);
snprintf
(
value
,
sizeof
(
value
)
-
1
,
"%d"
,
tech_pvt
->
running
);
stream
->
write_function
(
stream
,
"running = %s
\n
"
,
value
);
stream
->
write_function
(
stream
,
"running = %s
\n
"
,
value
);
stream
->
write_function
(
stream
,
"operator = %s
\n
"
,
tech_pvt
->
operator_name
);
stream
->
write_function
(
stream
,
"imei = %s
\n
"
,
tech_pvt
->
imei
);
stream
->
write_function
(
stream
,
"imei = %s
\n
"
,
tech_pvt
->
imei
);
stream
->
write_function
(
stream
,
"imsi = %s
\n
"
,
tech_pvt
->
imsi
);
stream
->
write_function
(
stream
,
"imsi = %s
\n
"
,
tech_pvt
->
imsi
);
snprintf
(
value
,
sizeof
(
value
)
-
1
,
"%d"
,
tech_pvt
->
controldev_dead
);
snprintf
(
value
,
sizeof
(
value
)
-
1
,
"%d"
,
tech_pvt
->
controldev_dead
);
...
@@ -2480,6 +2481,7 @@ SWITCH_STANDARD_API(gsmopen_dump_function)
...
@@ -2480,6 +2481,7 @@ SWITCH_STANDARD_API(gsmopen_dump_function)
stream
->
write_function
(
stream
,
"got_signal = %s
\n
"
,
value
);
stream
->
write_function
(
stream
,
"got_signal = %s
\n
"
,
value
);
snprintf
(
value
,
sizeof
(
value
)
-
1
,
"%d"
,
tech_pvt
->
running
);
snprintf
(
value
,
sizeof
(
value
)
-
1
,
"%d"
,
tech_pvt
->
running
);
stream
->
write_function
(
stream
,
"running = %s
\n
"
,
value
);
stream
->
write_function
(
stream
,
"running = %s
\n
"
,
value
);
stream
->
write_function
(
stream
,
"operator = %s
\n
"
,
tech_pvt
->
operator_name
);
stream
->
write_function
(
stream
,
"imei = %s
\n
"
,
tech_pvt
->
imei
);
stream
->
write_function
(
stream
,
"imei = %s
\n
"
,
tech_pvt
->
imei
);
stream
->
write_function
(
stream
,
"imsi = %s
\n
"
,
tech_pvt
->
imsi
);
stream
->
write_function
(
stream
,
"imsi = %s
\n
"
,
tech_pvt
->
imsi
);
snprintf
(
value
,
sizeof
(
value
)
-
1
,
"%d"
,
tech_pvt
->
controldev_dead
);
snprintf
(
value
,
sizeof
(
value
)
-
1
,
"%d"
,
tech_pvt
->
controldev_dead
);
...
@@ -2809,6 +2811,7 @@ int dump_event_full(private_t *tech_pvt, int is_alarm, int alarm_code, const cha
...
@@ -2809,6 +2811,7 @@ int dump_event_full(private_t *tech_pvt, int is_alarm, int alarm_code, const cha
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"got_signal"
,
value
);
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"got_signal"
,
value
);
snprintf
(
value
,
sizeof
(
value
)
-
1
,
"%d"
,
tech_pvt
->
running
);
snprintf
(
value
,
sizeof
(
value
)
-
1
,
"%d"
,
tech_pvt
->
running
);
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"running"
,
value
);
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"running"
,
value
);
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"operator"
,
tech_pvt
->
operator_name
);
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"imei"
,
tech_pvt
->
imei
);
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"imei"
,
tech_pvt
->
imei
);
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"imsi"
,
tech_pvt
->
imsi
);
switch_event_add_header_string
(
event
,
SWITCH_STACK_BOTTOM
,
"imsi"
,
tech_pvt
->
imsi
);
snprintf
(
value
,
sizeof
(
value
)
-
1
,
"%d"
,
tech_pvt
->
controldev_dead
);
snprintf
(
value
,
sizeof
(
value
)
-
1
,
"%d"
,
tech_pvt
->
controldev_dead
);
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论