Your ads will be inserted here by

Easy Plugin for AdSense.

Please go to the plugin admin page to
Paste your ad code OR
Suppress this ad slot.

Asterisk Log, Asterisk If Else then conditions, Asterisk System command

//Setting Callerid To Caller Name
//This will work if we have entires in Asterisk DB
//can be found under *CLI> database show cidname
exten=> _.,n,Set(CALLERID(name)=${DB(cidname/${CALLERID(num)})})

// If else with extension “Asterisk”
exten=> _.,n,Set(foo=${IF($[ ${CALLERID(dnid)} = 44111111111]?customer_a:${IF($[ ${CALLERID(dnid)} = 4422222222]?Customer_b:Customer_c)})})

//This can also be achieved by noop
//Logging or Echo Variable
exten=> _.,n,Log(NOTICE, “Callerid TO: ${CALLERID(to)}”)

//Running Command from dialplan Asterisk (Bash)
exten=> _.,n,System(/etc/asterisk/my_script.sh)

Sample:

Pre-Routing: conditional messaging.

Your ads will be inserted here by

Easy Plugin for AdSense.

Please go to the plugin admin page to
Paste your ad code OR
Suppress this ad slot.

[context]

exten=> _.,1,NoOp(Incoming Call)

exten=> _.,n,Set(CALLERID(name)=${DB(cidname/${CALLERID(num)})})

exten=> _.,n,Set(foo=${IF($[ ${CALLERID(dnid)} = 012345678]?Client1:${IF($[ ${CALLERID(dnid)} = 234567]?Client2:Client3)})})
exten=> _.,n,Set(bar=${IF($[ ${CALLERID(dnid)} = 45464554645]?SomeOne:${IF($[ ${CALLERID(dnid)} = 4654758]?SomeTwo:SomeThree)})})

exten=> _.,n,Log(NOTICE, “Callerid TO: ${CALLERID(to)}”)

exten=> _.,n,System(/etc/asterisk/sendim.sh ${bar} ‘There is an Incoming call From ${CALLERID(name)} Caller Id: ${CALLERID(num)} n Customer try
ing to reach ${foo}’)

exten=> _.,n,NoOp(Sending to PSTN Now)
exten=> _.,n,goto(from-pstn,${EXTEN},1)