Which side hanged up the call , caller or calle?

Hello,

Is there a possibility to know for sure which side hanged up the call without using the Dial command?

Consider the following dialplan, is there a way I can use in the hangup exten to know for sure which side hanged up ?

[my_context]
exten =>_X.,1,NoOp(${PJSIP_HEADER(read,To)})
exten =>_X.,n,Set(FirstTo=${CUT(PJSIP_HEADER(read,To),:,2)})
exten =>_X.,n,Set(TO_DID=${CUT(FirstTo,@,1)})
exten =>_X.,n,GotoIf($[“${EXTEN}” != “${TO_DID}” ]?multiple-uri,${TO_DID},1:continue)
exten =>_X.,n(continue),NoOp(${EXTEN})
exten =>_X.,n,GotoIf($[$[“${CALLERID(num)}” = " “] & $[”${CALLERID(name)}" = " “]]?end)
exten =>_X.,n,Set(client_number=${CALLERID(num)})
exten =>_X.,n,AGI(my_agi/translation_first_check.agi,${client_number})
exten =>_X.,n,Set(First_check=${first_ani})
exten =>_X.,n,Set(random=${RAND(500,1500)});
exten =>_X.,n,Set(wait_sec=${MATH(${random}/1000,float)})
exten =>_X.,n,Wait(${wait_sec})
exten =>_X.,n,AGI(my_agi/translation_second_check.agi,${client_number})
exten =>_X.,n,Set(ani=${ani})
exten =>_X.,n,Set(number_dialed=${EXTEN})
exten =>_X.,n,Set(tipo_chiam=PreInbound)
exten =>_X.,n,AGI(my_agi/dnc_check_number.agi,${client_number})
exten =>_X.,n,Set(dnc_client=${dnc_number})
exten =>_X.,n,GotoIf($[”${dnc_client}" = “${client_number}” ]?mbylle:vazhdo)
exten =>_X.,n(mbylle),Hangup()
exten =>_X.,n(vazhdo),AGI(agi-DID_route.agi)
exten =>_X.,n,Hangup()
exten =>_X.,n(end),Hangup()

; FastAGI for VICIDIAL/astGUIclient call logging
exten => h,1,Set(mbyllje_telefonate=Mbyllje Error Agi DID Route)
exten => h,n,GotoIf($[“${dnc_client}” != “bosh” ]?end:continue)
exten => h,n(continue),AGI(my_agi/call_log_check.agi,${ani})
exten => h,n,Set(check_result=${final_result})
exten => h,n,GotoIf($[“${check_result}” = “not_exists” ]?mbylle:vazhdo)
exten => h,n(vazhdo),AGI(my_agi/send_data_inb_vicidial_did_route_error.agi,${UNIQUEID}–${DIALSTATUS}–${ANSWEREDTIME}–${tipo_chiam}–${number_dialed}–${ani}–${client_number})
exten => h,n(mbylle),Hangup()
exten => h,n(end),Hangup()

I have used exten => h,n,AGI(agi://127.0.0.1:4577/call_log–HVcauses–PRI-----NODEBUG-----${HANGUPCAUSE}-----${DIALSTATUS}-----${DIALEDTIME}-----${ANSWEREDTIME}-----${HANGUPCAUSE(${HANGUPCAUSE_KEYS()},tech)}))

but in most cases it throws the following warning

func_hangupcause.c:138 hangupcause_read: Unable to find information for channel

Asterisk Version: Asterisk 16.29.0-vici

There aren’t two channels involved in the given dialplan. The channel that hung up would be the channel running the dialplan.

You are right, I didn’t properly explained the issue.
In the following example agi-DID_route.agi returned 4 .
Is there a possibility to know if it was because the caller hanged up ?

[2023-03-10 09:25:55] VERBOSE[17914][C-00009927] pbx.c: Executing [xxxxxxxxxx@my_context:26] AGI("PJSIP/cdesign-000046ec", "agi-DID_route.agi") in new stack
[2023-03-10 09:25:55] VERBOSE[17914][C-00009927] res_agi.c: Launched AGI Script /usr/share/asterisk/agi-bin/agi-DID_route.agi
[2023-03-10 09:25:55] VERBOSE[17914][C-00009927] res_agi.c: AGI Script Executing Application: (Monitor) Options: (wav,/var/spool/asterisk/monitor/MIX/20230310092555_xxxxxxxxx_xxxxxxxx)
[2023-03-10 09:25:55] VERBOSE[17914][C-00009927] res_agi.c: <PJSIP/cdesign-000046ec>AGI Script agi-DID_route.agi completed, returning 4
[2023-03-10 09:25:55] VERBOSE[17914][C-00009927] pbx.c: Spawn extension (my_context, xxxxxxxxxxxx, 26) exited non-zero on 'PJSIP/cdesign-000046ec'
[2023-03-10 09:25:55] VERBOSE[17914][C-00009927] pbx.c: Executing [h@my_context:1] Set("PJSIP/cdesign-000046ec", "mbyllje_telefonate=Mbyllje Error Agi DID Route IT") in new stack
[2023-03-10 09:25:55] VERBOSE[17914][C-00009927] pbx.c: Executing [h@my_context:2] GotoIf("PJSIP/cdesign-000046ec", "0?end:continue") in new stack
[2023-03-10 09:25:55] VERBOSE[17914][C-00009927] pbx_builtins.c: Goto (my_context,h,3)

From a CDR point of view, I think only the AGI script knows that, and it seems like it isn’t telling. You would need to modify the script to set a channel variable to indicate the reason for the hangup. I’ve forgotten whether CEL gives any more detail.

When debugging, I would enable protocol logging, but interpretation is then manual.

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