67 #include "../smsc_http_p.h" 121 "username=%E&password=%E&to=%E&text=%E",
124 sms->sms.receiver, sms->sms.msgdata);
130 "username=%E&password=%E&to=%E&text=%S",
133 sms->sms.receiver, msgdata);
163 if (sms->sms.coding ==
DC_7BIT)
165 else if (sms->sms.coding ==
DC_UCS2)
170 if (sms->sms.account)
174 if (sms->sms.smsc_id)
194 }
else if (sms->sms.dlr_url != NULL)
205 debug(
"smsc.http.kannel", 0,
"HTTP[%s]: Start request",
255 Octstr *tmp_string, *retmsg;
256 int mclass, mwi,
coding, validity, deferred, dlrmask;
260 mclass = mwi =
coding = validity =
303 debug(
"smsc.http.kannel", 0,
"HTTP[%s]: Received an HTTP request",
306 if (user == NULL || pass == NULL ||
310 error(0,
"HTTP[%s]: Authorization failure",
313 }
else if (dlrmask != 0 && dlrmid != NULL) {
322 if (dlrmsg != NULL) {
327 debug(
"smsc.http.kannel", 0,
"HTTP[%s]: Received DLR for DLR-URL <%s>",
330 if (dlrerr != NULL) {
332 if (dlrmsg->sms.meta_data == NULL)
345 error(0,
"HTTP[%s]: Got DLR but could not find message or was not interested " 346 "in it id<%s> dst<%s>, type<%d>",
352 else if (
from == NULL || to == NULL ||
text == NULL) {
354 error(0,
"HTTP[%s]: Insufficient args",
359 error(0,
"HTTP[%s]: UDH field misformed, rejected",
364 error(0,
"HTTP[%s]: UDH field is too long, rejected",
373 debug(
"smsc.http.kannel", 0,
"HTTP[%s]: Constructing new SMS",
383 msg->sms.time = time(NULL);
384 msg->sms.mclass = mclass;
394 error(0,
"HTTP[%s]: Charset or body misformed, rejected",
396 retmsg =
octstr_create(
"Charset or body misformed, rejected");
410 debug(
"smsc.http.kannel", 0,
"HTTP[%s]: Sending reply",
void error(int err, const char *fmt,...)
void http_header_add(List *headers, char *name, char *contents)
int(* send_sms)(SMSCConn *conn, Msg *msg)
static void client(int port)
static void kannel_parse_reply(SMSCConn *conn, Msg *msg, int status, List *headers, Octstr *body)
void uuid_unparse(const uuid_t uu, char *out)
void octstr_append_cstr(Octstr *ostr, const char *cstr)
static void kannel_receive_sms(SMSCConn *conn, HTTPClient *client, List *headers, Octstr *body, List *cgivars)
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)
void octstr_binary_to_hex(Octstr *ostr, int uppercase)
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)
static int kannel_send_sms(SMSCConn *conn, Msg *sms)
long bb_smscconn_receive(SMSCConn *conn, Msg *sms)
int octstr_ncompare(const Octstr *ostr1, const Octstr *ostr2, long n)
struct smsc_http_fn_callbacks smsc_http_kannel_callback
#define octstr_duplicate(ostr)
int octstr_case_compare(const Octstr *os1, const Octstr *os2)
Octstr * octstr_format(const char *fmt,...)
void octstr_destroy(Octstr *ostr)
int sms_charset_processing(Octstr *charset, Octstr *body, int coding)
#define octstr_create(cstr)
#define SMS_PARAM_UNDEFINED
long octstr_len(const Octstr *ostr)
void bb_smscconn_sent(SMSCConn *conn, Msg *sms, Octstr *reply)
void debug(const char *place, int err, const char *fmt,...)
void octstr_format_append(Octstr *os, const char *fmt,...)
void bb_smscconn_send_failed(SMSCConn *conn, Msg *sms, int reason, Octstr *reply)
int octstr_get_char(const Octstr *ostr, long pos)
#define DLR_IS_ENABLED_DEVICE(dlr)
static XMLRPCDocument * msg
int octstr_compare(const Octstr *ostr1, const Octstr *ostr2)