107 dlr = gw_malloc(
sizeof(*dlr));
111 memset(dlr, 0,
sizeof(*dlr));
148 #define O_DELETE(a) { if (a) octstr_destroy(a); a = NULL; } 173 ret = gw_malloc(
sizeof(*ret));
175 memset(ret, 0,
sizeof(*ret));
178 panic(0,
"DLR: DB: directive 'table' is not specified!");
183 panic(0,
"DLR: DB: directive 'field-smsc' is not specified!");
185 panic(0,
"DLR: DB: directive 'field-timestamp' is not specified!");
187 panic(0,
"DLR: DB: directive 'field-source' is not specified!");
189 panic(0,
"DLR: DB: directive 'field-destination' is not specified!");
191 panic(0,
"DLR: DB: directive 'field-service' is not specified!");
193 panic(0,
"DLR: DB: directive 'field-url' is not specified!");
195 panic(0,
"DLR: DB: directive 'field-mask' is not specified!");
197 panic(0,
"DLR: DB: directive 'field-status' is not specified!");
199 panic(0,
"DLR: DB: directive 'field-boxc-id' is not specified!");
210 #define O_DELETE(a) { if (a) octstr_destroy(a); a = NULL; } 241 panic(0,
"DLR: can't find group core");
251 warning(0,
"DLR: using default 'internal' for storage type.");
336 if (
msg->sms.foreign_id != NULL)
339 if (
msg->sms.split_parts != NULL) {
341 if (
split->orig->sms.foreign_id != NULL)
374 debug(
"dlr.dlr", 0,
"DLR[%s]: Adding DLR smsc=%s, ts=%s, src=%s, dst=%s, mask=%d, boxc=%s",
410 debug(
"dlr.dlr", 0,
"DLR[%s]: Looking for DLR smsc=%s, ts=%s, dst=%s, type=%d",
415 warning(0,
"DLR[%s]: DLR from SMSC<%s> for DST<%s> not found.",
420 #define O_SET(x, val) if (octstr_len(val) > 0) { x = val; val = NULL; } 422 if ((typ & dlr->
mask) > 0) {
426 msg->sms.dlr_mask = typ;
439 msg->sms.msgdata = NULL;
457 time(&
msg->sms.time);
458 debug(
"dlr.dlr", 0,
"DLR[%s]: created DLR message for URL <%s>",
461 debug(
"dlr.dlr", 0,
"DLR[%s]: Ignoring DLR message because of mask type=%d dlr->mask=%d",
dlr_type(), typ, dlr->
mask);
470 debug(
"dlr.dlr", 0,
"DLR[%s]: DLR not destroyed, still waiting for other delivery report",
dlr_type());
480 warning(0,
"DLR[%s]: Storage don't have remove operation defined",
dlr_type());
493 info(0,
"Flushing all %ld queued DLR messages in %s storage",
dlr_messages(),
509 debug(
"dlr.dlr", 0,
"SMSC[%s]: creating DLR message",
516 dlrmsg->sms.dlr_mask = stat;
525 time(&dlrmsg->sms.time);
531 if (dlrmsg->sms.meta_data == NULL)
538 debug(
"dlr.dlr", 0,
"SMSC[%s]: DLR = %s",
void info(int err, const char *fmt,...)
struct dlr_storage * dlr_init_sdb(Cfg *cfg)
void(* dlr_update)(const Octstr *smsc, const Octstr *ts, const Octstr *dst, int status)
gw_assert(wtls_machine->packet_to_send !=NULL)
struct dlr_entry * dlr_entry_duplicate(const struct dlr_entry *dlr)
void dlr_db_fields_destroy(struct dlr_db_fields *fields)
struct dlr_entry * dlr_entry_create(void)
long(* dlr_messages)(void)
Msg * create_dlr_from_msg(const Octstr *smsc, const Msg *msg, const Octstr *reply, long stat)
#define cfg_get(grp, varname)
struct dlr_storage * dlr_init_mem(Cfg *cfg)
void(* dlr_add)(struct dlr_entry *entry)
Msg * dlr_find(const Octstr *smsc, const Octstr *ts, const Octstr *dst, int typ, int use_dst)
void dlr_add(const Octstr *smsc, const Octstr *ts, Msg *msg, int use_dst)
#define octstr_get_cstr(ostr)
#define DLR_IS_NOT_FINAL(dlr)
struct dlr_storage * dlr_init_oracle(Cfg *cfg)
struct dlr_storage * dlr_init_pgsql(Cfg *cfg)
static struct dlr_storage * handles
Octstr * octstr_imm(const char *cstr)
void octstr_delete(Octstr *ostr1, long pos, long len)
struct dlr_entry *(* dlr_get)(const Octstr *smsc, const Octstr *ts, const Octstr *dst)
const char * dlr_type(void)
#define octstr_duplicate(ostr)
struct dlr_storage * dlr_init_sqlite3(Cfg *cfg)
void warning(int err, const char *fmt,...)
Octstr * octstr_format(const char *fmt,...)
void octstr_destroy(Octstr *ostr)
struct dlr_storage * dlr_init_spool(Cfg *cfg)
#define octstr_create(cstr)
struct dlr_storage * dlr_init_redis(Cfg *cfg)
struct dlr_storage * dlr_init_mysql(Cfg *cfg)
long octstr_len(const Octstr *ostr)
struct dlr_storage * dlr_init_mssql(Cfg *cfg)
struct dlr_storage * dlr_init_cass(Cfg *cfg)
void dlr_entry_destroy(struct dlr_entry *dlr)
void debug(const char *place, int err, const char *fmt,...)
int cfg_get_integer(long *n, CfgGroup *grp, Octstr *varname)
CfgGroup * cfg_get_single_group(Cfg *cfg, Octstr *name)
struct dlr_db_fields * dlr_db_fields_create(CfgGroup *grp)
#define DLR_IS_ENABLED(dlr)
void(* dlr_remove)(const Octstr *smsc, const Octstr *ts, const Octstr *dst)
#define DLR_IS_SUCCESS_OR_FAIL(dlr)
static XMLRPCDocument * msg
void(* dlr_shutdown)(void)
static void reply(HTTPClient *c, List *push_headers)
int octstr_compare(const Octstr *ostr1, const Octstr *ostr2)