[asterisk-users] Calls running forever / CDRs inaccurate

Markus universe at truemetal.org
Fri May 5 06:15:42 CDT 2023


Hi list!

Running Asterisk 20.0.0 on CentOS 7, logging CDRs using 
cdr_adaptive_odbc to mariadb-server-5.5.68 (via 
mariadb-connector-odbc-3.1.7-ga-rhel7)

Using chan_sip.

I'm facing the problem when there is a sudden spike of calls, some of 
the calls that are being made during those spikes hang forever 
basically. This looks like this:

[root at voip]# asterisk -rx 'core show channels verbose' |sort -r -k 9 | 
grep -v Outgoing

Channel              Context              Extension        Prio State 
Application  Data                      CallerID        Duration 
Accountcode PeerAccount BridgeID
SIP/customer01 customer-voipin 49xxxxxxx         26 Ring    Dial 
SIP/+49xxxxxxx at provider    49xxxxxxxx    12:49:05

So, the longest currently active call is in state "Ringing" for 12 hours 
49 minutes.

It could be also that a call is in state "Up" for an arbitrary duration 
(10, 15, 20+ hours). A cron script is restarting Asterisk every night, 
and this is the moment these calls are cleared, otherwise they'd 
hang/run forever.

Now, the problem is, that this is causing a billing discrepancy. I've 
had calls with billsec 20+ hours and state "Up" in the CDRs. The 
termination providers (there are multiple) are ending the calls after 
max. 120 minutes, so the issue is not there but in the local Asterisk.

Any recommendations on how I could debug, or even fix, this?

Maybe a workaround to help with the billing discrepancy?

In theory, if I set TIMEOUT(absolute) to maybe 2 hours and 2 minutes, I 
could find and delete those ghost calls in the CDRs at the end of the 
month, before sending the invoice to the customer, but that's not a good 
solution either (because losing money). But maybe still better than 
overcharging the customer thousands of minutes?! :)

This behavior happens every day on approx. 5-200 calls. (At the end of a 
day I could have 200 hanging/ghost calls).

Help! :)

Lastly, a "core show channel" on a hanging call, obfuscated:

[root at voip asterisk]# asterisk -rx 'core show channel 
SIP/customer01-0000dfa4'
  -- General --
            Name: SIP/customer01-0000dfa4
            Type: SIP
        UniqueID: voip-1683277216.81923
        LinkedID: voip-1683277216.81923
       Caller ID: 49xxxxxxxxxx
  Caller ID Name: (N/A)
Connected Line ID: (N/A)
Connected Line ID Name: (N/A)
Eff. Connected Line ID: (N/A)
Eff. Connected Line ID Name: (N/A)
     DNID Digits: 49xxxxxxxxx
        Language: en
           State: Ring (4)
   NativeFormats: (alaw)
     WriteFormat: alaw
      ReadFormat: alaw
  WriteTranscode: No
   ReadTranscode: No
  Time to Hangup: 0
    Elapsed Time: 13h4m11s
       Bridge ID: (Not bridged)
  --   PBX   --
         Context: customer-voipin
       Extension: 49xxxxxxxxx
        Priority: 26
      Call Group: 0
    Pickup Group: 0
     Application: Dial
            Data: SIP/+49xxxxxxxx at provider
  Call Identifer: [C-000085c3]
       Variables:
PROGRESSTIME_MS=
PROGRESSTIME=
RINGTIME_MS=
RINGTIME=
DIALEDTIME_MS=
DIALEDTIME=
ANSWEREDTIME_MS=
ANSWEREDTIME=
DIALEDPEERNAME=
DIALEDPEERNUMBER=
DIALSTATUS=
SIPADDHEADER02=X-Something: something
AUTO_MONITOR=wav,/var/spool/asterisk/monitor/20230505110016-customer-DE-EXTEN-49xxxxxxx-CLINUM-49xxxxxxxxx-CLINAME--PAICLEAN--CLICLEAN-49xxxxxxxxx-OCLINUM--OCLINAME-,mX
MONITOR_EXEC=/var/lib/asterisk/2wav2mp3.sh
CALLFILENAME=20230505110016-customer-DE-EXTEN-49xxxxxxx-CLINUM-49xxxxxxxx-CLINAME--PAICLEAN--CLICLEAN-49xxxxxxxxxx-OCLINUM--OCLINAME-
SIPADDHEADER01=P-Asserted-Identity: <sip:+49xxxxxxxx at x.x.x.x>
CLICLEAN=49xxxxxxxxxx
CLILEN=12
SIPCALLID=85b9164eeb2211eda29c008cfa0447f8 at x.x.x.x
SIPDOMAIN=x.x.x.x
SIPURI=sip:49xxxxxxxxx at x.x.x.x:5061
   CDR Variables:
level 1: customer=customer
level 1: country=DE
level 1: dnid=49xxxxxxxx
level 1: clid="" <49xxxxxxxxx>
level 1: src=49xxxxxxxx
level 1: dst=49xxxxxxxx
level 1: dcontext=customer-voipin
level 1: channel=SIP/customer01-0000dfa4
level 1: dstchannel=SIP/provider-0000dfa6
level 1: lastapp=Dial
level 1: lastdata=SIP/+49xxxxxxxx at provider
level 1: start=1683277216.169426
level 1: answer=0.000000
level 1: end=0.000000
level 1: duration=47051
level 1: billsec=0
level 1: disposition=1
level 1: amaflags=3
level 1: uniqueid=voip-1683277216.81923
level 1: linkedid=voip-1683277216.81923
level 1: sequence=64906

  -- Streams --
Name: audio-0
     Type: audio
     State: sendrecv0
     Group: -1
     Formats: (alaw)
     Metadata:

Thank you!
Markus



More information about the asterisk-users mailing list