Skip to content

Commit

Permalink
Fixed send_smpp_message breaking script
Browse files Browse the repository at this point in the history
It now returns a proper return code, as per the doc

(cherry picked from commit 455066f)
  • Loading branch information
vladpaiu committed May 13, 2019
1 parent 7df5d5e commit 142957c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
3 changes: 1 addition & 2 deletions modules/proto_smpp/proto_smpp.c
Expand Up @@ -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;
}

2 changes: 1 addition & 1 deletion modules/proto_smpp/proto_smpp.h
Expand Up @@ -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,
Expand Down
16 changes: 12 additions & 4 deletions modules/proto_smpp/smpp.c
Expand Up @@ -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;
Expand Down Expand Up @@ -1029,21 +1029,29 @@ 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);
LM_DBG("MESSAGE: %.*s\n", msg->len, msg->s);

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)
Expand Down

0 comments on commit 142957c

Please sign in to comment.