91 if (wrap->
smsc != NULL)
118 debug(
"bb.sms", 0,
"smsc_wrapper <%s>: reconnect started",
138 else if (ret == -2) {
139 error(0,
"Re-open of %s failed permanently",
148 error(0,
"Re-open to <%s> failed, retrying after %d minutes...",
152 wait = wait > 10 ? 10 : wait * 2 + 1;
175 }
else if (ret == 0) {
176 warning(0,
"SMSC %s: Pending message returned '1', " 197 double sleep = 0.0001;
209 debug(
"bb.sms", 0,
"smscconn (%s): new message received",
240 debug(
"bb.sms", 0,
"smscconn_sender (%s): sending message",
286 debug(
"bb.sms", 0,
"Handling multi-receiver message");
305 debug(
"bb.sms", 0,
"SMSCConn %s sender died, waiting for receiver",
353 debug(
"bb.sms", 0,
"Shutting down SMSCConn %s, %s",
356 if (finish_sending == 0) {
372 debug(
"smscconn", 0,
"Stopping wrapper");
381 debug(
"smscconn", 0,
"Starting wrapper");
452 error(0,
"Failed to create Smsc wrapper");
void error(int err, const char *fmt,...)
void info(int err, const char *fmt,...)
Msg * msg_duplicate(Msg *msg)
void bb_smscconn_connected(SMSCConn *conn)
static int sms_send(SMSCConn *conn, Msg *msg)
void smscconn_shutdown(SMSCConn *conn, int finish_sending)
void bb_smscconn_killed(void)
void gwlist_produce(List *list, void *item)
void gwthread_join(long thread)
long gwlist_len(List *list)
static int reconnect(SMSCConn *conn)
char * smsc_name(SMSCenter *smsc)
void * gwlist_get(List *list, long pos)
void(* stop_conn)(SMSCConn *conn)
static void wrapper_sender(void *arg)
int smsc_wrapper_create(SMSCConn *conn, CfgGroup *cfg)
int smscenter_receive_msg(SMSCenter *smsc, Msg **msg)
#define octstr_get_cstr(ostr)
void(* start_conn)(SMSCConn *conn)
long octstr_search_char(const Octstr *ostr, int ch, long pos)
void log_thread_to(int idx)
static void wrapper_stop(SMSCConn *conn)
static int wrapper_add_msg(SMSCConn *conn, Msg *sms)
smscconn_killed_t why_killed
SMSCenter * smsc_open(CfgGroup *grp)
static void smscwrapper_destroy(SmscWrapper *wrap)
void * gwlist_extract_first(List *list)
int smsc_reopen(SMSCenter *smsc)
void gwlist_remove_producer(List *list)
long bb_smscconn_receive(SMSCConn *conn, Msg *sms)
int smscenter_pending_smsmessage(SMSCenter *smsc)
static void wrapper_start(SMSCConn *conn)
#define octstr_duplicate(ostr)
void msg_destroy(Msg *msg)
void warning(int err, const char *fmt,...)
List * octstr_split_words(const Octstr *ostr)
void octstr_destroy(Octstr *ostr)
#define gwthread_create(func, arg)
#define octstr_create(cstr)
static int wrapper_shutdown(SMSCConn *conn, int finish_sending)
void gwthread_sleep(double seconds)
void mutex_destroy(Mutex *mutex)
volatile sig_atomic_t is_stopped
int smsc_close(SMSCenter *smsc)
static void wrapper_receiver(void *arg)
void bb_smscconn_sent(SMSCConn *conn, Msg *sms, Octstr *reply)
void * gwlist_consume(List *list)
int(* shutdown)(SMSCConn *conn, int finish_sending)
static Msg * sms_receive(SMSCConn *conn)
void debug(const char *place, int err, const char *fmt,...)
void gwthread_wakeup(long thread)
long(* queued)(SMSCConn *conn)
int(* send_msg)(SMSCConn *conn, Msg *msg)
void bb_smscconn_send_failed(SMSCConn *conn, Msg *sms, int reason, Octstr *reply)
void gwlist_add_producer(List *list)
int smscenter_submit_msg(SMSCenter *smsc, Msg *msg)
static XMLRPCDocument * msg
static long wrapper_queued(SMSCConn *conn)
struct smsc_wrapper SmscWrapper
void gwlist_destroy(List *list, gwlist_item_destructor_t *destructor)