[Asterisk-java-users] AGI script hangs on string concatenation...
Brought to you by:
srt
From: Jason W. <ja...@cl...> - 2006-03-02 20:03:15
|
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 |