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

DTMF RFC2833 lost #64

Closed
fbrendel opened this issue Jun 29, 2023 · 14 comments
Closed

DTMF RFC2833 lost #64

fbrendel opened this issue Jun 29, 2023 · 14 comments

Comments

@fbrendel
Copy link

Net::SIP::DTMF reports lost packets when I try to send DTMF events via User-Agent: OpenScape Business telephone system that supports RFC2833 for DTMF events only.

Net::SIP::Debug

1688022804.0215 DEBUG:<50> Net::SIP::Dispatcher::Eventloop::loop[220]: call cb on fn=4 rw=0 rtp_receive
1688022804.0215 DEBUG:<50> Net::SIP::Simple::RTP::_receive_rtp[256]: received 172 bytes from RTP
1688022804.0216 DEBUG:<100> Net::SIP::Simple::RTP::_receive_rtp[285]: ch=0 payload=95/160 pt=8 xh=0 padding=0 cc=0
1688022804.0216 DEBUG:<30> Net::SIP::DTMF::__ANON__[100]: lost 1 packets (94-94)

RTP captured by Wireshark

Real-Time Transport Protocol
    [Stream setup by SDP (frame 6)]
        [Setup frame: 6]
        [Setup Method: SDP]
        [Generated Call-ID: b641850bb43beaa5]
    10.. .... = Version: RFC 1889 Version (2)
    ..0. .... = Padding: False
    ...0 .... = Extension: False
    .... 0000 = Contributing source identifiers count: 0
    0... .... = Marker: False
    Payload type: telephone-event (101)
    Sequence number: 193
    [Extended sequence number: 65729]
    Timestamp: 46400
    Synchronization Source identifier: 0xa1984e12 (2711113234)
RFC 2833 RTP Event
    Event ID: DTMF Pound # (11)
    1... .... = End of Event: True
    .0.. .... = Reserved: False
    ..00 1000 = Volume: 8
    Event Duration: 1280

Net::SIP::Simple

$UA->listen(
   init_media => $UA->rtp( 'send_recv', 'sound.wav'),
   rtp_param => [8, 160, 160/8000, 'PCMA/8000'],
   recv_bye => \$hangup_peer,
   cb_dtmf => sub { push @Events, shift;},
   dtmf_methods => 'rfc2833'
);

A test with Twinkle as SIP endpoint works fine whereby all DTMF events were recognized.
Net::SIP::VERSION is 0.835.
Perl is 5.32.1

@noxxi
Copy link
Owner

noxxi commented Jun 29, 2023

What you show is only a debug message and does not indicate any actual problems. It is perfectly normal that there might be packet loss with UDP and Twinkle likely does not even report it in the first place. It would be a problem if there is actually a loss in the transmitted information (i.e. wrong DTMF sequence) but there is no indication of such a problem in your question.

@noxxi noxxi closed this as completed Jun 29, 2023
@fbrendel
Copy link
Author

Ups, my bad.
I forgot to mention that I never get these DTMF events in @Events.

@noxxi
Copy link
Owner

noxxi commented Jun 29, 2023

In this case please provide a full packet capture (pcap file, not text or image) from what you observe with the failing code and what you observe with the working code (Twinkle) so that one can detect the differences. And also provide all information to reproduce the issue, i.e. the full code and a detailed description of the setup.

@noxxi noxxi reopened this Jun 29, 2023
@fbrendel
Copy link
Author

fbrendel commented Jun 29, 2023

The pcap files:
net-sip.pcapng (failed)
twinkle.pcapng (works)

The code:

#!/usr/bin/perl

use strict;
use warnings;
use Net::SIP;
use Net::SIP::Debug qw( Net::SIP*=3 Registrar=1 );

my $UA = Net::SIP::Simple->new(
   from => '375',
   outgoing_proxy => '10.2.60.110:5060',
   registrar => '10.2.60.110:5060',
   domain => '10.2.60.110:5060',
   auth => [ 'xxx', 'xxx']
);
$UA->register(expires => 1800);
if($UA->error){ die $UA->error();}

my $RTPDone;
my $HangupPeer;
my $DTMFDone;
my $TimerTimeout;

my $DTMF = '';
my $DTMFCallback = sub {
   my ($Event, $Duration) = @_;
   $DTMF .= $Event;
   if($Event eq '#'){ $DTMFDone = 1;}
};

$UA->listen(
   init_media => $UA->rtp( 'send_recv', 'blindtext.wav'),
   rtp_param => [8, 160, 160/8000, 'PCMA/8000'],
   cb_rtp_done => \$RTPDone,
   recv_bye => \$HangupPeer,
   cb_dtmf => $DTMFCallback,
   ring_time => 45
);

$UA->add_timer(60, \$TimerTimeout);
$UA->loop(undef, \$RTPDone, \$HangupPeer, \$DTMFDone, \$TimerTimeout);
print "DTMF: $DTMF\n";

It works with 1und1 but not with our telephone system whereas Twinkle does.
Regarding the setup there is nothing special.
Connection to 1und1 is made per DSL and to the telephone sytem via LAN.
Twinkle and the perl script run on the same machine.

@noxxi
Copy link
Owner

noxxi commented Jun 29, 2023

Thanks for the details. Since you already have the code with debug running - code you please share the full debug output for a failing connection with at least debug level 40?

@fbrendel
Copy link
Author

Here is the link to the log with debug level 40.
net-sip.log

@noxxi
Copy link
Owner

noxxi commented Jul 2, 2023

I cannot reproduce the issue when replaying the pcap data from the client in some test. It perfectly detects the DMTF sequence. Could you please rerun the test with debug level to 100, ideally with the version from 89f63b0 which adds more detailed debug output.

@fbrendel
Copy link
Author

fbrendel commented Jul 4, 2023

I'm on vacation this week, so I won't be able to test it until Monday.
I'll get back to you with the results then.

@fbrendel
Copy link
Author

New log with debug level 100:
net-sip.log

@noxxi
Copy link
Owner

noxxi commented Jul 10, 2023

New log with debug level 100: net-sip.log

Thanks. Looks like I still need more debug info to understand why it fails. Could you please use 257f4d9 which adds more debugging to DTMF handling and create another log with debug level 100?

@fbrendel
Copy link
Author

The new debug message doesn't appear in the output.
Do you still need the log?

@noxxi
Copy link
Owner

noxxi commented Jul 12, 2023

I think I've found the bug. Please check if ed072bb fixes the problem.

@fbrendel
Copy link
Author

It works now.
Thank you! 😃

But make test throws a lot of errors now.

Files=27, Tests=1347, 398 wallclock secs ( 0.47 usr  0.05 sys + 76.61 cusr  3.52 csys = 80.65 CPU)
Result: FAIL
Failed 7/27 test programs. 13/1347 subtests failed.
make: *** [Makefile:979: test_dynamic] Fehler 255

see net-sip_test.log

@noxxi
Copy link
Owner

noxxi commented Jul 12, 2023

This fallout from the test is fixed. I've released a new Net::SIP version 0.836 which should fix your problem and pass all tests.

@noxxi noxxi closed this as completed Jul 12, 2023
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

2 participants