sippy / rtpproxy

The RTPproxy is a high-performance software proxy for RTP streams that can work together with Sippy B2BUA, Kamailio, OpenSIPS and SER.
http://rtpproxy.org
BSD 2-Clause "Simplified" License
408 stars 114 forks source link

add command to stop recording #106

Closed razvancrainea closed 4 years ago

razvancrainea commented 4 years ago

Command to stop recording a session.

There is no test yet for this feature, but I will try to add one in the following days.

sobomax commented 4 years ago

Hi @razvancrainea , many thanks for the code! It looks OK in general, but 0.4% loss of coverage is a bit of a problem, as it brings us back into <90% yellow area. :( There are also few small things are missing such as version number etc. I have created a new feature branch, please rebase your pull request of that so that we can work together on adding those missing bits. https://github.com/sippy/rtpproxy/tree/razvancrainea-feature/norecord

sobomax commented 4 years ago

Hi Razvan, getting some progress with a test case. Got first segfault here, would you mind taking a look and letting me know if you have any ideas WRT fixing it. Thanks!

00:00:00.279/INFO:GLOBAL:main:922: rtpproxy started, pid 41248 00:00:00.279/ERR:GLOBAL:main:934: can't open pidfile for writing: Permission denied (13) 00:00:34.305/DBUG:GLOBAL:rtpp_command_split:392: received command "U recording.singlefile_57494.rec. 127.0.0.1 12345 from_tag_1" 00:00:34.305/INFO:GLOBAL:rtpp_command_ul_handle:486: new IPv4/IPv4 session recording.singlefile_57494.rec., tag from_tag_1 requested, type strong 00:00:34.305/INFO:recording.singlefile_57494.rec.:rtpp_command_ul_handle:549: new session on IPv4 port 44360 created, tag from_tag_1 00:00:34.305/INFO:recording.singlefile_57494.rec.:rtpp_stream_prefill_addr:685: pre-filling caller's RTP address with 127.0.0.1:12345 00:00:34.305/INFO:recording.singlefile_57494.rec.:rtpp_stream_prefill_addr:685: pre-filling caller's RTCP address with 127.0.0.1:12346 00:00:34.305/DBUG:GLOBAL:rtpc_doreply:188: sending reply "44360\n" 00:00:34.305/DBUG:GLOBAL:rtpp_command_split:392: received command "L recording.singlefile_57494.rec. 127.0.0.1 54321 from_tag_1 to_tag_1" 00:00:34.305/INFO:recording.singlefile_57494.rec.:rtpp_command_ul_handle:475: lookup on ports 44360/44362, session timer restarted 00:00:34.306/INFO:recording.singlefile_57494.rec.:rtpp_stream_prefill_addr:685: pre-filling callee's RTP address with 127.0.0.1:54321 00:00:34.306/INFO:recording.singlefile_57494.rec.:rtpp_stream_prefill_addr:685: pre-filling callee's RTCP address with 127.0.0.1:54322 00:00:34.306/DBUG:GLOBAL:rtpc_doreply:188: sending reply "44362\n" 00:00:34.306/DBUG:GLOBAL:rtpp_command_split:392: received command "Rs recording.singlefile_57494.rec. from_tag_1" 00:00:34.308/INFO:recording.singlefile_57494.rec.:handle_copy:68: starting recording RTP session on port 44362 00:00:34.309/INFO:recording.singlefile_57494.rec.:handle_copy:75: starting recording RTCP session on port 44363 00:00:34.309/DBUG:GLOBAL:rtpc_doreply:188: sending reply "0\n" 00:00:34.309/DBUG:GLOBAL:rtpp_command_split:392: received command "Rs recording.singlefile_57494.rec. to_tag_1" 00:00:34.309/INFO:GLOBAL:handle_command:588: record request failed: session recording.singlefile_57494.rec., tags to_tag_1/NONE not found 00:00:34.309/DBUG:GLOBAL:rtpc_doreply:188: sending reply "E50\n" 00:00:34.309/DBUG:GLOBAL:rtpp_command_split:392: received command "Rs recording.singlefile_57494.rec. to_tag_1 from_tag_1" 00:00:34.309/INFO:recording.singlefile_57494.rec.:handle_copy:75: starting recording RTCP session on port 44361 00:00:34.309/DBUG:GLOBAL:rtpc_doreply:188: sending reply "0\n" 00:00:34.309/DBUG:GLOBAL:rtpp_command_split:392: received command "N recording.singlefile_57494.rec. from_tag_1" 00:00:34.309/INFO:recording.singlefile_57494.rec.:handle_stop_record:68: stopping recording RTCP session on port 44363 00:00:34.309/INFO:recording.singlefile_57494.rec.:handle_stop_record:78: stopping recording RTP session on port 44362 00:00:34.309/DBUG:GLOBAL:rtpc_doreply:188: sending reply "0\n" 00:00:34.309/DBUG:GLOBAL:rtpp_command_split:392: received command "N recording.singlefile_57494.rec. to_tag_1 from_tag_1" Assertion failed: (spa->rtcp->stream[idx]->rrc != NULL), function handle_stop_record, file rtpp_command_norecord.c, line 66. Died on signal 6, obtained 10 stack frames.

0 0x800ebb946 in <pthread_sigmask+1334> at /lib/libthr.so.3

1 0x800ebaeb2 in <pthread_getspecific+3602> at /lib/libthr.so.3

2 0x7ffffffff003

3 0x80119f3b9 in <abort+73> at /lib/libc.so.7

4 0x80121e8e1 in <__assert+81> at /lib/libc.so.7

5 0x422eaf in <handle_norecord+463> at /usr/home/sobomax/projects/rtpproxy/tests/../src/rtpproxy_debug

6 0x416c5f in <rtpp_hash_table_ctor+2943> at /usr/home/sobomax/projects/rtpproxy/tests/../src/rtpproxy_debug

7 0x422d13 in <handle_norecord+51> at /usr/home/sobomax/projects/rtpproxy/tests/../src/rtpproxy_debug

8 0x40f967 in <handle_command+567> at /usr/home/sobomax/projects/rtpproxy/tests/../src/rtpproxy_debug

9 0x411eeb in <rtpp_command_async_ctor+3195> at /usr/home/sobomax/projects/rtpproxy/tests/../src/rtpproxy_debug

Abort trap (core dumped)

sobomax commented 4 years ago

@razvancrainea JFYI I've added some basic testing and it looks OK. You can see results here https://coveralls.io/jobs/59450312/source_files/1802592253 (all other tests are disabled for clarity sake). The SEGFAULT issue still pending.

razvancrainea commented 4 years ago

Hey, Maxim!

Thanks for taking time to look into this! I will take a look at the crash, trying to figure out what's happening. As soon as I figure it out, I will rebase against the new branch.

Best regards, Răzvan