diff --git a/modules/proto_smpp/proto_smpp.c b/modules/proto_smpp/proto_smpp.c index 4cfe9b195df..c4de9f2a343 100644 --- a/modules/proto_smpp/proto_smpp.c +++ b/modules/proto_smpp/proto_smpp.c @@ -471,8 +471,7 @@ static int send_smpp_msg(struct sip_msg *msg, str *name) parse_sip_msg_uri(msg); get_body(msg, &body); - send_submit_or_deliver_request(&body, &parse_from_uri(msg)->user, + return send_submit_or_deliver_request(&body, &parse_from_uri(msg)->user, &msg->parsed_uri.user, session); - return 0; } diff --git a/modules/proto_smpp/proto_smpp.h b/modules/proto_smpp/proto_smpp.h index 426df76d017..0616e31cce8 100644 --- a/modules/proto_smpp/proto_smpp.h +++ b/modules/proto_smpp/proto_smpp.h @@ -69,7 +69,7 @@ struct tcp_connection* smpp_sync_connect(struct socket_info* send_sock, void enquire_link(unsigned int ticks, void *param); void rpc_bind_sessions(int sender_id, void *param); void handle_smpp_msg(char *buffer, smpp_session_t *session, struct receive_info *rcv); -void send_submit_or_deliver_request(str *msg, str *src, str *dst, +int send_submit_or_deliver_request(str *msg, str *src, str *dst, smpp_session_t *session); smpp_session_t *smpp_session_new(str *name, struct ip_addr *ip, int port, str *system_id, str *password, str *system_type, int src_addr_ton, diff --git a/modules/proto_smpp/smpp.c b/modules/proto_smpp/smpp.c index 70d9da06079..b2647120dfb 100644 --- a/modules/proto_smpp/smpp.c +++ b/modules/proto_smpp/smpp.c @@ -521,7 +521,7 @@ static int smpp_send_msg(smpp_session_t *smsc, str *buffer) if (ret <= 0) { LM_ERR("cannot fetch connection for %.*s (%d)\n", smsc->name.len, smsc->name.s, ret); - return ret; + return -1; } /* update connection in case it has changed */ smsc->conn_id = conn->id; @@ -1029,10 +1029,12 @@ void handle_smpp_msg(char *buffer, smpp_session_t *session, struct receive_info } -void send_submit_or_deliver_request(str *msg, str *src, str *dst, +int send_submit_or_deliver_request(str *msg, str *src, str *dst, smpp_session_t *session) { smpp_submit_sm_req_t *req; + int ret; + LM_DBG("sending submit_sm\n"); LM_DBG("FROM: %.*s\n", src->len, src->s); LM_DBG("TO: %.*s\n", dst->len, dst->s); @@ -1040,10 +1042,16 @@ void send_submit_or_deliver_request(str *msg, str *src, str *dst, if (build_submit_or_deliver_request(&req, src, dst, msg, session)) { LM_ERR("error creating submit_sm request\n"); - return; + return -1; } - smpp_send_msg(session, &req->payload); + + ret = smpp_send_msg(session, &req->payload); pkg_free(req); + + if (ret <=0) + return -1; + + return 1; } static void send_enquire_link_request(smpp_session_t *session)