mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-04-01 11:02:53 +00:00
FS-4821 fixed core dump when received sms in UCS2 after having sent sms in UCS2
This commit is contained in:
parent
02c329da33
commit
fa1d773a84
@ -1736,7 +1736,13 @@ int gsmopen_serial_read_AT(private_t *tech_pvt, int look_for_ack, int timeout_us
|
|||||||
//Timestamp servicecentretimestamp;
|
//Timestamp servicecentretimestamp;
|
||||||
//Address sender_recipient_address;
|
//Address sender_recipient_address;
|
||||||
|
|
||||||
sms = SMSMessage::decode(tech_pvt->line_array.result[i]); // dataCodingScheme = 8 , text=ciao 123 belè новости לק ראת ﺎﻠﺠﻤﻋﺓ 人大
|
try {
|
||||||
|
sms = SMSMessage::decode(tech_pvt->line_array.result[i]); // dataCodingScheme = 8 , text=ciao 123 belè новости לק ראת ﺎﻠﺠﻤﻋﺓ 人大
|
||||||
|
}
|
||||||
|
catch(...) {
|
||||||
|
ERRORA("GsmException\n", GSMOPEN_P_LOG);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
DEBUGA_GSMOPEN("SMS=\n%s\n", GSMOPEN_P_LOG, sms->toString().c_str());
|
DEBUGA_GSMOPEN("SMS=\n%s\n", GSMOPEN_P_LOG, sms->toString().c_str());
|
||||||
|
|
||||||
@ -1775,8 +1781,9 @@ int gsmopen_serial_read_AT(private_t *tech_pvt, int look_for_ack, int timeout_us
|
|||||||
//sender_recipient_address = sms->address();
|
//sender_recipient_address = sms->address();
|
||||||
|
|
||||||
}
|
}
|
||||||
catch(GsmException & ge) {
|
catch(...) {
|
||||||
ERRORA("GsmException= |||%s|||\n", GSMOPEN_P_LOG, ge.what());
|
ERRORA("GsmException\n", GSMOPEN_P_LOG);
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2487,7 +2494,7 @@ int utf8_to_iso_8859_1(private_t *tech_pvt, char *utf8_in, size_t inbytesleft, c
|
|||||||
iconv_res = iconv(iconv_format, &inbuf, &inbytesleft, &outbuf, &outbytesleft);
|
iconv_res = iconv(iconv_format, &inbuf, &inbytesleft, &outbuf, &outbytesleft);
|
||||||
#endif // WIN32
|
#endif // WIN32
|
||||||
if (iconv_res == (size_t) -1) {
|
if (iconv_res == (size_t) -1) {
|
||||||
DEBUGA_GSMOPEN("cannot translate in iso_8859_1 error: %s %d\n", GSMOPEN_P_LOG, strerror(errno), errno);
|
DEBUGA_GSMOPEN("cannot translate in iso_8859_1 error: %s (errno: %d)\n", GSMOPEN_P_LOG, strerror(errno), errno);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
DEBUGA_GSMOPEN
|
DEBUGA_GSMOPEN
|
||||||
@ -2854,10 +2861,16 @@ int gsmopen_sendsms(private_t *tech_pvt, char *dest, char *text)
|
|||||||
|
|
||||||
tech_pvt->no_ucs2 = 0;
|
tech_pvt->no_ucs2 = 0;
|
||||||
tech_pvt->sms_pdu_not_supported = 1;
|
tech_pvt->sms_pdu_not_supported = 1;
|
||||||
|
|
||||||
ok = gsmopen_sendsms(tech_pvt, dest, text);
|
ok = gsmopen_sendsms(tech_pvt, dest, text);
|
||||||
|
|
||||||
tech_pvt->no_ucs2 = 1;
|
tech_pvt->no_ucs2 = 1;
|
||||||
tech_pvt->sms_pdu_not_supported = 0;
|
tech_pvt->sms_pdu_not_supported = 0;
|
||||||
|
|
||||||
|
err = gsmopen_serial_write_AT_ack(tech_pvt, "AT+CMGF=0");
|
||||||
|
if (err) {
|
||||||
|
ERRORA("AT+CMGF=0 (set message sending to PDU (as opposed to TEXT) didn't get OK from the phone\n", GSMOPEN_P_LOG);
|
||||||
|
}
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3054,7 +3054,7 @@ int sms_incoming(private_t *tech_pvt)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
//DEBUGA_GSMOPEN("received SMS on interface %s: %s\n", GSMOPEN_P_LOG, tech_pvt->name, tech_pvt->sms_message);
|
//DEBUGA_GSMOPEN("received SMS on interface %s: %s\n", GSMOPEN_P_LOG, tech_pvt->name, tech_pvt->sms_message);
|
||||||
DEBUGA_GSMOPEN("received SMS on interface %s: DATE=%s, SENDER=%s, BODY=%s|\n", GSMOPEN_P_LOG, tech_pvt->name, tech_pvt->sms_date, tech_pvt->sms_sender,
|
NOTICA("received SMS on interface %s: DATE=%s, SENDER=%s, BODY=|%s|\n", GSMOPEN_P_LOG, tech_pvt->name, tech_pvt->sms_date, tech_pvt->sms_sender,
|
||||||
tech_pvt->sms_body);
|
tech_pvt->sms_body);
|
||||||
#ifdef NOTDEF
|
#ifdef NOTDEF
|
||||||
if (!zstr(tech_pvt->session_uuid_str)) {
|
if (!zstr(tech_pvt->session_uuid_str)) {
|
||||||
@ -3158,6 +3158,12 @@ int sms_incoming(private_t *tech_pvt)
|
|||||||
}
|
}
|
||||||
/* mod_sms end */
|
/* mod_sms end */
|
||||||
|
|
||||||
|
memset(tech_pvt->sms_message, '\0', sizeof(tech_pvt->sms_message));
|
||||||
|
memset(tech_pvt->sms_sender, '\0', sizeof(tech_pvt->sms_sender));
|
||||||
|
memset(tech_pvt->sms_date, '\0', sizeof(tech_pvt->sms_date));
|
||||||
|
memset(tech_pvt->sms_body, '\0', sizeof(tech_pvt->sms_body));
|
||||||
|
memset(tech_pvt->sms_datacodingscheme, '\0', sizeof(tech_pvt->sms_datacodingscheme));
|
||||||
|
memset(tech_pvt->sms_servicecentreaddress, '\0', sizeof(tech_pvt->sms_servicecentreaddress));
|
||||||
|
|
||||||
//memset(&tech_pvt->chatmessages[which], '\0', sizeof(&tech_pvt->chatmessages[which]) );
|
//memset(&tech_pvt->chatmessages[which], '\0', sizeof(&tech_pvt->chatmessages[which]) );
|
||||||
//memset(tech_pvt->sms_message, '\0', sizeof(tech_pvt->sms_message));
|
//memset(tech_pvt->sms_message, '\0', sizeof(tech_pvt->sms_message));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user