new_msg
上传用户:wgl386701
上传日期:2007-01-06
资源大小:22k
文件大小:2k
源码类别:

IP电话/视频会议

开发平台:

Visual C++

  1. #!/bin/sh
  2. #
  3. #  new_msg script for use with OpenAM
  4. #  Copyright (C) Equivalence Pty Ltd 1999
  5. #
  6. #  Permission is given to freely copy, redistribute or change this
  7. #  program, provided this notice is retained intact.
  8. #
  9. #  The information and code herein is provided "as is"
  10. #  without warranty of any kind, either expressed or implied.
  11. #  In no event shall EQUIVALENCE be liable for any damages
  12. #  whatsoever including direct, indirect, incidental,
  13. #  consequential, loss of business profits or special damages,
  14. #  even if EQUIVALENCE has been advised of the possibility of such damages.
  15. #
  16. extension="wav"
  17. contenttype="audio/x-wav"
  18. mimencode=/usr/bin/mimencode
  19. sendmail=/usr/lib/sendmail
  20. sox=/usr/bin/sox
  21. fn="$1"
  22. src="$2"
  23. remoteParty="$3"
  24. duration="$4"
  25. codec="$5"
  26. product="$6"
  27. #tempfn=${fn}.tmp
  28. tempfn=/tmp/voice.temp
  29. #email=equival@equival.com.au
  30. email="${USER}@`dnsdomainname`"
  31. sourceemail=h323voice
  32. seperator="========== $$fn =========="
  33. echo Date: `date` > $tempfn
  34. echo To: $email >> $tempfn
  35. echo From: ${sourceemail}@`hostname` >> $tempfn
  36. echo Subject: H323 voice message from ""$remoteParty"" >> $tempfn
  37. echo Mime-Version: 1.0 >> $tempfn
  38. echo Content-Type: multipart/mixed; boundary="$seperator" >> $tempfn
  39. echo "">> $tempfn
  40. echo --$seperator >> $tempfn
  41. echo Content-Type: text/plain >> $tempfn
  42. echo Content-Transfer-Encoding: 8bit >> $tempfn
  43. echo "">> $tempfn
  44. echo "Filename:    $fn" >> $tempfn
  45. echo "Source:      $src" >> $tempfn
  46. echo "RemoteParty: $remoteParty" >> $tempfn
  47. echo "Duration:    $duration" >> $tempfn
  48. echo "Codecs:      $codec" >> $tempfn
  49. echo "Product:     $product" >> $tempfn
  50. echo "">> $tempfn
  51. # name of attachment
  52. pagefn=voice.$$.$extension
  53. # name of temporary file
  54. outputfn=$fn.$extension
  55. # convert file into correct format
  56. $sox -w -t raw -r8000 -s -v4 $fn $outputfn
  57. echo --$seperator >> $tempfn
  58. echo Content-Type: $contenttype; name="$pagefn" >> $tempfn
  59. echo Content-Transfer-Encoding: base64 >> $tempfn
  60. echo Content-Disposition: attachment; filename="$pagefn" >> $tempfn
  61. echo "">> $tempfn
  62. $mimencode $outputfn >> $tempfn
  63. #rm -f $fn
  64. rm -f $outputfn
  65. echo --$seperator >> $tempfn
  66. $sendmail < $tempfn $email 
  67. rm -f $tempfn