Skip to content
项目
群组
代码片段
帮助
正在加载...
登录
切换导航
F
freeswitch
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分枝图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
分枝图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
张华
freeswitch
Commits
1f664b68
提交
1f664b68
authored
4月 17, 2012
作者:
Giovanni Maruzzelli
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
gsmopen: added gsmlib support to incoming smss (eg: PDU mode)
上级
3df7a04d
隐藏空白字符变更
内嵌
并排
正在显示
1 个修改的文件
包含
90 行增加
和
0 行删除
+90
-0
gsmopen_protocol.cpp
src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp
+90
-0
没有找到文件。
src/mod/endpoints/mod_gsmopen/gsmopen_protocol.cpp
浏览文件 @
1f664b68
#include "gsmopen.h"
#include "gsmopen.h"
#define WANT_GSMLIB
#ifdef WANT_GSMLIB
#include <gsmlib/gsm_sms.h>
//#ifdef WIN32
//#include <gsmlib/gsm_win32_serial.h>
//#else
//#include <gsmlib/gsm_unix_serial.h>
//#endif
//#include <gsmlib/gsm_me_ta.h>
//#include <iostream>
using
namespace
std
;
using
namespace
gsmlib
;
#endif// WANT_GSMLIB
extern
int
running
;
//FIXME
extern
int
running
;
//FIXME
int
gsmopen_dir_entry_extension
=
1
;
//FIXME
int
gsmopen_dir_entry_extension
=
1
;
//FIXME
int
option_debug
=
100
;
//FIXME
int
option_debug
=
100
;
//FIXME
...
@@ -347,6 +365,7 @@ int gsmopen_serial_config_AT(private_t *tech_pvt)
...
@@ -347,6 +365,7 @@ int gsmopen_serial_config_AT(private_t *tech_pvt)
if
(
res
)
{
if
(
res
)
{
DEBUGA_GSMOPEN
(
"AT+CMGF? failed, continue
\n
"
,
GSMOPEN_P_LOG
);
DEBUGA_GSMOPEN
(
"AT+CMGF? failed, continue
\n
"
,
GSMOPEN_P_LOG
);
}
}
#ifndef WANT_GSMLIB
res
=
gsmopen_serial_write_AT_ack
(
tech_pvt
,
"AT+CMGF=1"
);
res
=
gsmopen_serial_write_AT_ack
(
tech_pvt
,
"AT+CMGF=1"
);
if
(
res
)
{
if
(
res
)
{
ERRORA
(
"Error setting SMS sending mode to TEXT on the cellphone, let's hope is TEXT by default. Continuing
\n
"
,
GSMOPEN_P_LOG
);
ERRORA
(
"Error setting SMS sending mode to TEXT on the cellphone, let's hope is TEXT by default. Continuing
\n
"
,
GSMOPEN_P_LOG
);
...
@@ -382,7 +401,26 @@ int gsmopen_serial_config_AT(private_t *tech_pvt)
...
@@ -382,7 +401,26 @@ int gsmopen_serial_config_AT(private_t *tech_pvt)
}
}
}
}
#else// WANT_GSMLIB
res
=
gsmopen_serial_write_AT_ack
(
tech_pvt
,
"AT+CMGF=0"
);
if
(
res
)
{
ERRORA
(
"Error setting SMS sending mode to TEXT on the cellphone, let's hope is TEXT by default. Continuing
\n
"
,
GSMOPEN_P_LOG
);
}
tech_pvt
->
sms_pdu_not_supported
=
0
;
tech_pvt
->
no_ucs2
=
1
;
if
(
tech_pvt
->
no_ucs2
)
{
res
=
gsmopen_serial_write_AT_ack
(
tech_pvt
,
"AT+CSCS=
\"
GSM
\"
"
);
if
(
res
)
{
WARNINGA
(
"AT+CSCS=
\"
GSM
\"
(set TE messages to GSM) do not got OK from the phone
\n
"
,
GSMOPEN_P_LOG
);
}
//res = gsmopen_serial_write_AT_ack(tech_pvt, "AT+CSMP=17,167,0,16"); //"flash", class 0 sms 7 bit
res
=
gsmopen_serial_write_AT_ack
(
tech_pvt
,
"AT+CSMP=17,167,0,0"
);
//normal, 7 bit message
if
(
res
)
{
WARNINGA
(
"AT+CSMP do not got OK from the phone, continuing
\n
"
,
GSMOPEN_P_LOG
);
}
}
#endif// WANT_GSMLIB
#ifdef NOTDEF //GSMLIB? XXX
#ifdef NOTDEF //GSMLIB? XXX
...
@@ -1599,6 +1637,58 @@ read:
...
@@ -1599,6 +1637,58 @@ read:
DEBUGA_GSMOPEN
(
"2 content3=%s
\n
"
,
GSMOPEN_P_LOG
,
content3
);
DEBUGA_GSMOPEN
(
"2 content3=%s
\n
"
,
GSMOPEN_P_LOG
,
content3
);
}
}
}
else
{
}
else
{
#ifdef WANT_GSMLIB
char
content2
[
1000
];
SMSMessageRef
sms
;
//MessageType messagetype;
//Address servicecentreaddress;
//Timestamp servicecentretimestamp;
//Address sender_recipient_address;
sms
=
SMSMessage
::
decode
(
tech_pvt
->
line_array
.
result
[
i
]);
// dataCodingScheme = 8 , text=ciao 123 belè новости לק ראת ﺎﻠﺠﻤﻋﺓ 人大
DEBUGA_GSMOPEN
(
"SMS=
\n
%s
\n
"
,
GSMOPEN_P_LOG
,
sms
->
toString
().
c_str
());
memset
(
content2
,
'\0'
,
sizeof
(
content2
));
if
(
sms
->
dataCodingScheme
().
getAlphabet
()
==
DCS_DEFAULT_ALPHABET
)
{
iso_8859_1_to_utf8
(
tech_pvt
,
(
char
*
)
sms
->
userData
().
c_str
(),
content2
,
sizeof
(
content2
));
}
else
if
(
sms
->
dataCodingScheme
().
getAlphabet
()
==
DCS_SIXTEEN_BIT_ALPHABET
)
{
ucs2_to_utf8
(
tech_pvt
,
(
char
*
)
bufToHex
((
unsigned
char
*
)
sms
->
userData
().
data
(),
sms
->
userData
().
length
()).
c_str
(),
content2
,
sizeof
(
content2
));
}
else
{
ERRORA
(
"dataCodingScheme not supported=%d
\n
"
,
GSMOPEN_P_LOG
,
sms
->
dataCodingScheme
().
getAlphabet
());
}
DEBUGA_GSMOPEN
(
"dataCodingScheme=%d
\n
"
,
GSMOPEN_P_LOG
,
sms
->
dataCodingScheme
().
getAlphabet
());
DEBUGA_GSMOPEN
(
"dataCodingScheme=%s
\n
"
,
GSMOPEN_P_LOG
,
sms
->
dataCodingScheme
().
toString
().
c_str
());
DEBUGA_GSMOPEN
(
"address=%s
\n
"
,
GSMOPEN_P_LOG
,
sms
->
address
().
toString
().
c_str
());
DEBUGA_GSMOPEN
(
"serviceCentreAddress=%s
\n
"
,
GSMOPEN_P_LOG
,
sms
->
serviceCentreAddress
().
toString
().
c_str
());
DEBUGA_GSMOPEN
(
"serviceCentreTimestamp=%s
\n
"
,
GSMOPEN_P_LOG
,
sms
->
serviceCentreTimestamp
().
toString
().
c_str
());
DEBUGA_GSMOPEN
(
"messageType=%d
\n
"
,
GSMOPEN_P_LOG
,
sms
->
messageType
());
DEBUGA_GSMOPEN
(
"userData= |||%s|||
\n
"
,
GSMOPEN_P_LOG
,
content2
);
memset
(
sms_body
,
'\0'
,
sizeof
(
sms_body
));
strncpy
(
sms_body
,
content2
,
sizeof
(
sms_body
));
DEBUGA_GSMOPEN
(
"body=%s
\n
"
,
GSMOPEN_P_LOG
,
sms_body
);
strncpy
(
tech_pvt
->
sms_body
,
sms_body
,
sizeof
(
tech_pvt
->
sms_body
));
strncpy
(
tech_pvt
->
sms_sender
,
sms
->
address
().
toString
().
c_str
(),
sizeof
(
tech_pvt
->
sms_sender
));
strncpy
(
tech_pvt
->
sms_date
,
sms
->
serviceCentreTimestamp
().
toString
().
c_str
(),
sizeof
(
tech_pvt
->
sms_date
));
strncpy
(
tech_pvt
->
sms_datacodingscheme
,
sms
->
dataCodingScheme
().
toString
().
c_str
(),
sizeof
(
tech_pvt
->
sms_datacodingscheme
));
strncpy
(
tech_pvt
->
sms_servicecentreaddress
,
sms
->
serviceCentreAddress
().
toString
().
c_str
(),
sizeof
(
tech_pvt
->
sms_servicecentreaddress
));
tech_pvt
->
sms_messagetype
=
sms
->
messageType
();
//messagetype = sms->messageType();
//servicecentreaddress = sms->serviceCentreAddress();
//servicecentretimestamp = sms->serviceCentreTimestamp();
//sender_recipient_address = sms->address();
#endif// WANT_GSMLIB
}
}
}
//it was the UCS2 from cellphone
}
//it was the UCS2 from cellphone
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论