Custom context

How to add custom action on hangup ?
I have read This post
and I did exactly like there:
I have added custom context with same name in extensions_custom.conf and when I call my curl request is not working
Do I need to do something else ?

[macro-dialout-one-predial-hook]
exten => _.,1,Noop(Entering user defined context macro-dialout-one-predial-hook in extensions_custom.conf)
exten => s,n,Set(CHANNEL(hangup_handler_push)=lgaetz-do-this-on-hangup,s,n)
[lgaetz-do-this-on-hangup]
exten => s,1,Noop(Entering user defined context lgaetz-do-this-on-hangup in extensions_custom.conf)
exten => s,n,System(curl URL)
exten => s,n,Return

did you remember the:
exten => s,n,MacroExit

A debug will show what is happening on the call.
Providing Great Debug - Support Services - Documentation (freepbx.org)

Thats the stuff I get if I just copy paste it, I mostly get it on every macros I try to use

1067250 [2023-06-22 13:58:14] WARNING[3617660] pbx.c: Unable to register extension ‘s’ priority 1 in ‘macro-dialout-one-predial-hook’, already in use

If I add some already existing macros to overide file they just don’t executere

More detail on my problem, maybe I’m not explaining good enough

I want to send by curl name of the record what is saved on asterisk side, and it is working
If I add something like this to extensions_additional.conf in context [sub-record-check] this will work :

exten => recordcheck,n,Set(CHANNEL(hangup_handler_push)=lgaetz-do-this-on-hangup,s,n)

after autogenerated code

exten => recordcheck,n,Set(__CALLFILENAME.....)

But it will be reseted if someone will update something in freepbx panel, so… I’m looking for a way to make it work in extensions_custom.conf, or maybe in extensions_override_freepbx.conf

  1. In extensions_custom.conf put:
[macro-dialout-one-predial-hook]
exten => s,1,Noop(Entering user defined context macro-dialout-one-predial-hook in extensions_custom.conf)
exten => s,n,Set(CHANNEL(hangup_handler_push)=lgaetz-do-this-on-hangup,s,1)
exten => s,n,MacroExit

[lgaetz-do-this-on-hangup]
exten => s,1,Noop(Entering user defined context lgaetz-do-this-on-hangup in extensions_custom.conf)
exten => s,n,**YOURDIALPLANHERE**
exten => s,n,**YOURDIALPLANHERE**
exten => s,n,**YOURDIALPLANHERE**
exten => s,n,Return
  1. Share your full dialplan in [lgaetz-do-this-on-hangup]

  2. Provide a debug on a test call so we can see what happens (if it does not work) Providing Great Debug - Support Services - Documentation

[macro-dialout-trunk-predial-hook]
exten => s,1,Verbose(DONE)
exten => s,n,Set(CHANNEL(hangup_handler_push)=send-filename,s,1(${EXTEN},${CALL>
exten => s,n,Verbose(DONE2)
exten => s,n,MacroExit()

[send-filename]
exten => s,1,Verbose(${CDR(recordingfile)})
exten => s,n,Set(__CURL_DATA=–data-urlencode “filename=${ARG1}” --data-urlenco>
exten => s,n,System(curl URL)
exten => s,n,Return()
exten => s,n,MacroExit()

This one have worked for me, but can I ask one more question ?
How to get the filename what is saved in sub-record-check ?
CDR is not working and it is not realy my asterisk server, can you give me an advice please ?

the result would of ${CURL_DATA} would house the filename, yes?

yes it would, I kind of got how to do it, but I still dont have CDR working which is weird

CDR, as in nothing is showing up inside the Reports → CDR Reports?

Maybe you are running into this:

https://community.freepbx.org/t/no-cdr-reports-output-generation-after-freepbx-update-to-16-0-40-3/

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