Strange behavior DAHDI E1 call termination

Hi! I wanted to summarize and understand the specific work of dahdi

photo_2023-10-12_10-31-00

We have a problem sending RELEALSE COMPLETE to a neighbor, logically he should end the call, correct me if he is wrong, but in response he sends us a new SETUP, which leads to a new call If in simple words it looks like this.

  • A customer is calling us
  • We’re talking
  • We’re hanging up

Instead of ending the call, we immediately receive a call from the same client, i.e. we can’t hang up :slight_smile:

There is a last two message

PRI Span: 2 > Message Type: RELEASE COMPLETE (90)
PRI Span: 2 > [08 02 81 90]
PRI Span: 2 > Cause (len= 4) [ Ext: 1  Coding: CCITT (ITU) standard (0)  Spare: 0  Location: Private network serving the local user (1)
PRI Span: 2 >                  Ext: 1  Cause: Normal Clearing (16), class = Normal Event (1) ]
PRI Span: 2 -- Stopping T203 timer
PRI Span: 2 -- Starting T200 timer
PRI Span: 2 q931.c:7332 q931_hangup: Hangup other cref:3449
PRI Span: 2 q931.c:7089 __q931_hangup: ourstate Null, peerstate Null, hold-state Idle
PRI Span: 2 Destroying call 0x7f3dec02d530, ourstate Null, peerstate Null, hold-state Idle
PRI Span: 2 
PRI Span: 2 < TEI: 0 State 7(Multi-frame established)
PRI Span: 2 < V(A)=62, V(S)=63, V(R)=58
PRI Span: 2 < K=7, RC=0, l3_initiated=0, reject_except=0, ack_pend=0
PRI Span: 2 < T200_id=16384, N200=3, T203_id=0
PRI Span: 2 < [ 00 01 01 7e ]
PRI Span: 2 < Supervisory frame:
PRI Span: 2 < SAPI: 00  C/R: 0 EA: 0
PRI Span: 2 <  TEI: 000        EA: 1
PRI Span: 2 < Zero: 0     S: 0 01: 1  [ RR (receive ready) ]
PRI Span: 2 < N(R): 063 P/F: 0
PRI Span: 2 < 0 bytes of data
PRI Span: 2 -- Got ACK for N(S)=62 to (but not including) N(S)=63
PRI Span: 2 -- ACKing N(S)=62, tx_queue head is N(S)=-1 (-1 is empty, -2 is not transmitted)
PRI Span: 2 -- Stopping T200 timer
PRI Span: 2 -- Starting T203 timer
PRI Span: 2 Done handling message for SAPI/TEI=0/0
PRI Span: 3 
PRI Span: 3 < TEI: 0 State 7(Multi-frame established)
PRI Span: 3 < V(A)=13, V(S)=13, V(R)=35
PRI Span: 3 < K=7, RC=0, l3_initiated=0, reject_except=0, ack_pend=0
PRI Span: 3 < T200_id=0, N200=3, T203_id=24576
PRI Span: 3 < [ 02 01 46 1a 08 02 0d 7a 05 a1 04 03 80 90 a3 18 03 a1 83 8e 6c 0b 21 81 39 33 33 39 30 30 31 31 37 70 0a c1 37 31 32 30 35 38 38 33 33 ]
PRI Span: 3 < Informational frame:
PRI Span: 3 < SAPI: 00  C/R: 1 EA: 0
PRI Span: 3 <  TEI: 000        EA: 1
PRI Span: 3 < N(S): 035   0: 0
PRI Span: 3 < N(R): 013   P: 0
PRI Span: 3 < 41 bytes of data
PRI Span: 3 < Protocol Discriminator: Q.931 (8)  len=41
PRI Span: 3 < TEI=0 Call Ref: len= 2 (reference 3450/0xD7A) (Sent from originator)
PRI Span: 3 < Message Type: SETUP (5)
PRI Span: 3 < [a1]
PRI Span: 3 < Sending Complete (len= 1)
PRI Span: 3 < [04 03 80 90 a3]
PRI Span: 3 < Bearer Capability (len= 5) [ Ext: 1  Coding-Std: 0  Info transfer capability: Speech (0)
PRI Span: 3 <                              Ext: 1  Trans mode/rate: 64kbps, circuit-mode (16)
PRI Span: 3 <                                User information layer 1: A-Law (35)
PRI Span: 3 < [18 03 a1 83 8e]
PRI Span: 3 < Channel ID (len= 5) [ Ext: 1  IntID: Implicit  Other(PRI)  Spare: 0  Preferred  Dchan: 0
PRI Span: 3 <                       ChanSel: As indicated in following octets
PRI Span: 3 <                       Ext: 1  Coding: 0  Number Specified  Channel Type: 3
PRI Span: 3 <                       Ext: 1  Channel: 14 Type: CPE]
PRI Span: 3 < [6c 0b 21 81 39 33 33 39 30 30 31 31 37]
PRI Span: 3 < Calling Party Number (len=13) [ Ext: 0  TON: National Number (2)  NPI: ISDN/Telephony Numbering Plan (E.164/E.163) (1)
PRI Span: 3 <                                 Presentation: Presentation allowed, User-provided, verified and passed (1)  '933900117' ]
PRI Span: 3 < [70 0a c1 37 31 32 30 35 38 38 33 33]
PRI Span: 3 < Called Party Number (len=12) [ Ext: 1  TON: Subscriber Number (4)  NPI: ISDN/Telephony Numbering Plan (E.164/E.163) (1)  '712058833' ]
PRI Span: 3 -- Got ACK for N(S)=13 to (but not including) N(S)=13
PRI Span: 3 -- T200 requested to stop when not started
PRI Span: 3 T203 requested to start without stopping first
PRI Span: 3 -- Starting T203 timer
PRI Span: 3 -- Making new call for cref 3450
PRI Span: 3 Received message for call 0x7f3df00196b0 on link 0x5561b9714270 TEI/SAPI 0/0
PRI Span: 3 -- Processing Q.931 Call Setup
PRI Span: 3 -- Processing IE 161 (cs0, Sending Complete)
PRI Span: 3 -- Processing IE 4 (cs0, Bearer Capability)
PRI Span: 3 -- Processing IE 24 (cs0, Channel ID)
PRI Span: 3 -- Processing IE 108 (cs0, Calling Party Number)
PRI Span: 3 -- Processing IE 112 (cs0, Called Party Number)
PRI Span: 3 q931.c:8894 post_handle_q931_message: Call 3450 enters state 6 (Call Present).  Hold state: Idle
PRI Span: 3 
PRI Span: 3 > TEI: 0 State 7(Multi-frame established)
PRI Span: 3 > V(A)=13, V(S)=13, V(R)=36
PRI Span: 3 > K=7, RC=0, l3_initiated=0, reject_except=0, ack_pend=0
PRI Span: 3 > T200_id=0, N200=3, T203_id=24576
PRI Span: 3 > [ 02 01 01 48 ]
PRI Span: 3 > Supervisory frame:
PRI Span: 3 > SAPI: 00  C/R: 1 EA: 0
PRI Span: 3 >  TEI: 000        EA: 1
PRI Span: 3 > Zero: 0     S: 0 01: 1  [ RR (receive ready) ]
PRI Span: 3 > N(R): 036 P/F: 0
PRI Span: 3 > 0 bytes of data
PRI Span: 3 Done handling message for SAPI/TEI=0/0
Span 3: Processing event PRI_EVENT_RING(5)
PRI Span: 3 q931.c:5881 q931_call_proceeding: Call 3450 enters state 9 (Incoming Call Proceeding).  Hold state: Idle
PRI Span: 3 
PRI Span: 3 > DL-DATA request
PRI Span: 3 > Protocol Discriminator: Q.931 (8)  len=10
PRI Span: 3 > TEI=0 Call Ref: len= 2 (reference 3450/0xD7A) (Sent to originator)

There is full log:
pri-dump-202310.txt (33.0 KB)

The call is coming in on Span 2, gets hung up, then comes in on Span 3 ?

That’s two separate calls. The client mis-configured their equipment. They might have something like this in their dialplan:

[muh-bad-dial-out]
exten = _X.,1,Dial(DAHDI/g1/${EXTEN},,g) ; using 'g' to go on if remote hangs up
 same = n,Dial(DAHDI/g2/${EXTEN})

When they should have something more like:

[muh-good-dial-out]
exten = _X.,1,Dial(DAHDI/g1/${EXTEN},,g)
 same = n,GotoIf($["${DIALSTATUS}"="ANSWERED"]?hup) ; critical part
 same = n,Dial(DAHDI/g2/${EXTEN})
 same = n(hup),Hangup()

You could thwart their retries in your dialplan, adding some hangup handlers that store their caller ID & destination combination with a timestamp in to the internal Asterisk DB, then on the next incoming call (which looks like a brand new call to you) check the time difference and if too short then redirect them to Congestion() application.

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.