75 #include "../smsc_http_p.h" 115 url = new_msg = NULL;
120 "app_id=%E&key=%E&dest_addr=%E&source_addr=%E",
131 esm_class = 0x03 | 0x40;
138 dcs, esm_class, new_msg);
157 debug(
"smsc.http.xidris", 0,
"HTTP[%s]: Sending request <%s>",
198 error(0,
"HTTP[%s]: Message not accepted. Status code <%s> " 205 error(0,
"HTTP[%s]: Message was rejected. SMSC response was:",
219 Octstr *state, *mid, *dest;
221 int mclass, mwi,
coding, validity, deferred;
225 mclass = mwi =
coding = validity = deferred = 0;
244 debug(
"smsc.http.xidris", 0,
"HTTP[%s]: Received a request",
247 if (user == NULL || pass == NULL ||
250 error(0,
"HTTP[%s]: Authorization failure. username was <%s>.",
252 retmsg =
octstr_create(
"Authorization failed for MO submission.");
255 else if (state != NULL && mid != NULL && dest != NULL) {
271 if (dlrmsg != NULL) {
278 error(0,
"HTTP[%s]: got DLR but could not find message or was not interested " 279 "in it id<%s> dst<%s>, type<%d>",
286 else if (
from == NULL || to == NULL ||
text == NULL) {
287 error(0,
"HTTP[%s]: Insufficient args.",
296 debug(
"smsc.http.xidris", 0,
"HTTP[%s]: Received new MO SMS.",
306 msg->sms.time = time(NULL);
307 msg->sms.mclass = mclass;
310 msg->sms.validity = time(NULL) + validity * 60;
311 msg->sms.deferred = time(NULL) + deferred * 60;
318 debug(
"smsc.http.xidris", 0,
"HTTP[%s]: Sending reply with HTTP status <%d>.",
332 error(0,
"HTTP[%s]: 'username' and 'password' required for Xidris http smsc",
void error(int err, const char *fmt,...)
struct smsc_http_fn_callbacks smsc_http_xidris_callback
void octstr_append(Octstr *ostr1, const Octstr *ostr2)
static void client(int port)
int octstr_url_decode(Octstr *ostr)
long octstr_search(const Octstr *haystack, const Octstr *needle, long pos)
void octstr_strip_blanks(Octstr *text)
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 octstr_copy(ostr, from, len)
static void xidris_receive_sms(SMSCConn *conn, HTTPClient *client, List *headers, Octstr *body, List *cgivars)
Octstr * http_cgi_variable(List *list, char *name)
void http_destroy_headers(List *headers)
void http_start_request(HTTPCaller *caller, int method, Octstr *url, List *headers, Octstr *body, int follow, void *id, Octstr *certkeyfile)
void http_send_reply(HTTPClient *client, int status, List *headers, Octstr *body)
Octstr * octstr_imm(const char *cstr)
long bb_smscconn_receive(SMSCConn *conn, Msg *sms)
#define octstr_duplicate(ostr)
#define octstr_dump(ostr, level,...)
int octstr_case_compare(const Octstr *os1, const Octstr *os2)
Octstr * octstr_format(const char *fmt,...)
void octstr_destroy(Octstr *ostr)
#define octstr_create(cstr)
int fields_to_dcs(Msg *msg, int mode)
static int xidris_send_sms(SMSCConn *conn, Msg *sms)
void octstr_strip_crlfs(Octstr *text)
long octstr_len(const Octstr *ostr)
int(* init)(SMSCConn *conn, CfgGroup *cfg)
void bb_smscconn_sent(SMSCConn *conn, Msg *sms, Octstr *reply)
void debug(const char *place, int err, const char *fmt,...)
static Octstr * parse_xml_tag(Octstr *body, Octstr *tag)
void octstr_format_append(Octstr *os, const char *fmt,...)
static void xidris_parse_reply(SMSCConn *conn, Msg *msg, int status, List *headers, Octstr *body)
void bb_smscconn_send_failed(SMSCConn *conn, Msg *sms, int reason, Octstr *reply)
#define DLR_IS_ENABLED_DEVICE(dlr)
static int xidris_init(SMSCConn *conn, CfgGroup *cfg)
static XMLRPCDocument * msg
int octstr_compare(const Octstr *ostr1, const Octstr *ostr2)