This commit is contained in:
JerryXiao 2022-11-11 12:52:44 +08:00
parent ac244cdd48
commit 6cf52b0e41
Signed by: Jerry
GPG key ID: 22618F758B5BE2E5
4 changed files with 13 additions and 19 deletions

View file

@ -8,9 +8,9 @@ $(PKG_CONFIG_PATH)/libpjproject.pc:
$(MAKE) -C $(PJSIP_DIR) && \ $(MAKE) -C $(PJSIP_DIR) && \
$(MAKE) -C $(PJSIP_DIR) install $(MAKE) -C $(PJSIP_DIR) install
d-modem: d-modem.c dmodem2.c $(PKG_CONFIG_PATH)/libpjproject.pc d-modem: d-modem.c $(PKG_CONFIG_PATH)/libpjproject.pc
$(CC) -g -o $@ $< `PKG_CONFIG_PATH="$(PKG_CONFIG_PATH)" pkg-config --static --cflags --libs libpjproject` $(CC) -o $@ $< `PKG_CONFIG_PATH="$(PKG_CONFIG_PATH)" pkg-config --static --cflags --libs libpjproject`
$(CC) -g -o dmodem2 dmodem2.c `PKG_CONFIG_PATH="$(PKG_CONFIG_PATH)" pkg-config --static --cflags --libs libpjproject`
slmodemd: slmodemd:
$(MAKE) -C slmodemd $(MAKE) -C slmodemd

View file

@ -1203,7 +1203,7 @@ static int modem_stop (struct modem *m)
} }
#ifdef MODEM_CONFIG_RING_DETECTOR #ifdef MODEM_CONFIG_RING_DETECTOR
if(m->rd_obj) { if(m->rd_obj) {
free(m->rd_obj); RD_delete(m->rd_obj);
m->rd_obj = NULL; m->rd_obj = NULL;
} }
#endif #endif
@ -1316,11 +1316,6 @@ static int modem_cid_start(struct modem *m, unsigned timeout)
#ifdef MODEM_CONFIG_RING_DETECTOR #ifdef MODEM_CONFIG_RING_DETECTOR
static void modem_ring_detector_process(struct modem *m, void *in, void *out, int count) static void modem_ring_detector_process(struct modem *m, void *in, void *out, int count)
{ {
if(count != 0) {
char callid[10];
strncpy(callid, in, 10);
printf("Ringing! callid:%s\n", callid);
}/*
int ret; int ret;
memset(out, 0, count*2); memset(out, 0, count*2);
ret = RD_process(m->rd_obj, in, count); ret = RD_process(m->rd_obj, in, count);
@ -1335,7 +1330,7 @@ static void modem_ring_detector_process(struct modem *m, void *in, void *out, in
} }
else if (freq > 0) { else if (freq > 0) {
MODEM_DBG("report ring end...\n"); MODEM_DBG("report ring end...\n");
/* ring finishing *//* /* ring finishing */
m->event |= MDMEVENT_RING_CHECK; m->event |= MDMEVENT_RING_CHECK;
if (m->ring_count <= 1) if (m->ring_count <= 1)
m->ring_count = duration * freq / 1000 ; m->ring_count = duration * freq / 1000 ;
@ -1344,7 +1339,7 @@ static void modem_ring_detector_process(struct modem *m, void *in, void *out, in
else else
MODEM_ERR("RD returns %ld freq. (duration %ld)\n", MODEM_ERR("RD returns %ld freq. (duration %ld)\n",
freq, duration); freq, duration);
}*/ }
#ifdef MODEM_CONFIG_CID #ifdef MODEM_CONFIG_CID
if(m->cid) if(m->cid)
modem_cid_process(m, in, out, count); modem_cid_process(m, in, out, count);
@ -1358,11 +1353,10 @@ int modem_ring_detector_start(struct modem *m)
MODEM_ERR("modem_ring_detector_start: rd_obj already exists!\n"); MODEM_ERR("modem_ring_detector_start: rd_obj already exists!\n");
return -1; return -1;
} }
m->rd_obj = malloc(sizeof(char)); m->rd_obj = RD_create(m, m->srate);
m->process = modem_ring_detector_process; m->process = modem_ring_detector_process;
modem_set_hook(m, MODEM_HOOK_SNOOPING); modem_set_hook(m, MODEM_HOOK_SNOOPING);
return do_modem_start(m); return do_modem_start(m);
} }
#endif /* MODEM_CONFIG_RING_DETECTOR */ #endif /* MODEM_CONFIG_RING_DETECTOR */

View file

@ -91,7 +91,7 @@ enum MODEM_MODE {
#define MODEM_DEFAULT_COUNTRY_CODE 0xb5 /* USA */ #define MODEM_DEFAULT_COUNTRY_CODE 0xb5 /* USA */
#define MODEM_CONFIG_CID 0 #define MODEM_CONFIG_CID 1
#define MODEM_CONFIG_VOICE 1 #define MODEM_CONFIG_VOICE 1
#define MODEM_CONFIG_FAX 1 #define MODEM_CONFIG_FAX 1
#define MODEM_CONFIG_FAX_CLASS1 1 #define MODEM_CONFIG_FAX_CLASS1 1

View file

@ -600,8 +600,6 @@ static int modemap_ioctl(struct modem *m, unsigned int cmd, unsigned long arg)
if (cmd == MDMCTL_IODELAY && ret > 0) { if (cmd == MDMCTL_IODELAY && ret > 0) {
ret >>= MFMT_SHIFT(m->format); ret >>= MFMT_SHIFT(m->format);
ret += dev->delay; ret += dev->delay;
} }
return ret; return ret;
} }
@ -637,10 +635,12 @@ static int socket_start (struct modem *m)
char str[16]; char str[16];
snprintf(str,sizeof(str),"%d",sockets[0]); snprintf(str,sizeof(str),"%d",sockets[0]);
close(sockets[1]); close(sockets[1]);
if(m->hook == MODEM_HOOK_SNOOPING) if(m->hook == MODEM_HOOK_SNOOPING) {
ret = execl(modem_exec,modem_exec,"rr",str,NULL); ret = execl(modem_exec,modem_exec,"rr",str,NULL);
else }
else {
ret = execl(modem_exec,modem_exec,m->dial_string,str,NULL); ret = execl(modem_exec,modem_exec,m->dial_string,str,NULL);
}
if (ret == -1) { if (ret == -1) {
ERR("prog: %s\n", modem_exec); ERR("prog: %s\n", modem_exec);
perror("execl"); perror("execl");
@ -950,7 +950,7 @@ static int modem_run(struct modem *m, struct device_struct *dev)
} }
if(FD_ISSET(dev->fd, &rset)) { if(FD_ISSET(dev->fd, &rset)) {
count = device_read(dev,inbuf,sizeof(inbuf)/2); count = device_read(dev,inbuf,sizeof(inbuf)/2);
if((count <= 0) && (m->hook != MODEM_HOOK_SNOOPING)) { if(count <= 0) {
if (errno == ECONNRESET) { if (errno == ECONNRESET) {
DBG("lost connection to child socket process\n"); DBG("lost connection to child socket process\n");
} else { } else {