donald-jackson / kannel-pluginbox

Kannel Pluginbox allows users to implement their own business logic for routing, billing, etc in Kannel.
Other
12 stars 9 forks source link

DLR reject with header("HTTP/1.0 404 Not Found") but SMSBOX still get rejected DLR #19

Open vinayakvasu opened 4 years ago

vinayakvasu commented 4 years ago

void pluginbox_http_receive_thread(void arg) { info(0, PLUGINBOX_LOG_PREFIX "Starting receive thread"); PluginHttp plugin_http = arg; Octstr header_key, header_value; int status; Octstr final_url; List response_headers; Octstr response_body; PluginBoxMsg pluginbox_msg;

while((pluginbox_msg = http_receive_result(plugin_http->caller,&status,&final_url,&response_headers,&response_body)) != NULL) {
    semaphore_down(plugin_http->max_pending_requests);
    if((status >= HTTP_OK) && (status < HTTP_BAD_REQUEST)) {
        debug(PLUGINBOX_LOG_PREFIX"pluginbox.http.receive.thread", 0, "Upstream URL %s accepted message, processing changes", octstr_get_cstr(final_url));
        pluginbox_http_modify_with_headers(pluginbox_msg->msg, response_headers);
    } else {
        warning(0, PLUGINBOX_LOG_PREFIX"Upstream URL %s rejected msg with status %d (outside >= %d < %d), rejecting", octstr_get_cstr(final_url), status, HTTP_OK, HTTP_BAD_REQUEST);
        pluginbox_msg->status = PLUGINBOX_MESSAGE_REJECT;
    }
    pluginbox_msg->callback(pluginbox_msg);
    octstr_destroy(final_url);
    http_destroy_headers(response_headers);
    octstr_destroy(response_body);
}

}

Suren15894 commented 8 months ago

@vinayakvasu ,

Existing implementation is done only to reject the submissions and not the DLR's.

If you want to reject the deliver_sm then you will have to alter the pluginbox.c file.

bearerbox_inbound_queue_plugins_done : line no 381.

in this function you will have to add PLUGINBOX_MESSAGE_REJECT commands.

This is not tested with load, may be you can check this.