Run script when ext rings


(Jordack) #1

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):

extensions_custom.conf

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

freepbx.x86_64 14.1-1.sng7
Asterisk 13.38.1
Chan_SIP

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

Any assistance would be appreciated.


(Jared Busch) #2

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:
https://webserver.domain.com/cid2rc.php?CID=$callerID
Yealink only accepts responses as XML files, so make sure your PHP outputs a response back to the phone (if any) in XML.


(Jordack) #3

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


(system) closed #4

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