sms: Always go through the database and the smsqueue to send messages
This is also fixing a memory and subscriber leak. Make sure to always release the gsm_sms structure.
This commit is contained in:
parent
994dcbb201
commit
445e615d03
|
@ -171,16 +171,15 @@ static int _send_sms_str(struct gsm_subscriber *receiver, char *str,
|
||||||
sms = sms_from_text(receiver, str);
|
sms = sms_from_text(receiver, str);
|
||||||
sms->protocol_id = tp_pid;
|
sms->protocol_id = tp_pid;
|
||||||
|
|
||||||
if(!receiver->lac){
|
/* store in database for the queue */
|
||||||
/* subscriber currently not attached, store in database */
|
if (db_sms_store(sms) != 0) {
|
||||||
if (db_sms_store(sms) != 0) {
|
LOGP(DSMS, LOGL_ERROR, "Failed to store SMS in Database\n");
|
||||||
LOGP(DSMS, LOGL_ERROR, "Failed to store SMS in Database\n");
|
sms_free(sms);
|
||||||
return CMD_WARNING;
|
return CMD_WARNING;
|
||||||
}
|
|
||||||
} else {
|
|
||||||
gsm411_send_sms_subscr(receiver, sms);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sms_free(sms);
|
||||||
|
sms_queue_trigger(receiver->net->sms_queue);
|
||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue