Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] SMPP trunk #1728

Closed
volga629 opened this issue Jun 10, 2019 · 75 comments
Closed

[BUG] SMPP trunk #1728

volga629 opened this issue Jun 10, 2019 · 75 comments
Assignees

Comments

@volga629
Copy link

volga629 commented Jun 10, 2019

OpenSIPS version you are running

opensips -V
version: opensips 3.0.0 (x86_64/linux)
flags: STATS: On, DISABLE_NAGLE, USE_MCAST, SHM_MMAP, PKG_MALLOC, Q_MALLOC, F_MALLOC, HP_MALLOC, DBG_MALLOC, FAST_LOCK-ADAPTIVE_WAIT
ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144, MAX_LISTEN 16, MAX_URI_SIZE 1024, BUF_SIZE 65535
poll method support: poll, epoll, sigio_rt, select.
main.c compiled on 13:21:56 May 29 2019 with gcc 8

Describe the bug

SMPP trunk setup with VoIP provider .
SMPP trunk initialized, but then get disconnected and opensips produce error in log

Jun 10 04:35:39 smsc /usr/sbin/opensips[29432]: ERROR:proto_smpp:smpp_send_msg: cannot fetch connection for SMS_C (0)
Jun 10 04:35:44 smsc /usr/sbin/opensips[29434]: ERROR:proto_smpp:smpp_send_msg: cannot fetch connection for SMS_C (0)

Based on information from provider opensips send incorrect information.

2019-06-07 14:30:53.959 [22670] [21] ERROR: SMPP: PDU length was too small (-797211610, minimum is 16). 
2019-06-07 14:30:53.959 [22670] [21] ERROR: ESME[username] Client sent garbage, closing connection from IP `207.35.127.183:49169'. 
2019-06-07 14:38:47.377 [23345] [25] ERROR: SMPP: PDU length was too large (1229866575, maximum is 7424). 
2019-06-07 14:38:47.377 [23345] [25] ERROR: ESME[username] Client sent garbage, closing connection from IP `207.35.127.183:53645'.

SMPP Trunk Flow

991289

Opensips log says about unsupported format


Jun  7 10:02:34 smsc /usr/sbin/opensips[10821]: WARNING:proto_smpp:handle_smpp_msg: Unknown or unsupported command received 00000006
Jun  7 10:02:38 smsc /usr/sbin/opensips[10827]: ERROR:proto_smpp:smpp_send_msg: cannot fetch connection for SMS_C (0)
Jun  7 10:02:43 smsc /usr/sbin/opensips[10823]: ERROR:proto_smpp:smpp_send_msg: cannot fetch connection for SMS_C (0)
Jun  7 10:02:48 smsc /usr/sbin/opensips[10829]: ERROR:proto_smpp:smpp_send_msg: cannot fetch connection for SMS_C (0)
Jun  7 10:02:53 smsc /usr/sbin/opensips[10829]: ERROR:proto_smpp:smpp_send_msg: cannot fetch connection for SMS_C (0)

To Reproduce

Steps to reproduce the behavior:
Example:

  1. Install Opensips SMPP module
  2. Provision Database smpp table with provider information
  3. Start opensips
  4. Watch opensips log produce errors.

Expected behavior

Expect stable state for SMPP trunk where messages can flow without interruption bidirectional.

Relevant System Logs

OS/environment information

 cat /etc/redhat-release 
Fedora release 29 (Twenty Nine)
[root@smsc ~]# rpm -qa | grep opensips
opensips-proto_smpp-3.0.0-1.fc29.x86_64
opensips-proto_smpp-debuginfo-3.0.0-1.fc29.x86_64
opensips-debuginfo-3.0.0-1.fc29.x86_64
opensips-3.0.0-1.fc29.x86_64
opensips-httpd-3.0.0-1.fc29.x86_64
opensips-debugsource-3.0.0-1.fc29.x86_64
opensips-db_mysql-3.0.0-1.fc29.x86_64
python-opensips-cli-1.0.0.f1717ac-4.fc29.x86_64

Additional context

@volga629
Copy link
Author

Also I provided pcap with time frame from opensips start.

@volga629
Copy link
Author

Here some additional information from provider.

All we can tell you is, after we send deliver_sm, you should not
        send the generic_nack. But deliver_sm_resp.

@volga629
Copy link
Author

Hello Everyone,
Is possible get update on this issue, tomorrow is 15 days ???

@razvancrainea
Copy link
Member

I am sorry, I did receive your PCAPs, but I simply couldn't find the time to check them out. As soon as I do, I will get back to you.

@volga629
Copy link
Author

Thank you for reply.

@volga629
Copy link
Author

Opensips don't have debug for smpp I couldn't find what was event ID 6, so I tried debug with freeswitch and get the following information regard ID 6

2019-06-30 07:05:48.471881 [INFO] mod_smpp_utils.c:41 PDU 
command_length                [00000010] - [16]
command_id                    [00000006] - [UNBIND]
command_status                [00000000] - [ESME_ROK]
sequence_number               [5CFAB1E3] - [1559933411]

2019-06-30 07:05:48.471881 [ERR] mod_smpp_gateway.c:297 Unrecognized Command ID: 6
2019-06-30 07:05:48.471881 [ERR] mod_smpp_gateway.c:359 Unknown command_id[6]
2019-06-30 07:05:50.471884 [ERR] mod_smpp_gateway.c:224 Failed to recv on the socket

@volga629
Copy link
Author

volga629 commented Jun 30, 2019

Here are list of events for smpp.

exports.command_ids = {                              // Use command_ids to look up by ID
    0x80000000: 'generic_nack',
    0x00000001: 'bind_receiver',
    0x80000001: 'bind_receiver_resp',
    0x00000002: 'bind_transmitter',
    0x80000002: 'bind_transmitter_resp',
    0x00000003: 'query_sm',
    0x80000003: 'query_sm_resp',
    0x00000004: 'submit_sm',
    0x80000004: 'submit_sm_resp',
    0x00000005: 'deliver_sm',
    0x80000005: 'deliver_sm_resp',
    0x00000006: 'unbind',
    0x80000006: 'unbind_resp',
    0x00000007: 'replace_sm',
    0x80000007: 'replace_sm_resp',
    0x00000008: 'cancel_sm',
    0x80000008: 'cancel_sm_resp',
    0x00000009: 'bind_transceiver',
    0x80000009: 'bind_transceiver_resp',
    0x0000000B: 'outbind',
    0x00000015: 'enquire_link',
    0x80000015: 'enquire_link_resp',
    0x00000021: 'submit_multi',
    0x80000021: 'submit_multi_resp',
    0x00000102: 'alert_notification',
    0x00000103: 'data_sm',
    0x80000103: 'data_sm_resp'
};

@volga629
Copy link
Author

volga629 commented Jul 4, 2019

Razvan,
Can you please let me know when you can take a look on issue. It start affecting production deployment timelines. Thank you.

razvancrainea added a commit that referenced this issue Jul 5, 2019
Thanks go to Slava Bendersky for reporting this in ticket #1728
razvancrainea added a commit that referenced this issue Jul 5, 2019
Thanks go to Slava Bendersky for reporting this in ticket #1728

(cherry picked from commit ab063d3)
razvancrainea added a commit that referenced this issue Jul 5, 2019
Thanks go to Slava Bendersky for reporting this in ticket #1728
razvancrainea added a commit that referenced this issue Jul 5, 2019
Thanks go to Slava Bendersky for reporting this in ticket #1728

(cherry picked from commit 31b2c83)
@razvancrainea
Copy link
Member

I've just pushed a fix for this - could you please take the latest sources and test again?

@volga629
Copy link
Author

volga629 commented Jul 5, 2019

Hello Razvan,
Thank you, going test right now.

@volga629
Copy link
Author

volga629 commented Jul 5, 2019

All we can tell you is, after we send deliver_sm, you should not
send the generic_nack. But deliver_sm_resp.

Razvan,
What you think about this ?

volga629

@razvancrainea
Copy link
Member

I doubt we are sending generic_nack, but even if we do, we must be sending it because an error occurred - we should investigate that error. But that's not a general handling, in most of the cases, and the pcaps you have sent confirm this, we are sending deliver_sm_resp.

@volga629
Copy link
Author

volga629 commented Jul 5, 2019

ok let me test all fixes first. Thank you for answer.

@volga629
Copy link
Author

volga629 commented Jul 5, 2019

Hello Razvan,
Here Log test results
It still stop connection after first inbound SMS

Jul  5 06:03:34 smsc /usr/sbin/opensips[15608]: Sending sms from source ip ~> [207.35.127.188]
Jul  5 06:03:34 smsc /usr/sbin/opensips[15608]: ERROR:proto_smpp:smpp_send_msg: cannot fetch connection for SMS_C (0)
Jul  5 06:03:34 smsc /usr/sbin/opensips[15608]: SMPP trunk return ~> -1
Jul  5 06:03:34 smsc /usr/sbin/opensips[15608]: SMPP trunk return error
Jul  5 06:03:36 smsc /usr/sbin/opensips[15612]: ERROR:proto_smpp:smpp_send_msg: cannot fetch connection for SMS_C (0)
Jul  5 06:03:40 smsc /usr/sbin/opensips[15607]: ERROR:proto_smpp:smpp_send_msg: cannot fetch connection for SMS_C (0)
Jul  5 06:03:45 smsc /usr/sbin/opensips[15619]: ERROR:proto_smpp:smpp_send_msg: cannot fetch connection for SMS_C (0)
Jul  5 06:01:56 smsc /usr/sbin/opensips[15609]: INFO:core:init_sock_keepalive: TCP keepalive enabled on socket 100
Jul  5 06:01:56 smsc /usr/sbin/opensips[15609]: INFO:proto_smpp:smpp_conn_init: smpp_conn_init called
Jul  5 06:01:56 smsc /usr/sbin/opensips[15611]: ERROR:proto_smpp:handle_bind_transceiver_resp_cmd: Error in bind_transceiver_resp 0000000d

@volga629
Copy link
Author

volga629 commented Jul 5, 2019

I sent you fresh pcap

razvancrainea added a commit that referenced this issue Jul 5, 2019
razvancrainea added a commit that referenced this issue Jul 5, 2019
Addresses ticket #1728

(cherry picked from commit 18f8714)
@razvancrainea
Copy link
Member

Indeed, my previous commit was not complete. Could you please try the new version?

@volga629
Copy link
Author

volga629 commented Jul 5, 2019

Hello Razvan,
Having some issue with compile right now
Trying new patch

/home/volga629/rpmbuild/BUILD/opensips-3.0.0/modules/proto_smpp/smpp.csmpp.c:115: multiple definition of `get_payload_from_submit_sm_body'; smpp.o:/home/volga629/rpmbuild/BUILD/opensips-3.0.0/modules/proto_smpp/smpp.c:115: first defined here
/usr/bin/ld: smpp.csmpp.o: in function `get_payload_from_deliver_sm_resp_body':
/home/volga629/rpmbuild/BUILD/opensips-3.0.0/modules/proto_smpp/smpp.csmpp.c:145: multiple definition of `get_payload_from_deliver_sm_resp_body'; smpp.o:/home/volga629/rpmbuild/BUILD/opensips-3.0.0/modules/proto_smpp/smpp.c:145: first defined here
/usr/bin/ld: smpp.csmpp.o: in function `get_payload_from_submit_sm_resp_body':
/home/volga629/rpmbuild/BUILD/opensips-3.0.0/modules/proto_smpp/smpp.csmpp.c:156: multiple definition of `get_payload_from_submit_sm_resp_body'; smpp.o:/home/volga629/rpmbuild/BUILD/opensips-3.0.0/modules/proto_smpp/smpp.c:156: first defined here
/usr/bin/ld: smpp.csmpp.o: in function `send_outbind':
/home/volga629/rpmbuild/BUILD/opensips-3.0.0/modules/proto_smpp/smpp.csmpp.c:488: multiple definition of `send_outbind'; smpp.o:/home/volga629/rpmbuild/BUILD/opensips-3.0.0/modules/proto_smpp/smpp.c:488: first defined here
/usr/bin/ld: smpp.csmpp.o: in function `bind_session':
/home/volga629/rpmbuild/BUILD/opensips-3.0.0/modules/proto_smpp/smpp.csmpp.c:576: multiple definition of `bind_session'; smpp.o:/home/volga629/rpmbuild/BUILD/opensips-3.0.0/modules/proto_smpp/smpp.c:576: first defined here
/usr/bin/ld: smpp.csmpp.o:/home/volga629/rpmbuild/BUILD/opensips-3.0.0/modules/proto_smpp/smpp.csmpp.c:49: multiple definition of `smpp_send_timeout'; smpp.o:/home/volga629/rpmbuild/BUILD/opensips-3.0.0/modules/proto_smpp/smpp.c:49: first defined here
/usr/bin/ld: smpp.csmpp.o: in function `smpp_bind_sessions':
/home/volga629/rpmbuild/BUILD/opensips-3.0.0/modules/proto_smpp/smpp.csmpp.c:591: multiple definition of `smpp_bind_sessions'; smpp.o:/home/volga629/rpmbuild/BUILD/opensips-3.0.0/modules/proto_smpp/smpp.c:591: first defined here
/usr/bin/ld: smpp.csmpp.o: in function `rpc_bind_sessions':
/home/volga629/rpmbuild/BUILD/opensips-3.0.0/modules/proto_smpp/smpp.csmpp.c:602: multiple definition of `rpc_bind_sessions'; smpp.o:/home/volga629/rpmbuild/BUILD/opensips-3.0.0/modules/proto_smpp/smpp.c:602: first defined here
/usr/bin/ld: smpp.csmpp.o: in function `enquire_link':
/home/volga629/rpmbuild/BUILD/opensips-3.0.0/modules/proto_smpp/smpp.csmpp.c:612: multiple definition of `enquire_link'; smpp.o:/home/volga629/rpmbuild/BUILD/opensips-3.0.0/modules/proto_smpp/smpp.c:612: first defined here
/usr/bin/ld: smpp.csmpp.o: in function `parse_bind_receiver_body':
/home/volga629/rpmbuild/BUILD/opensips-3.0.0/modules/proto_smpp/smpp.csmpp.c:668: multiple definition of `parse_bind_receiver_body'; smpp.o:/home/volga629/rpmbuild/BUILD/opensips-3.0.0/modules/proto_smpp/smpp.c:668: first defined here
/usr/bin/ld: smpp.csmpp.o: in function `parse_bind_receiver_resp_body':
/home/volga629/rpmbuild/BUILD/opensips-3.0.0/modules/proto_smpp/smpp.csmpp.c:685: multiple definition of `parse_bind_receiver_resp_body'; smpp.o:/home/volga629/rpmbuild/BUILD/opensips-3.0.0/modules/proto_smpp/smpp.c:685: first defined here
/usr/bin/ld: smpp.csmpp.o: in function `parse_bind_transmitter_body':
/home/volga629/rpmbuild/BUILD/opensips-3.0.0/modules/proto_smpp/smpp.csmpp.c:695: multiple definition of `parse_bind_transmitter_body'; smpp.o:/home/volga629/rpmbuild/BUILD/opensips-3.0.0/modules/proto_smpp/smpp.c:695: first defined here
/usr/bin/ld: smpp.csmpp.o: in function `parse_bind_transmitter_resp_body':
/home/volga629/rpmbuild/BUILD/opensips-3.0.0/modules/proto_smpp/smpp.csmpp.c:700: multiple definition of `parse_bind_transmitter_resp_body'; smpp.o:/home/volga629/rpmbuild/BUILD/opensips-3.0.0/modules/proto_smpp/smpp.c:700: first defined here
/usr/bin/ld: smpp.csmpp.o: in function `parse_bind_transceiver_body':
/home/volga629/rpmbuild/BUILD/opensips-3.0.0/modules/proto_smpp/smpp.csmpp.c:701: multiple definition of `parse_bind_transceiver_body'; smpp.o:/home/volga629/rpmbuild/BUILD/opensips-3.0.0/modules/proto_smpp/smpp.c:701: first defined here
/usr/bin/ld: smpp.csmpp.o: in function `parse_bind_transceiver_resp_body':
/home/volga629/rpmbuild/BUILD/opensips-3.0.0/modules/proto_smpp/smpp.csmpp.c:701: multiple definition of `parse_bind_transceiver_resp_body'; smpp.o:/home/volga629/rpmbuild/BUILD/opensips-3.0.0/modules/proto_smpp/smpp.c:701: first defined here
/usr/bin/ld: smpp.csmpp.o: in function `parse_submit_or_deliver_resp_body':
/home/volga629/rpmbuild/BUILD/opensips-3.0.0/modules/proto_smpp/smpp.csmpp.c:715: multiple definition of `parse_submit_or_deliver_resp_body'; smpp.o:/home/volga629/rpmbuild/BUILD/opensips-3.0.0/modules/proto_smpp/smpp.c:715: first defined here
/usr/bin/ld: smpp.csmpp.o: in function `send_submit_or_deliver_resp':
/home/volga629/rpmbuild/BUILD/opensips-3.0.0/modules/proto_smpp/smpp.csmpp.c:725: multiple definition of `send_submit_or_deliver_resp'; smpp.o:/home/volga629/rpmbuild/BUILD/opensips-3.0.0/modules/proto_smpp/smpp.c:725: first defined here
/usr/bin/ld: smpp.csmpp.o: in function `check_bind_session':
/home/volga629/rpmbuild/BUILD/opensips-3.0.0/modules/proto_smpp/smpp.csmpp.c:745: multiple definition of `check_bind_session'; smpp.o:/home/volga629/rpmbuild/BUILD/opensips-3.0.0/modules/proto_smpp/smpp.c:745: first defined here
/usr/bin/ld: smpp.csmpp.o: in function `send_bind_resp':
/home/volga629/rpmbuild/BUILD/opensips-3.0.0/modules/proto_smpp/smpp.csmpp.c:766: multiple definition of `send_bind_resp'; smpp.o:/home/volga629/rpmbuild/BUILD/opensips-3.0.0/modules/proto_smpp/smpp.c:766: first defined here
/usr/bin/ld: smpp.csmpp.o: in function `handle_generic_nack_cmd':
/home/volga629/rpmbuild/BUILD/opensips-3.0.0/modules/proto_smpp/smpp.csmpp.c:785: multiple definition of `handle_generic_nack_cmd'; smpp.o:/home/volga629/rpmbuild/BUILD/opensips-3.0.0/modules/proto_smpp/smpp.c:785: first defined here
/usr/bin/ld: smpp.csmpp.o: in function `handle_bind_receiver_cmd':
/home/volga629/rpmbuild/BUILD/opensips-3.0.0/modules/proto_smpp/smpp.csmpp.c:790: multiple definition of `handle_bind_receiver_cmd'; smpp.o:/home/volga629/rpmbuild/BUILD/opensips-3.0.0/modules/proto_smpp/smpp.c:790: first defined here
/usr/bin/ld: smpp.csmpp.o: in function `handle_bind_receiver_resp_cmd':
/home/volga629/rpmbuild/BUILD/opensips-3.0.0/modules/proto_smpp/smpp.csmpp.c:805: multiple definition of `handle_bind_receiver_resp_cmd'; smpp.o:/home/volga629/rpmbuild/BUILD/opensips-3.0.0/modules/proto_smpp/smpp.c:805: first defined here
/usr/bin/ld: smpp.csmpp.o: in function `handle_bind_transmitter_cmd':
/home/volga629/rpmbuild/BUILD/opensips-3.0.0/modules/proto_smpp/smpp.csmpp.c:814: multiple definition of `handle_bind_transmitter_cmd'; smpp.o:/home/volga629/rpmbuild/BUILD/opensips-3.0.0/modules/proto_smpp/smpp.c:814: first defined here
/usr/bin/ld: smpp.csmpp.o: in function `handle_bind_transmitter_resp_cmd':
/home/volga629/rpmbuild/BUILD/opensips-3.0.0/modules/proto_smpp/smpp.csmpp.c:829: multiple definition of `handle_bind_transmitter_resp_cmd'; smpp.o:/home/volga629/rpmbuild/BUILD/opensips-3.0.0/modules/proto_smpp/smpp.c:829: first defined here
/usr/bin/ld: smpp.csmpp.o: in function `handle_submit_or_deliver_cmd':
/home/volga629/rpmbuild/BUILD/opensips-3.0.0/modules/proto_smpp/smpp.csmpp.c:839: multiple definition of `handle_submit_or_deliver_cmd'; smpp.o:/home/volga629/rpmbuild/BUILD/opensips-3.0.0/modules/proto_smpp/smpp.c:839: first defined here
/usr/bin/ld: smpp.csmpp.o: in function `handle_submit_or_deliver_resp_cmd':
/home/volga629/rpmbuild/BUILD/opensips-3.0.0/modules/proto_smpp/smpp.csmpp.c:865: multiple definition of `handle_submit_or_deliver_resp_cmd'; smpp.o:/home/volga629/rpmbuild/BUILD/opensips-3.0.0/modules/proto_smpp/smpp.c:865: first defined here
/usr/bin/ld: smpp.csmpp.o: in function `handle_submit_sm_cmd':
/home/volga629/rpmbuild/BUILD/opensips-3.0.0/modules/proto_smpp/smpp.csmpp.c:879: multiple definition of `handle_submit_sm_cmd'; smpp.o:/home/volga629/rpmbuild/BUILD/opensips-3.0.0/modules/proto_smpp/smpp.c:879: first defined here
/usr/bin/ld: smpp.csmpp.o: in function `handle_smpp_msg':
/home/volga629/rpmbuild/BUILD/opensips-3.0.0/modules/proto_smpp/smpp.csmpp.c:993: multiple definition of `handle_smpp_msg'; smpp.o:/home/volga629/rpmbuild/BUILD/opensips-3.0.0/modules/proto_smpp/smpp.c:993: first defined here
/usr/bin/ld: smpp.csmpp.o: in function `send_submit_or_deliver_request':
/home/volga629/rpmbuild/BUILD/opensips-3.0.0/modules/proto_smpp/smpp.csmpp.c:1060: multiple definition of `send_submit_or_deliver_request'; smpp.o:/home/volga629/rpmbuild/BUILD/opensips-3.0.0/modules/proto_smpp/smpp.c:1060: first defined here
/usr/bin/ld: smpp.csmpp.o: in function `smpp_sessions_init':
/home/volga629/rpmbuild/BUILD/opensips-3.0.0/modules/proto_smpp/smpp.csmpp.c:1144: multiple definition of `smpp_sessions_init'; smpp.o:/home/volga629/rpmbuild/BUILD/opensips-3.0.0/modules/proto_smpp/smpp.c:1144: first defined here
/usr/bin/ld: smpp.csmpp.o: in function `smpp_session_new':
/home/volga629/rpmbuild/BUILD/opensips-3.0.0/modules/proto_smpp/smpp.csmpp.c:1161: multiple definition of `smpp_session_new'; smpp.o:/home/volga629/rpmbuild/BUILD/opensips-3.0.0/modules/proto_smpp/smpp.c:1161: first defined here
/usr/bin/ld: smpp.csmpp.o: in function `smpp_session_get':
/home/volga629/rpmbuild/BUILD/opensips-3.0.0/modules/proto_smpp/smpp.csmpp.c:1220: multiple definition of `smpp_session_get'; smpp.o:/home/volga629/rpmbuild/BUILD/opensips-3.0.0/modules/proto_smpp/smpp.c:1220: first defined here
collect2: error: ld returned 1 exit status
make[1]: *** [../../Makefile.rules:39: proto_smpp.so] Error 1
make[1]: Leaving directory '/home/volga629/rpmbuild/BUILD/opensips-3.0.0/modules/proto_smpp'
make: *** [Makefile:200: modules] Error 2
error: Bad exit status from /var/tmp/rpm-tmp.xg7p0L (%build)

@volga629
Copy link
Author

volga629 commented Jul 5, 2019

This last patch causing issue

[volga629@canldev01-fedora29 SPECS]$ cat ../SOURCES/opensips-3.0.0-proto_smpp-github1728-smpp.c.patch
--- a/modules/proto_smpp/smpp.c	2019-07-05 12:13:35.608155898 -0400
+++ b/modules/proto_smpp/smpp.c	2019-07-05 12:16:47.813069825 -0400
@@ -521,7 +521,7 @@
 	/* TBD - handle conn not found here = reconnect ? */
 	ret = tcp_conn_get(smsc->conn_id, &smsc->ip, smsc->port, PROTO_SMPP,
 		NULL, &conn, &fd);
-	if (ret <= 0 || bind_session(smsc) < 0) {
+	if (ret <= 0 && bind_session(smsc) < 0) {
 		LM_ERR("cannot fetch connection for %.*s (%d)\n",
 				smsc->name.len, smsc->name.s, ret);
 		return -1;

@volga629
Copy link
Author

volga629 commented Jul 5, 2019

I manage to compile but it causing segfault


Jul  5 11:10:34 smsc /usr/sbin/opensips[19663]: INFO:core:probe_max_sock_buff: using snd buffer of 416 kb
Jul  5 11:10:34 smsc /usr/sbin/opensips[19663]: INFO:core:init_sock_keepalive: TCP keepalive enabled on socket 5
Jul  5 11:10:34 smsc /usr/sbin/opensips[19663]: INFO:proto_smpp:smpp_conn_init: smpp_conn_init called
Jul  5 11:10:34 smsc /usr/sbin/opensips[19663]: ERROR:core:tsend_stream: tsend_stream: failed to send: (9) Bad file descriptor
Jul  5 11:10:34 smsc /usr/sbin/opensips[19663]: CRITICAL:core:sig_usr: segfault in process pid: 19663, id: 10
Jul  5 11:11:12 smsc kernel: opensips[19814]: segfault at a4 ip 00007fd879af37f4 sp 00007ffca7ea5620 error 4 in proto_smpp.so[7fd879aee000+c000]
Jul  5 11:11:12 smsc kernel: Code: 00 00 41 8b 55 00 48 8b 75 00 8b 7c 24 14 8b 08 e8 a1 ad ff ff 89 c5 e8 4a b0 ff ff 48 8b 15 8b b7 00 00 48 8b 7c 24 18 03 02 <3b> 87 a4 00 00 00 77 54 85 ed 78 5a 48 8b 05 89 b7 00 00 8b 00 39

@volga629
Copy link
Author

volga629 commented Jul 8, 2019

Hello Razvan,
Can you please verify last patch that I can continue testing.
Thank you.

@johandeclercqdemocon
Copy link

can you please provide a full back trace ?

@volga629
Copy link
Author

I am waiting for Razvan to review last diff, which cause segfault

@razvancrainea
Copy link
Member

I actually need to revise the entire connections management, to make sure it supports these reconnects properly. I will try to prioritize this, will let you know my findings.

@johandeclercqdemocon
Copy link

johandeclercqdemocon commented Jul 17, 2019 via email

@volga629
Copy link
Author

Strange on Fedora Server 29 is failing if I add line above it happy

@johandeclercqdemocon
Copy link

johandeclercqdemocon commented Jul 17, 2019 via email

@volga629
Copy link
Author

I think on debian gcc use different flags

that on fedora

gcc -shared -Wl,-z,relro   -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld  -Wl,-E   db.o proto_smpp.o smpp.o smpp.csmpp.o utils.o   -o proto_smpp.so

@johandeclercqdemocon
Copy link

johandeclercqdemocon commented Jul 17, 2019 via email

@volga629
Copy link
Author

Hello Razvan,
Is possible to do something about compiling problem ? I can't install under fedora 29 anymore.

Thank you

@razvancrainea
Copy link
Member

@volga629 please let me know what compiler you are using gcc vs clang and what's the version you are using.
Also, did you try to run make proper before compiling?

@volga629
Copy link
Author

rpmbuild use gcc

gcc -shared -Wl,-z,relro   -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld  -Wl,-E   db.o proto_smpp.o smpp.o smpp.csmpp.o utils.o   -o proto_smpp.so
gcc-8.3.1-2.fc29.x86_64

if I set

if (ret <= 0 && bind_session(smsc) < 0) {

it compiles fine

@razvancrainea
Copy link
Member

@volga629 I've just compiled the proto_smpp module on a Fedora 29 without any issues.
Moreover, the error invoked by gcc doesn't seem to be valid. So my assumption is that there's something wrong with your building environment. Try to build it on a clean system, or make sure you cleanup previous tries.

@volga629
Copy link
Author

did you tried from rpmbuild with specs file ?

@razvancrainea
Copy link
Member

yes, it works out just fine.

@volga629
Copy link
Author

that command exit
environment is clean

[volga629@canldev01-fedora29 proto_smpp]$ gcc -shared -Wl,-z,relro   -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld  -Wl,-E   db.o proto_smpp.o smpp.o smpp.csmpp.o utils.o   -o proto_smpp.so
/usr/bin/ld: smpp.csmpp.o: in function `get_payload_from_submit_sm_body':
/home/volga629/rpmbuild/BUILD/opensips-3.0.0/modules/proto_smpp/smpp.csmpp.c:115: multiple definition of `get_payload_from_submit_sm_body'; smpp.o:/home/volga629/rpmbuild/BUILD/opensips-3.0.0/modules/proto_smpp/smpp.c:115: first defined here
/usr/bin/ld: smpp.csmpp.o: in function `get_payload_from_deliver_sm_resp_body':
/home/volga629/rpmbuild/BUILD/opensips-3.0.0/modules/proto_smpp/smpp.csmpp.c:145: mult

@volga629
Copy link
Author

This build section of spec

%build
LOCALBASE=/usr NICER=0 CFLAGS="%{optflags} -fgnu89-inline" LDFLAGS="%{?__global_ldflags}" %{?_with_oracle:ORAHOME="$ORACLE_HOME"} %{__make} all %{?_smp_mflags} TLS=1 \
  exclude_modules="%EXCLUDE_MODULES" \
  cfg_target=%{_sysconfdir}/opensips/

@razvancrainea
Copy link
Member

the problem seems to be that you have copied some files in your source tree that shouldn't be there. There's no smpp.csmpp.c in the public sources, I bet it's something that you accidentally copied - that's why it says that those functions are duplicated, because they actually are - there should only be smpp.c, not sure how smpp.csmpp.c appears there.

@volga629
Copy link
Author

I am not sure from where are the files might from build, but they not in source for sure

[volga629@canldev01-fedora29 SOURCES]$ cd opensips-3.0.0/modules/proto_smpp/
[volga629@canldev01-fedora29 proto_smpp]$ ls
db.c  db.h  doc  Makefile  proto_smpp.c  proto_smpp.h  README  smpp.c  smpp.h  utils.c  utils.h

@razvancrainea
Copy link
Member

Perhaps they are hung in the /home/volga629/rpmbuild/BUILD/opensips-3.0.0/modules/proto_smpp directory - try removing the /home/volga629/rpmbuild/BUILD/ and re-compile.

@volga629
Copy link
Author

Ol I figure out spec file issue. Doing testing.

@volga629
Copy link
Author

volga629 commented Jul 23, 2019

Hello Razvan,
Connection is stable right now we can send and receive without crash in English language. Thank you for great support and work.
I was wonder if possible get estimation on ticket #1770. That add UTF8 multi language support.

Thank you volga629

@johandeclercqdemocon
Copy link

johandeclercqdemocon commented Jul 29, 2019

volga629, Razvan,

I need your help on an issue with SMPP.

This is what I have in the database (tralala inbound is the INBOUND link, meaning the link towards opensips)

+----+--------------+-------------+------+-----------+----------+-------------+---------+---------+---------+---------+--------------+
| id | name | ip | port | system_id | password | system_type | src_ton | src_npi | dst_ton | dst_npi | session_type |
+----+--------------+-------------+------+-----------+----------+-------------+---------+---------+---------+---------+--------------+
| 1 | tralala | 80.x.y.z| 2775 | BELOUT| yyyy | OTT | 1 | 1 | 1 | 1 | 1 |
| 2 | tralala INBOUND | 10.3.0.150 | 5062 | xxxx | yyyy | OTT | 1 | 1 | 1 | 1 | 1 |
+----+--------------+-------------+------+-----------+----------+-------------+---------+---------+---------+---------+--------------+

When I look in the logs : it seems that opensips doesn't respond to bind-transceiver on the inbound link;whereas tralala (the outbound link ) comes up nicely. Am I correct that I need to configure an inbound (towards opensips ) smpp link like this ?

When I do this, I have below output :

Jul 25 12:55:24 hendrix /data/opensips/sbin/opensips[19637]: DBG:proto_smpp:handle_smpp_msg: Received SMPP command 00000009 Jul 25 12:55:24 hendrix /data/opensips/sbin/opensips[19637]: DBG:proto_smpp:handle_bind_transceiver_cmd: Received bind_transceiver command Jul 25 12:55:24 hendrix /data/opensips/sbin/opensips[19637]: ERROR:proto_smpp:handle_bind_transceiver_cmd: NULL params Jul 25 12:55:24 hendrix /data/opensips/sbin/opensips[19637]: DBG:proto_smpp:smpp_read_req: tcp_read_req end Jul 25 12:55:25 hendrix /data/opensips/sbin/opensips[19638]: DBG:proto_smpp:smpp_read_req: Using the global ( per process ) buff

However in the request that comes in I have below info:

Transmission Control Protocol, Src Port: 38423, Dst Port: 5062, Seq: 1, Ack: 1, Len: 43 Short Message Peer to Peer, Command: Bind_transceiver, Seq: 1, Len: 43
Length: 43
Operation: Bind_transceiver (0x00000009)
Sequence #: 1
System ID: xxxxx
Password: yyyy
System type: OTT
Version (if): 3.4
Type of number: International (0x01)
Numbering plan indicator: ISDN (E163/E164) (0x01)

opensips has following configuration for smpp:
listen = smpp:10.3.0.150:5062
modparam("proto_smpp","db_url",
"")
modparam("proto_smpp", "smpp_port", 5062)
modparam("proto_smpp", "outbound_uri", "sip:10.3.0.150:5060")

Can you please indicate how you configure your side to have inbound SMS towards opensips working ?

@johandeclercqdemocon
Copy link

or would the issue be that I have 2 transceivers ?

@volga629
Copy link
Author

SMPP is peer to peer. Try set one connection at the time and try set system_id to smpp_site1 one and second smpp_site2

@johandeclercqdemocon
Copy link

johandeclercqdemocon commented Jul 29, 2019 via email

@johandeclercqdemocon
Copy link

johandeclercqdemocon commented Jul 29, 2019 via email

@volga629
Copy link
Author

volga629 commented Jul 30, 2019

The more I am looking on debug the more I think use 2775 port with same listener and define inbound stream as respond only

Session Type - Specifies what type of session should be used to connecto th the SMSc. Possible values are:

1 - Transciever

2 - Transmitter

3 - Receiver

4 - Outbind

Default value is 1 - Transciever.

@johandeclercqdemocon
Copy link

johandeclercqdemocon commented Jul 30, 2019 via email

@johandeclercqdemocon
Copy link

johandeclercqdemocon commented Jul 30, 2019 via email

@volga629
Copy link
Author

toward provider 2 - Transmitter to accept bind 3 - Receiver

@johandeclercqdemocon
Copy link

johandeclercqdemocon commented Jul 30, 2019 via email

@johandeclercqdemocon
Copy link

johandeclercqdemocon commented Jul 31, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants