Run script when ext rings

Apparently my asterisk skills are weak. I want to run a script whenever an extension rings. Eventually this will be a php script. The end goal is to send CallerID info to RocketChat.

For testing I tried (among a few other things):


exten=> s,1,System(echo “${DATETIME} - ${CALLERID} - ${CHANNEL}” >> /var/log/asterisk/rc-tests)

freepbx.x86_64 14.1-1.sng7
Asterisk 13.38.1

The conversion to PJSip will happen along with upgrade to 16/18 in the coming months.

Any assistance would be appreciated.

What endpoint are you using? Many (most?) brands have an action URL setting for various events.

The variable will depend on the brand, for Yealink it is $callerID so your URL would be something like this:$callerID
Yealink only accepts responses as XML files, so make sure your PHP outputs a response back to the phone (if any) in XML.


Most of the phones are sagnoma S500 and S505, and they do support action URLs. Will have to take a look at that.

That might work, Thanks

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