drachtio / drachtio-server

A SIP call processing server that can be controlled via nodejs applications
https://drachtio.org
MIT License
233 stars 90 forks source link

CDR stop event is not sent to srf app #342

Open spointer opened 5 months ago

spointer commented 5 months ago

Hello Dave,

When the UAC sends CANCEL SIP method quickly, CDR stop event is not emitted.

Drachtio-server sends the right 200 OK and 487(request terminated) but there is no CDR stop event.

Here is the drachtio logs(log level is not debug)

2024-02-14 15:06:00.857578 recv 1106 bytes from udp/[10.3.42.12]:5090 at 15:06:00.857479:
INVITE sip:211044@10.3.66.87:3417;transport=udp SIP/2.0
Via: SIP/2.0/UDP 10.3.42.12:5090;branch=z9hG4bK-524287-1---5ed83e6bbe998d761706197292
Max-Forwards: 70
Contact: <sip:1234@10.3.42.12:5090>
To: <sip:211044@test.com>
From: <sip:1234@test.com>;tag=997c2f7b
Call-ID: 000B228365CC584801F7_36648447941fd33f389c00321c8dc225
CSeq: 1 INVITE
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, INFO, MESSAGE, REFER, PRACK, NOTIFY, SUBSCRIBE
Content-Type: application/sdp
Date: Wed, 14 Feb 2024 06:06:00 GMT
User-Agent:  2.49.0.43
Referred-By: <sip:61107@10.3.3.10:5090;type=hunt;dnis=4321>
Allow-Events: talk, hold, conference, refer
Content-Length: 298

v=0
o=PBX 1707890760 1 IN IP4 10.3.42.12
s=SIP CALL
c=IN IP4 10.3.42.12
t=0 0
m=audio 18068 RTP/AVP 0 8 18 101
c=IN IP4 10.3.42.12
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:18 G729/8000
a=fmtp:18 annexb=no
a=rtpmap:101 telephone-event/8000
a=ptime:20
a=sendrecv 

2024-02-14 15:06:00.857715 send 303 bytes to udp/[10.3.42.12]:5090 at 15:06:00.857668:
SIP/2.0 100 Trying
Via: SIP/2.0/UDP 10.3.42.12:5090;branch=z9hG4bK-524287-1---5ed83e6bbe998d761706197292;rport=5090
From: <sip:1234@test.com>;tag=997c2f7b
To: <sip:211044@test.com>
Call-ID: 000B228365CC584801F7_36648447941fd33f389c00321c8dc225
CSeq: 1 INVITE
Content-Length: 0

2024-02-14 15:06:00.878093 recv 523 bytes from udp/[10.3.42.12]:5090 at 15:06:00.878053:
CANCEL sip:211044@10.3.66.87:3417;transport=udp SIP/2.0
Via: SIP/2.0/UDP 10.3.42.12:5090;branch=z9hG4bK-524287-1---5ed83e6bbe998d761706197292
Max-Forwards: 70
To: <sip:211044@test.com>
From: <sip:1234@test.com>;tag=997c2f7b
Call-ID: 000B228365CC584801F7_36648447941fd33f389c00321c8dc225
CSeq: 1 CANCEL
Date: Wed, 14 Feb 2024 06:06:00 GMT
User-Agent:  2.49.0.43
Content-Length: 0

2024-02-14 15:06:00.878126 received quick cancel for invite that is out to client for disposition: 000B228365CC584801F7_36648447941fd33f389c00321c8dc225
2024-02-14 15:06:00.878198 send 317 bytes to udp/[10.3.42.12]:5090 at 15:06:00.878161:
SIP/2.0 200 OK
Via: SIP/2.0/UDP 10.3.42.12:5090;branch=z9hG4bK-524287-1---5ed83e6bbe998d761706197292;rport=5090
From: <sip:1234@test.com>;tag=997c2f7b
To: <sip:211044@test.com>;tag=jUUNm6Dp2vgQB
Call-ID: 000B228365CC584801F7_36648447941fd33f389c00321c8dc225
CSeq: 1 CANCEL
Content-Length: 0

2024-02-14 15:06:00.878262 send 333 bytes to udp/[10.3.42.12]:5090 at 15:06:00.878241:
SIP/2.0 487 Request Terminated
Via: SIP/2.0/UDP 10.3.42.12:5090;branch=z9hG4bK-524287-1---5ed83e6bbe998d761706197292;rport=5090
From: <sip:1234@test.com>;tag=997c2f7b
To: <sip:211044@test.com>;tag=K4mep1ySZ569p
Call-ID: 000B228365CC584801F7_36648447941fd33f389c00321c8dc225
CSeq: 1 INVITE
Content-Length: 0

2024-02-14 15:06:00.880166 recv 363 bytes from udp/[10.3.42.12]:5090 at 15:06:00.880134:
ACK sip:211044@10.3.211.14:3365;transport=UDP SIP/2.0
Via: SIP/2.0/UDP 10.3.42.12:5090;branch=z9hG4bK-524287-1---5ed83e6bbe998d761706197292
Max-Forwards: 70
To: <sip:211044@test.com>;tag=K4mep1ySZ569p
From: <sip:1234@test.com>;tag=997c2f7b
Call-ID: 000B228365CC584801F7_36648447941fd33f389c00321c8dc225
CSeq: 1 ACK
Content-Length: 0

Log message "received quick cancel for invite that is out to client for disposition" gave me insight and i looked into the controller.cpp and then found there is no Cdr::postCdr( std::make_shared function call in that code.

How do you think?

Thank you.