LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
LinkBack Search this Thread
Old 11-13-2009, 12:42 AM   #1
Terry56
Member
 
Registered: Oct 2009
Posts: 49

Rep: Reputation: 15
Need a script that extract voice mail from email, rename it and then create a file


Hi to all,
Hope you all are at good health .Actually i need a script that extract voice mail from the email, then rename it to name like msgNNNN.wav and after that it creates a text file(msgNNNN.txt) that contain the following info

;
; Message Information file
;
[message]
origmailbox=206
context=office
macrocontext=
exten=206
priority=3
callerchan=SIP/208-09fb58c0
callerid="Bashir" <208>
origdate=Fri Oct 31 08:46:27 PM PKT 2008
origtime=1225467987
category=
duration=2

All the parameters above are same except the origmailbox, exten, callerid, origdate, and origtime. origmailbox, exten values depend on the emailID to whom i am sending mail to. Suppose if i send email to kashif@nethyderabad.com and kashif has an extension 220 then origmailbox, exten get the value of 220. Similarly callerid get the value corresponding to sender email address. Means if Basit is sending email to kashif and Basit has an extension 206 then caller Id get the value of "Basit" <206> and origdate and origtime of-course it gets from the system clock but the format is same as above

Oooooh it's a very hefty script i know. Actually i also know the programming and i am good in java programming but i am not an expert.I can also understand the code as well of other programming languages.

So kindly can any one help me in doing this, any guidance that what should i do,means if talking about java what classes should i suppose to use and in any other language, i'll manage it, but i really need some guidance that how can i do it.

May be scripts are available not as it is as i want but in pieces, like file rename script exist, extaracting voicemail script exist.

So please can any one help me on this topic

Thank you
 
Old 11-13-2009, 10:20 AM   #2
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian sid + kde 3.5 & 4.4
Posts: 6,823

Rep: Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946
Well, if you want to script this, you first need to have cli commands that will extract the file and the information you need. Once you have that, it should be fairly simple to write a script to do the rest. I don't see anything in your description that would be difficult to do.

I've never used any command-line email programs though, so I have no idea how to do that first step. Start your research there.
 
Old 11-14-2009, 12:40 AM   #3
Terry56
Member
 
Registered: Oct 2009
Posts: 49

Original Poster
Rep: Reputation: 15
Hi ,
Thanks for the reply.You mean that the voice-mail extracting part will be done with the help of some kind of Linux command.

Also i don't want to extract information from the email, the task is to extract voice mail and then create a new text file and put the information in it. But it's fine, creating a file and then putting this sort of information i think I'll do it.

What do you mean by command line email programs, as far as i understand, you mean a program in which a Linux command is executed using statemens like this,

public void sendMail( String smtpServer, String sender,
String reciever, String msg,
boolean showOutput) {
try {
String cmd;
cmd = "C:\\febootimail.exe";
cmd += " -SERVER " + smtpServer;
cmd += " -FROM " + sender;
cmd += " -TO " + reciever;
cmd += " -MSG " + msg;
Process p = Runtime.getRuntime().exec(cmd);

Will i suppose to write a new one or can i use any existing one. Can i use Java to do the whole things. Actually after doing all these things i suppose to send email in a particular folder and this part have been done but the script that i used for this part is in Perl.

Actually what i have been done so far is this that when you send email to nethyderabad domain, like kashif@nethyderabad.com, it is received by the send mail there.Then with the help of one of the senior member of this forum, i succeed to send this email to the desired folder but the script that do this is in Perl, and how this be achieved that in procmail file we set a condition that if the mail received by send mail and it subject line contain voicemail text then run the desired Perl script.

So i want to ask that can i use Java to do the things. Because this part will run before the Perl Script and when this part has finished it work then Perl script will run.

All the things remain same, i think I'll only put this new script before the Perl script.

So am i thinking in a right direction.

Thank you .
 
Old 11-14-2009, 04:53 AM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 26,542
Blog Entries: 51

Rep: Reputation: 2604Reputation: 2604Reputation: 2604Reputation: 2604Reputation: 2604Reputation: 2604Reputation: 2604Reputation: 2604Reputation: 2604Reputation: 2604Reputation: 2604
Quote:
Originally Posted by Terry56 View Post
i don't want to extract information from the email, the task is to extract voice mail and then create a new text file and put the information in it. But it's fine, creating a file and then putting this sort of information i think I'll do it.
I do not know why you have posted this question again and your duplicates at http://www.linuxquestions.org/questi...terisk-768344/ and http://www.linuxquestions.org/questi...format-768329/, because Bathory already kindly assisted you with creating the required Procmail filter here: http://www.linuxquestions.org/questi...-error-762314/ (post #14 and on).
 
Old 11-14-2009, 06:27 AM   #5
Terry56
Member
 
Registered: Oct 2009
Posts: 49

Original Poster
Rep: Reputation: 15
Hi,
Oh sorry.Next time I'll be careful. Actually i really didn't no that all forums are inter related to each other. Again sorry

Thank you
 
Old 11-15-2009, 02:45 AM   #6
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian sid + kde 3.5 & 4.4
Posts: 6,823

Rep: Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946Reputation: 1946
I see that this question has been handled in a cross-posted thread, but I want to follow up on this:

Quote:
Originally Posted by Terry56 View Post
Also i don't want to extract information from the email, the task is to extract voice mail and then create a new text file and put the information in it.
Before your script can create a text file with the information, it needs to get the information. And where will you get it, if not from the email itself?

And by a command line (cli) program, I simply mean a program that can be used non-graphically and can be called from a script. Shell scripting mostly calls on and links together stand-alone cli programs, like procmail mentioned above, as opposed to programming languages like perl or java that use various library functions.
 
Old 11-17-2009, 03:57 AM   #7
Terry56
Member
 
Registered: Oct 2009
Posts: 49

Original Poster
Rep: Reputation: 15
Hi,
Thanks.I'll get the information from the database.Suppose if email is send to kashif then a connection is made to a database and see what extension is written against kashif and this value is assigned to the variable, similarly another check will check what extension is written against sender mail address and this value is assign to sender variable.

You mean a program is written which perform mail extraction and the remaining things and it is called through procmail as i called the perl script.

Thank you.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Conversion of voice mail into Asterisk voice mail format Terry56 Linux - General 6 11-14-2009 06:00 AM
bash script to save/extract an mail attachment to /tmp folder nilhere Linux - Server 3 08-18-2009 05:55 AM
script/application to extract attachments from email Murdock1979 Linux - Server 1 05-08-2008 08:36 AM
procmail: Couldn't create or rename temp file "/var/spool/mail/tmp/.... paul_mat Linux - Software 0 05-02-2006 06:16 PM
File rename script jjwl89 Linux - General 1 03-14-2005 06:28 PM


All times are GMT -5. The time now is 01:31 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration