3

I'm trying to configure asterisk to execute shell command for incoming calls - but only when the call is accepted. I've managed to setup extensions.conf so that command is executed when new call comes in.

exten => 999999999,1,NoOp("----------mygroup---------------")
exten => 999999999,2,System(echo "1:${EXTEN} -  ${DATETIME} - ${CALLERID} - ${CHANNEL}" >> /var/log/asterisk/calls)
exten => 999999999,3,Dial(SIP/7001,20)

Is it possible to change it so that command is executed when operator connected to a SIP extension picks up the call. I need to know ID of the active operator and caller's number to execute the command.

1
  • 1
    Asterisk has built-in facilities for reading and writing files. An alternative to using System would be to use the FILE() function. For example, line 2 could be rewritten as Set(FILE(/var/log/asterisk/calls,,,a)=1:${EXTEN} - ${DATETIME} - ${CALLERID} - ${CHANNEL}). Feb 24, 2015 at 15:07

1 Answer 1

2

Take a look at the "M" option for the Dial command. Have the macro you trigger do whatever look-up you need to determine the the Operator info, and then run the System command from within the macro.

Further Reading:

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .