Bit Warriors
Bit Warriors

Reputation: 23

FreePBX/Asterisk run script on call

I'm fighting with this : I would call a php-script (which query a db and release a result) when I receive a call. I tried a lot of solution around but seems I'm not able to apply.

What I did :

I defined a custom extension (extension_custom.conf)

[myscript]
exten => 200,1,Answer()
exten=> 200,1,System(echo "${DATETIME} - ${CALLERID} - ${CHANNEL}" >> /var/log/asterisk/calls)
exten => h,1,Hangup()

I used this only for example obviously I would change System into

exten=> 200,1,System(/path/to/myphpscript.php ${CALLERID})

Now the problem is : if I dial 200 from another extension i receive a "... call again later"

In which way I can execute the script on call (with or without answering)?

Thank you in advance ;-)

Upvotes: 1

Views: 3538

Answers (1)

arheops
arheops

Reputation: 15247

You forget change priority.

exten => 200,1,Answer()
exten => 200,2,System(echo "${DATETIME} - ${CALLERID} - ${CHANNEL}" >> /var/log/asterisk/calls)

Upvotes: 2

Related Questions