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
[EMAIL PROTECTED]
[EMAIL PROTECTED]
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

_______________________________________________
Astlinux-users mailing list
[email protected]
http://lists.kriscompanies.com/mailman/listinfo/astlinux-users

Donations to support AstLinux are graciously accepted via PayPal to [EMAIL 
PROTECTED]

REMEMBER: AstLinux mailing lists are moving soon:

http://sourceforge.net/mail/?group_id=170462

Please move any discussions ASAP!

Reply via email to