From: Lonnie A. <li...@lo...> - 2007-01-18 18:48:41
|
Hi, Several people have asked about sending an email for every incoming call in AstLinux. I have a working example. exten => 1198,1,Answer exten => 1198,n,System(/mnt/kd/email_in.sh "${CALLERID(name)}" "$ {CALLERID(num)}") exten => 1198,n,Hangup Note: The double-quotes are very important. ----- email_in.sh ----- #!/bin/bash TO_EMAIL=me...@fo... FROM_EMAIL=pb...@fo... echo -e "Subject: Incoming call from: $1 <$2>\n Date: `date -R`\n From: ${FROM_EMAIL}\n To: ${TO_EMAIL}\n\n Incoming call from: $1 <$2>" | /usr/sbin/msmtp "${TO_EMAIL}" & exit 0 ---- email_in.sh ----- Note: the "echo" "msmtp" line should be one line, I added returns before the mailer did. Join the lines without adding any spaces. $ chmod 755 email_in.sh Final Note: "msmtp" can take awhile to execute (a second to many seconds) depending on your mail relay, so I execute this as a separate process not to delay incoming calls. (note the trailing &) If there is a better way of doing this, let us know. Lonnie |