Free-SMDR icon indicating copy to clipboard operation
Free-SMDR copied to clipboard

Issue with mutiple connections

Open aseques opened this issue 1 year ago • 2 comments

I am using free-smdr to get data from a single Avaya IP Office, I've observed that the pbx changes the source port from time to time (4790, 4791, 4792)

tcp        2      0 0.0.0.0:9000            0.0.0.0:*               LISTEN      1548040/python      
tcp     3406      0 192.168.1.77:9000       10.33.77.200:4791       ESTABLISHED -                   
tcp    15901      0 192.168.1.77:9000       10.33.77.200:4792       ESTABLISHED -                   
tcp        0      0 192.168.1.77:9000       10.33.77.200:4790       ESTABLISHED 1548040/python  

It seems the only input that's processed is the one entering from the first port that was established (in this case 4790), if I restart the service it will work again normally.

I have two possible solutions:

  • Detect somehow that the first connection is closed and close the server in that case (timeout, ..)
  • Improve somehow the RecvHandler so it can deal better with this situation.

Any ideas?

aseques avatar May 14 '24 10:05 aseques

The code is quite old: it uses an old-fashioned low-level os.fork() to fork processes and handle a single incoming connection.

This was good at the time to handle a single PBX stream. Having multiple streams is in fact just like having multiple PBX and unfortunately this wasn't designed to support it.

Today, i would rewrite it using the sorcketserver module (socketserver.ThreadingMixIn, socketserver.TCPServer)

gtozzi avatar May 14 '24 11:05 gtozzi

This issue should be fixed with the PR #8 (I also added a new field on the database to inform the source host for the CDR)

aseques avatar May 31 '24 08:05 aseques