Skip to content

Add initial simcom sim7600 support #162

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion at_command.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ static const char cmd_chld2[] = "AT+CHLD=2\r";
static const char cmd_clcc[] = "AT+CLCC\r";
static const char cmd_ddsetex2[] = "AT^DDSETEX=2\r";
static const char cmd_qpcmv10[] = "AT+QPCMV=1,0\r";
static const char cmd_cpcmreg0[] = "AT+CPCMREG=0\r";

/*!
* \brief Format and fill generic command
Expand Down Expand Up @@ -151,6 +152,7 @@ EXPORT_DEF int at_enqueue_initialization(struct cpvt *cpvt, at_cmd_t from_comman
* rate, data bit, frame period */
ATQ_CMD_DECLARE_STI(CMD_AT_CVOICE, "AT^CVOICE?\r"),
ATQ_CMD_DECLARE_STI(CMD_AT_QPCMV, "AT+QPCMV?\r"), /* for Quectel */
ATQ_CMD_DECLARE_STI(CMD_AT_CPCMREG, "AT+CPCMREG?\r"), /* for Simcom */

/* Get SMS Service center address */
ATQ_CMD_DECLARE_ST(CMD_AT_CSCA, "AT+CSCA?\r"),
Expand Down Expand Up @@ -388,6 +390,7 @@ EXPORT_DEF int at_enqueue_ussd(struct cpvt *cpvt, const char *code)

EXPORT_DEF int at_enqueue_dtmf(struct cpvt *cpvt, char digit)
{
struct pvt *pvt = cpvt->pvt;
switch (digit)
{
/* unsupported, but AT^DTMF=1,22 OK and "2" sent
Expand All @@ -414,7 +417,11 @@ EXPORT_DEF int at_enqueue_dtmf(struct cpvt *cpvt, char digit)

case '*':
case '#':
return at_enqueue_generic(cpvt, CMD_AT_DTMF, 1, "AT^DTMF=%d,%c\r", cpvt->call_idx, digit);
if (pvt->has_voice_simcom) {
return at_enqueue_generic(cpvt, CMD_AT_DTMF, 1, "AT+VTS=%c\r", digit);
} else {
return at_enqueue_generic(cpvt, CMD_AT_DTMF, 1, "AT^DTMF=%d,%c\r", cpvt->call_idx, digit);
}
}
return -1;
}
Expand Down Expand Up @@ -537,6 +544,8 @@ EXPORT_DEF int at_enqueue_dial(struct cpvt *cpvt, const char *number, int clir)

if (pvt->has_voice_quectel) {
ATQ_CMD_INIT_ST(cmds[cmdsno], CMD_AT_DDSETEX, cmd_qpcmv10);
} else if (pvt->has_voice_simcom) {
ATQ_CMD_INIT_ST(cmds[cmdsno], CMD_AT_DDSETEX, cmd_cpcmreg0);
} else {
ATQ_CMD_INIT_ST(cmds[cmdsno], CMD_AT_DDSETEX, cmd_ddsetex2);
}
Expand Down Expand Up @@ -566,6 +575,8 @@ EXPORT_DEF int at_enqueue_answer(struct cpvt *cpvt)
ATQ_CMD_INIT_DYN(cmds[0], CMD_AT_A);
if (pvt->has_voice_quectel) {
ATQ_CMD_INIT_ST(cmds[1], CMD_AT_DDSETEX, cmd_qpcmv10);
} else if (pvt->has_voice_simcom) {
ATQ_CMD_INIT_ST(cmds[1], CMD_AT_DDSETEX, cmd_cpcmreg0);
} else {
ATQ_CMD_INIT_ST(cmds[1], CMD_AT_DDSETEX, cmd_ddsetex2);
}
Expand Down
2 changes: 2 additions & 0 deletions at_command.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@
_( AT_DDSETEX, "AT^DDSETEX") \
/* same, but for Quectel EC25 */ \
_( AT_QPCMV, "AT+QPCMV") \
/* for Simcom SIM7600 */ \
_( AT_CPCMREG, "AT+CPCMREG") \
_( AT_DTMF, "AT^DTMF") \
_( AT_E, "ATE") \
\
Expand Down
14 changes: 13 additions & 1 deletion at_response.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,19 @@ static int at_response_ok (struct pvt* pvt, at_res_t res)
ast_debug (1, "[%s] Dongle has voice support\n", PVT_ID(pvt));
pvt->has_voice = 1;
pvt->has_voice_quectel = 0;
pvt->has_voice_simcom= 0;
break;
case CMD_AT_QPCMV:
ast_debug (1, "[%s] Dongle has Quectel voice support\n", PVT_ID(pvt));
pvt->has_voice = 1;
pvt->has_voice_quectel = 1;
pvt->has_voice_simcom= 0;
break;
case CMD_AT_CPCMREG:
ast_debug (1, "[%s] Dongle has Simcom voice support\n", PVT_ID(pvt));
pvt->has_voice = 1;
pvt->has_voice_quectel = 0;
pvt->has_voice_simcom= 1;
break;
/*
case CMD_AT_CLIP:
Expand Down Expand Up @@ -370,8 +378,12 @@ static int at_response_error (struct pvt* pvt, at_res_t res)
case CMD_AT_QPCMV:
ast_debug(1, "[%s] Dongle has NO (QPCMV) voice support\n", PVT_ID(pvt));
pvt->has_voice_quectel = 0;
break;
case CMD_AT_CPCMREG:
ast_debug(1, "[%s] Dongle has NO (CPCMREG) voice support\n", PVT_ID(pvt));
pvt->has_voice_simcom = 0;

if (pvt->has_voice == 0) {
if (pvt->has_voice == 0 && pvt->has_voice_quectel == 0) {
ast_log(LOG_WARNING, "[%s] Dongle has NO voice support\n", PVT_ID(pvt));
}
break;
Expand Down
1 change: 1 addition & 0 deletions chan_dongle.h
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ typedef struct pvt
unsigned int has_sms:1; /*!< device has SMS support */
unsigned int has_voice:1; /*!< device has voice call support */
unsigned int has_voice_quectel:1; /*!< device has Quectel voice call support */
unsigned int has_voice_simcom:1; /*!< device has Simcom voice call support */
unsigned int has_call_waiting:1; /*!< call waiting enabled on device */

unsigned int group_last_used:1; /*!< mark the last used device */
Expand Down
1 change: 1 addition & 0 deletions pdiscovery.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ static const struct pdiscovery_device device_ids[] = {
{ 0x12d1, 0x1436, { 4, 3, /* 0 */ } }, /* E1750 */
{ 0x12d1, 0x1506, { 3, 2, /* 0 */ } }, /* E171 firmware 21.x : thanks Sergey Ivanov */
{ 0x2c7c, 0x0125, { 1, 4, /* 0 */ } }, /* Dongle EC25-A LTE modem */
{ 0x1e0e, 0x9001, { 2, 4, /* 0 */ } }, /* Simcom Sim7600 */
};

static struct discovery_cache cache;
Expand Down