Re: [Asterisk-java-users] Receive Voicemail event
Brought to you by:
srt
From: Miguel S. <m.s...@gm...> - 2013-01-16 12:47:21
|
Hi, Perhaps the data is not available yet just in the moment you are triyng to retrieve, and it is a random situation depending on your asterisk process load (I wonder). Try to implement a breakable-loop with a top retries value, pausing the java thread a short time ( Thread.sleep (500) ) before every try step into the loop. Hope it helps ! I look forward to your comments. Miguel 2013/1/16 Daniele Renda <dan...@gm...> > Hi Miguel, > thanks very much for the time you spent!! Your solution is very good; > infact is a similar one that I'm using today. Instead of a status I've the > date of elaboration of the vm but the concept is the same. > The problem is that when you use Voicemailmain there I've an sql error > (not always but only some times) as you can see in the image attached. > > Any idea about this problem? Maybe I have to see the source of Asterisk to > understand where is the problem.... > > Thanks > > > 2013/1/16 Miguel Santiago <m.s...@gm...> > >> Hi Daniele, >> >> Assuming MessageWaitingEvent is triggered when someone leaves voicemail, >> maybe you can do this : >> >> - First, add a field to voicemessages table (example : `message_status` >> Integer Default 0) to allow you to manage your own control (the fact that >> you extend your ODBC Asterisk tables does not causes a wrong behavior, >> I´ve tried and check >> extending some other tables, as cdr, on my implementations, and >> everything works fine) >> >> - Get from the event then name of the mailbox using *getMailbox<http://www.asterisk-java.org/development/apidocs/org/asteriskjava/manager/event/MessageWaitingEvent.html#getMailbox%28%29> >> *() method. >> >> - Select all records corresponding to the mailbox obtained from the >> event, whose message_status let you know that >> has not been already processed by your java process. >> Example : "Select * From `voicemessages` Where mailboxuser = [mailbox] >> and status = 0" >> >> - So, you can process each record obtained from the query, setting a new >> status when all the work is done >> Example, message_status = 1 (processed) >> >> I think you can get all the information you need from the table, >> including the recording file stored into the blob field `recording` >> >> Note you can obtain the email-address as well querying voicemail.conf >> >> Hope it helps ! >> >> >> >> >> 2013/1/16 Daniele Renda <dan...@gm...> >> >>> Hi, >>> thanks for your reply. >>> I need to run some actions when the pbx receive a new vm. I need to get >>> all details of this new vm and then notify the user in several way (alert >>> notifications, email and so on). >>> I know that with voicemail.conf I can manage the sent of vm by email but >>> this is not enought for me. >>> >>> So I was looking for a way to get the notify of a new vm in Java (with >>> MessageWaitingEvent I can do that) and then get the details of the new vm >>> (I can't do that). >>> >>> Thanks! >>> >>> >>> 2013/1/16 Yves A. <yv...@gm...> >>> >>>> ah, >>>> i see... sorry, but i have no experience in storing vm in db... i >>>> always used files and have no problems accessing >>>> the files, because i know the directory they are stored, can fetch >>>> filedate and so on... >>>> maybe you could explain your objective in detail, so i can understand >>>> the story behind... there is almost always >>>> a solution... >>>> >>>> yves >>>> >>>> Am 16.01.2013 00:20, schrieb Daniele Renda: >>>> >>>> Thanks yves. >>>> From MailboxCountResponse I can't get the msg_id of my new message. I >>>> can only get the number of new messages. >>>> I need to get all information that are stored in message table (see >>>> here >>>> http://www.voip-info.org/wiki/view/Asterisk+Voicemail+ODBC+storage).<http://www.voip-info.org/wiki/view/Asterisk+Voicemail+ODBC+storage> >>>> Unfortunally I can't link the event of new message that I receive in >>>> Asterisk Java with the message store natively in mysql table from asterisk. >>>> >>>> Thanks >>>> >>>> 2013/1/16 Yves A. <yv...@gm...> >>>> >>>>> MailboxCountAction >>>> >>>> >>>> >>>> >>>> >>>> -- >>>> Daniele Renda >>>> >>>> >>>> ------------------------------------------------------------------------------ >>>> Master SQL Server Development, Administration, T-SQL, SSAS, SSIS, SSRS >>>> and more. Get SQL Server skills now (including 2012) with LearnDevNow - >>>> 200+ hours of step-by-step video tutorials by Microsoft MVPs and experts. >>>> SALE $99.99 this month only - learn more at:http://p.sf.net/sfu/learnmore_122512 >>>> >>>> >>>> >>>> _______________________________________________ >>>> Asterisk-java-users mailing lis...@li...https://lists.sourceforge.net/lists/listinfo/asterisk-java-users >>>> >>>> >>>> >>>> >>>> ------------------------------------------------------------------------------ >>>> Master SQL Server Development, Administration, T-SQL, SSAS, SSIS, SSRS >>>> and more. Get SQL Server skills now (including 2012) with LearnDevNow - >>>> 200+ hours of step-by-step video tutorials by Microsoft MVPs and >>>> experts. >>>> SALE $99.99 this month only - learn more at: >>>> http://p.sf.net/sfu/learnmore_122512 >>>> _______________________________________________ >>>> Asterisk-java-users mailing list >>>> Ast...@li... >>>> https://lists.sourceforge.net/lists/listinfo/asterisk-java-users >>>> >>>> >>> >>> >>> -- >>> Daniele Renda >>> >>> >>> ------------------------------------------------------------------------------ >>> Master Java SE, Java EE, Eclipse, Spring, Hibernate, JavaScript, jQuery >>> and much more. Keep your Java skills current with LearnJavaNow - >>> 200+ hours of step-by-step video tutorials by Java experts. >>> SALE $49.99 this month only -- learn more at: >>> http://p.sf.net/sfu/learnmore_122612 >>> _______________________________________________ >>> Asterisk-java-users mailing list >>> Ast...@li... >>> https://lists.sourceforge.net/lists/listinfo/asterisk-java-users >>> >>> >> >> >> -- >> Miguel Santiago >> >> >> ------------------------------------------------------------------------------ >> Master Java SE, Java EE, Eclipse, Spring, Hibernate, JavaScript, jQuery >> and much more. Keep your Java skills current with LearnJavaNow - >> 200+ hours of step-by-step video tutorials by Java experts. >> SALE $49.99 this month only -- learn more at: >> http://p.sf.net/sfu/learnmore_122612 >> _______________________________________________ >> Asterisk-java-users mailing list >> Ast...@li... >> https://lists.sourceforge.net/lists/listinfo/asterisk-java-users >> >> > > > -- > Daniele Renda > > > ------------------------------------------------------------------------------ > Master Java SE, Java EE, Eclipse, Spring, Hibernate, JavaScript, jQuery > and much more. Keep your Java skills current with LearnJavaNow - > 200+ hours of step-by-step video tutorials by Java experts. > SALE $49.99 this month only -- learn more at: > http://p.sf.net/sfu/learnmore_122612 > _______________________________________________ > Asterisk-java-users mailing list > Ast...@li... > https://lists.sourceforge.net/lists/listinfo/asterisk-java-users > > -- Miguel Santiago |