Is there a way to modify the “macro-hangupcall” with a module? I can’t seem to find documentation on this. Basically what I am looking to do is to hook into this and send an email after a call is hung up. I have found the dial plan code that is supposed to send the email after a hangup a forum post but I can’t post the link because I am a new user so below is the snippet. I basically just want to modularize this instead of creating adding the code below inside of the extensions_custom.conf file
[macro-hangupcall-custom]
exten => s,1,DumpChan()
exten => s,n,System(echo ‘Call from ${CALLERID(name)} at ${CALLERID(number)}’ | mail -s ‘SUBJECT’ ‘[email protected]’)
exten => s,n,MacroExit()
Would you be able to provide a snippet of the FreePBX module PHP code required to start off with something like this? The post you linked describes how to manually add it to a file but I am looking to do this with a module so no files have to be manually edited. I am not finding any documentation on how to create these contexts using the provided FreePBX PHP API. I have the module skeleton started already, I assume I would add the code inside of the “doDialPlanHook” method of my module class?
I have figured how how to add these to the dialplan using a php module. However the hook only seems to get called after calling an extension. I can confirm this by looking at the description inside of extensions.conf. Is there a hook I can use that will execute after any agent hangs up, regardless if they received a call from a queue, direct extension dial or outbound call?