Re: [Asterisk-java-users] AGI script hangs on string concatenation...
Brought to you by:
srt
From: Brett S. <bs...@no...> - 2006-03-02 20:14:48
|
The chances of your applications hanging on that actual line are about zero. I do however note that the line has two \n's. I would strong suggest testing your service method as a standalone application (just re-write it as a main()). Regards, Brett. Jason Wolfe wrote: > Stefan, > > When I found out that newline is sufficient for adding multiple mappings to > fastagi-mapping.properties, I realized that the problem was deeper. I have > the following code that works right up to the last line, where I concatenate > a string 'etext' with the += operator. > > **************************************************************************** > ************** > **************************************************************************** > **************** > > import net.sf.asterisk.fastagi.AGIChannel; > import net.sf.asterisk.fastagi.AGIException; > import net.sf.asterisk.fastagi.AGIRequest; > import net.sf.asterisk.fastagi.BaseAGIScript; > > import java.util.*; > import javax.mail.*; > import javax.mail.internet.*; > > public class imail extends BaseAGIScript { > public void service(AGIRequest request, AGIChannel channel) throws > AGIException > { > System.out.println("Starting Insurance Email AGI"); > String itype, year, make, model, areacode; > String dmail,etext,email1,email2,email3; > > email1 = "jason"; > email2 = "clickforacall"; > email3 = "com"; > itype = "error"; > year = "error"; > make = "error"; > model = "error"; > areacode = "error"; > > try { > email1 = request.getParameter("email1"); > email2 = request.getParameter("email2"); > email3 = request.getParameter("email3"); > > itype = request.getParameter("itype"); > year = request.getParameter("year"); > make = request.getParameter("make"); > model = request.getParameter("model"); > areacode = request.getParameter("areacode"); > System.out.println("Parameters accepted"); > } catch (Exception e) { > System.out.println(e); > } > etext = "Hello,\n"; > etext += "The Customer has entered the following information at the > time of call:\n\n"; //HANGS ON THIS LINE > > > //I cant make it past the line above my concatenation. > > > > > > > > > > > /* > etext += "Insurance Type: " + itype + "\n"; > etext += "Auto Year: " + year + "\n"; > etext += "Auto Make: " + make + "\n"; > etext += "Auto Model: " + model + "\n"; > etext += "Customer Area Code: " + areacode + "\n"; > System.out.println("text set"); > > > Properties props = new Properties(); > props.put("mail.smtp.host", "mail.clickforacall.com"); > Session s = Session.getInstance(props,null); > > MimeMessage message = new MimeMessage(s); > > try{ > > InternetAddress from = new > InternetAddress("Quo...@cl..."); > message.setFrom(from); > String toAddress = request.getParameter("to"); > InternetAddress to = new InternetAddress(email1 + "@" + email2 + "." + > email3); > message.addRecipient(Message.RecipientType.TO, to); > }catch(Exception e){ > System.out.println("EXCEPTION_1:" + e); > } > > > > > > String subject = "Customer Quote Data"; > > try{ > > message.setSubject(subject); > message.setText(etext); > > Transport.send(message); > }catch(Exception e){ > System.out.println("EXCEPTION_2:" + e); > } > > //get some variables and send the email... > > > */ > } > > } > > **************************************************************************** > ******* > **************************************************************************** > ******* > > > This was working for awhile, and then suddenly stoped. Any ideas why this > would cause the script to hang? > > It leaves the last message on the screen >>> INFO: Received Connection <<< > and that's it. > > If there are additional log files that would help, could you tell me where > to find them? > > Thanks, > Jason > > > > ------------------------------------------------------- > This SF.Net email is sponsored by xPML, a groundbreaking scripting language > that extends applications into web and mobile media. Attend the live webcast > and join the prime developer group breaking into this new coding territory! > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 > _______________________________________________ > Asterisk-java-users mailing list > Ast...@li... > https://lists.sourceforge.net/lists/listinfo/asterisk-java-users > |