void dlr_flush(void) { info(0, "Flushing all %ld queued DLR messages in %s storage", dlr_messages(), dlr_type()); if (handles != NULL && handles->dlr_flush != NULL) handles->dlr_flush(); }
Octstr *bb_print_status(int status_type) { char *s, *lb; char *frmt, *footer; Octstr *ret, *str, *version; time_t t; if ((lb = bb_status_linebreak(status_type)) == NULL) return octstr_create("Un-supported format"); t = time(NULL) - start_time; if (bb_status == BB_RUNNING) s = "running"; else if (bb_status == BB_ISOLATED) s = "isolated"; else if (bb_status == BB_SUSPENDED) s = "suspended"; else if (bb_status == BB_FULL) s = "filled"; else s = "going down"; version = version_report_string("bearerbox"); if (status_type == BBSTATUS_HTML) { frmt = "%s</p>\n\n" " <p>Status: %s, uptime %ldd %ldh %ldm %lds</p>\n\n" " <p>WDP: received %ld (%ld queued), sent %ld " "(%ld queued)</p>\n\n" " <p>SMS: received %ld (%ld queued), sent %ld " "(%ld queued), store size %ld<br>\n" " SMS: inbound (%.2f,%.2f,%.2f) msg/sec, " "outbound (%.2f,%.2f,%.2f) msg/sec</p>\n\n" " <p>DLR: received %ld, sent %ld<br>\n" " DLR: inbound (%.2f,%.2f,%.2f) msg/sec, outbound (%.2f,%.2f,%.2f) msg/sec<br>\n" " DLR: %ld queued, using %s storage</p>\n\n"; footer = "<p>"; } else if (status_type == BBSTATUS_WML) { frmt = "%s</p>\n\n" " <p>Status: %s, uptime %ldd %ldh %ldm %lds</p>\n\n" " <p>WDP: received %ld (%ld queued)<br/>\n" " WDP: sent %ld (%ld queued)</p>\n\n" " <p>SMS: received %ld (%ld queued)<br/>\n" " SMS: sent %ld (%ld queued)<br/>\n" " SMS: store size %ld<br/>\n" " SMS: inbound (%.2f,%.2f,%.2f) msg/sec<br/>\n" " SMS: outbound (%.2f,%.2f,%.2f) msg/sec</p>\n" " <p>DLR: received %ld<br/>\n" " DLR: sent %ld<br/>\n" " DLR: inbound (%.2f,%.2f,%.2f) msg/sec<br/>\n" " DLR: outbound (%.2f,%.2f,%.2f) msg/sec<br/>\n" " DLR: %ld queued<br/>\n" " DLR: using %s storage</p>\n\n"; footer = "<p>"; } else if (status_type == BBSTATUS_XML) { frmt = "<version>%s</version>\n" "<status>%s, uptime %ldd %ldh %ldm %lds</status>\n" "\t<wdp>\n\t\t<received><total>%ld</total><queued>%ld</queued>" "</received>\n\t\t<sent><total>%ld</total><queued>%ld</queued>" "</sent>\n\t</wdp>\n" "\t<sms>\n\t\t<received><total>%ld</total><queued>%ld</queued>" "</received>\n\t\t<sent><total>%ld</total><queued>%ld</queued>" "</sent>\n\t\t<storesize>%ld</storesize>\n\t\t" "<inbound>%.2f,%.2f,%.2f</inbound>\n\t\t" "<outbound>%.2f,%.2f,%.2f</outbound>\n\t\t" "</sms>\n" "\t<dlr>\n\t\t<received><total>%ld</total></received>\n\t\t" "<sent><total>%ld</total></sent>\n\t\t" "<inbound>%.2f,%.2f,%.2f</inbound>\n\t\t" "<outbound>%.2f,%.2f,%.2f</outbound>\n\t\t" "<queued>%ld</queued>\n\t\t<storage>%s</storage>\n\t</dlr>\n"; footer = ""; } else { frmt = "%s\n\nStatus: %s, uptime %ldd %ldh %ldm %lds\n\n" "WDP: received %ld (%ld queued), sent %ld (%ld queued)\n\n" "SMS: received %ld (%ld queued), sent %ld (%ld queued), store size %ld\n" "SMS: inbound (%.2f,%.2f,%.2f) msg/sec, " "outbound (%.2f,%.2f,%.2f) msg/sec\n\n" "DLR: received %ld, sent %ld\n" "DLR: inbound (%.2f,%.2f,%.2f) msg/sec, outbound (%.2f,%.2f,%.2f) msg/sec\n" "DLR: %ld queued, using %s storage\n\n"; footer = ""; } ret = octstr_format(frmt, octstr_get_cstr(version), s, t/3600/24, t/3600%24, t/60%60, t%60, counter_value(incoming_wdp_counter), gwlist_len(incoming_wdp) + boxc_incoming_wdp_queue(), counter_value(outgoing_wdp_counter), gwlist_len(outgoing_wdp) + udp_outgoing_queue(), counter_value(incoming_sms_counter), gwlist_len(incoming_sms), counter_value(outgoing_sms_counter), gwlist_len(outgoing_sms), store_messages(), load_get(incoming_sms_load,0), load_get(incoming_sms_load,1), load_get(incoming_sms_load,2), load_get(outgoing_sms_load,0), load_get(outgoing_sms_load,1), load_get(outgoing_sms_load,2), counter_value(incoming_dlr_counter), counter_value(outgoing_dlr_counter), load_get(incoming_dlr_load,0), load_get(incoming_dlr_load,1), load_get(incoming_dlr_load,2), load_get(outgoing_dlr_load,0), load_get(outgoing_dlr_load,1), load_get(outgoing_dlr_load,2), dlr_messages(), dlr_type()); octstr_destroy(version); append_status(ret, str, boxc_status, status_type); append_status(ret, str, smsc2_status, status_type); octstr_append_cstr(ret, footer); return ret; }