[HOW TO] Get an SMS with CID when a call is received but we are out of office (chan_mobile)

To get an SMS with CID when someone is calling us but we are out of office.

In this example the call is redirect to the voicemail but you can choose any other destination you prefere.

You need chan_mobile installed and connected to a cellphone capable of sending SMS.

Edit /etc/asterisk/extensions_custom.conf:

exten => xx,1,Answer
exten => xx,2,MobileSendSMS(device,numbertosendsms,call received from:${CALLERID(all)} at ${STRFTIME(${EPOCH},%d:%m:%Y - %H:%M:%S)} from channel ${CHANNEL})
exten => xx,3,Voicemail(number)
exten => xx,4,Hangup

change ‘xx’, ‘device’, ‘numbertosendsms’ based on your configuration and numbers,
then save and restart asterisk (‘amportal restart’)

NOTE: you may want to create a misc destination ‘SMS’ (dial xx) and divert the incoming calls to it when out of office.


Example:

exten => 98,1,Answer
exten => 98,2,MobileSendSMS(MPx220,+393348702623,call received from:${CALLERID(all)} at ${STRFTIME(${EPOCH},%d:%m:%Y - %H:%M:%S)} from channel ${CHANNEL})
exten => 98,3,Voicemail(240)
exten => 98,4,Hangup

This will send ‘call received from: CID# @ date-time from Channel#’ via device ‘MPx220’ to ‘+393348702623’

NOTE:
the SMS is sent anyway, it doesn’t matter if a voicemail message is left or not.

Maurizio
http://www.ditta.com

how to install this i am getting error can you help me how you have done this