Hi Martin, So, if I've well understood, sqlbox in this moment neither acks bearerbox nor support delivery report.
I' ve followed your suggestion to add by my own new logic. Attached my patch. I'm using it and it seems to work fine. If you want to have a look and give me some feeds... Francesco Il giorno gio, 22/06/2006 alle 15.39 -0300, Mi Reflejo ha scritto: > Are you receiveing dlr reports? It's a known bug, at least for me. > We are going to change a little bit sqlbox module; when this happens > i'll see how to fix it. Or you can try to add this logic to sqlbox by > your own, of course ;) > > Martin. > > On 6/22/06, Rene Kluwen <[EMAIL PROTECTED]> wrote: > > At this moment I am a little bit short in time. > > But probably you are looking at a bug. > > > > Rene Kluwen > > Chimit > > > > -----Original Message----- > > From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] > > Behalf Of francesco emmi > > Sent: donderdag 22 juni 2006 19:29 > > To: kannel devel > > Subject: sms_dict problem > > > > > > Hi list, > > > > I've start using sqlbox just now with latest cvs kannel version and I've > > found a strange behavior in the store file mechanism. > > > > Usually, without using sqlbox, when you send an sms with dlrmask=31 > > three sms are stored into sms_dict. The First is with sms_type=mt_push, > > the second with sms_type=report_mo (it's ack from operator) and the > > third with sms_type=report_mo (when we get delivery notification from > > operator). > > > > The first sms is removed from sms_dict when receiving ack type 8 and > > bb_smsconn_sent is called. > > > > The other two are removed, as I've seen throw code, when smsbox has > > received their own dlr messages from bearerbox, has generated their own > > acks (I mean msg with type=ack) and has forwarded them to bearerbox. > > Finally is called store_save_ack and messages are removed from sms_dict. > > > > Ok....now the question. When using sqlbox the last two messages remain > > in sms_dict and are never removed. This is because no ack is received by > > bearerbox neither from smsbox nor from sqlbox. > > > > Could be my fault, maybe due a misconfiguration...or is it a bug? > > > > I've inserted sms into sqlbox with this query: > > INSERT INTO send_sms set momt = 'MT', sender = 'mysql', receiver = > > '348999999', msgdata = 'test0', sms_type = 2, dlr_mask = 31; > > > > Hope that in spite of my bad english, I was able to point out the > > question! > > > > Thanks in advance > > Francesco > > > > > > > > -- > > > > > > > > ____________________________________________ > > Francesco Emmi > > A-Tono > > Largo Paisiello 5 - 95124 Catania > > Tel.: (+39) 095 7365312 > > http: www.a-tono.com > > > > Information in this email is confidential and may be privileged. > > It is intended for the addresses only. If you have received it in error, > > please notify the sender immediately and delete it from your system. > > You should not otherwise copy it, retransmit it or use or disclose its > > content to anyone. > > Thank you for your co-operation. > > > > > > > > > > > > -- ____________________________________________ Francesco Emmi A-Tono Largo Paisiello 5 - 95124 Catania Tel.: (+39) 095 7365312 http: www.a-tono.com Information in this email is confidential and may be privileged. It is intended for the addresses only. If you have received it in error, please notify the sender immediately and delete it from your system. You should not otherwise copy it, retransmit it or use or disclose its content to anyone. Thank you for your co-operation.
Index: gw/sqlbox.c =================================================================== --- gw/sqlbox.c (revision 270) +++ gw/sqlbox.c (revision 271) @@ -69,6 +69,7 @@ #include "shared.h" #include "bb.h" #include "sqlbox_sql.h" +#include "urltrans.h" /* our config */ static Cfg *cfg; @@ -86,6 +87,8 @@ static Octstr *box_allow_ip; static Octstr *box_deny_ip; static Octstr *global_sender; +static HTTPCaller *caller; +static int requests; #ifndef HAVE_MYSQL #ifndef HAVE_PGSQL @@ -428,11 +429,40 @@ msg_destroy(msg); } +static void read_http_response(void *arg){ + int status; + Octstr *final_url, *reply_body; + List *reply_headers; + Msg *resp; + + while (sqlbox_status == SQL_RUNNING) { + if(requests){ + requests--; + resp = http_receive_result(caller, &status, &final_url, &reply_headers, + &reply_body); + if(status != 200){ + debug("sqlbox", 0, "status http: %d", status); + msg_dump(resp, 0); + } + msg_destroy(resp); + http_destroy_headers(reply_headers); + octstr_destroy(final_url); + octstr_destroy(reply_body); + } else { + gwthread_sleep(1.0); + } + } +} + + static void bearerbox_to_sql(void *arg) { Boxc *conn = (Boxc *)arg; - Msg *msg; - + Msg *msg, *mack; + List *request_headers; + Octstr *pattern; + + gwthread_create(read_http_response, arg); while (sqlbox_status == SQL_RUNNING) { msg = read_from_box(conn->bearerbox_connection, conn); @@ -463,7 +493,29 @@ else gw_sql_save_msg(msg, octstr_imm("DLR")); } - msg_destroy(msg); + + if(msg_type(msg) == sms && msg->sms.sms_type == report_mo && msg->sms.dlr_url != NULL){ + pattern = urltrans_get_pattern(0, msg); + debug("sqlbox", 0, "Starting delivery report <%s> from <%s>", + octstr_get_cstr(msg->sms.service), + octstr_get_cstr(msg->sms.sender)); + request_headers = http_create_empty_headers(); + http_header_add(request_headers, "User-Agent", GW_NAME "/" GW_VERSION); + requests++; + http_start_request(caller, HTTP_METHOD_GET, pattern, request_headers, + NULL, 1, msg, NULL); + http_destroy_headers(request_headers); + octstr_destroy(pattern); + } + if(msg_type(msg) == sms && msg->sms.sms_type == report_mo){ + Msg *mack; + mack = msg_create(ack); + mack->ack.nack = ack_success; + mack->ack.time = msg->sms.time; + uuid_copy(mack->ack.id, msg->sms.id); + send_msg(conn->bearerbox_connection, conn, mack); + msg_destroy(mack); + } } } @@ -668,6 +720,9 @@ cf_index = get_and_set_debugs(argc, argv, check_args); setup_signal_handlers(); + + caller = http_caller_create(); + requests = 0; if (argv[cf_index] == NULL) filename = octstr_create("kannel.conf"); @@ -687,6 +742,7 @@ sqlboxc_run((void *)sqlbox_port); + http_caller_destroy(caller); cfg_destroy(cfg); if (restart_sqlbox) { gwthread_sleep(1.0);