(ASK) Execute php script after caller hangup

Hi,
Is it possible to automatically execute a php script after the external caller hangup the phone?

the php script will need the caller’s caller ID as a parameter, is it possible?

Where should I start?

Thanks :slight_smile:

bump

bump

bump

t the time a call is ending, asterisk executes a macro called [macro-hangupcall] which also includes a [macro-hangupcall-custom].

This is the point to inject any custom script, something like this:

exten => s,1,System(echo “Call Ended at ${STRFTIME(,%c)} to ${CALLERID(num)}” >> /var/spool/asterisk/tmp/callended.log)

which pretty much logs a completed call into a text file. Something similar would also work with starting a php script and change pass other variables.

keep in mind: always backup you system before working with the dialplans :slight_smile:

I’m looking for the same thing, but nbsberlin mentioned will not work, sincs there’s already s,1 in [macro-hangupcall], so the included context will not be executed ( see asterisk documentation about include ).

Yes. Technically. You can copy the entire macro-hangupcall context into /etc/asterisk/extensions_override_freepbx.conf and make changes there.

Keep in mind you need to update your context when any changes are made to the core freepbx files otherwise you may run into unusual problems. We never update because there has not been any new functionality we care about. From a security perspective we moved /admin/, use IP authentication and only connect via VPN. Occasionally we run into some strange php 5.3 problems but we work around them.

*Information supplied here is as-is with no express or implied warranty. This thread is posted by myself and is not representative of the advice or opinion of the company that pays my salary.