Thread: [Asterisk-java-users] Is this a bug?
Brought to you by:
srt
From: Jason W. <ja...@cl...> - 2006-03-08 17:40:11
|
Hello, The following code hangs evertime on my machine. It's because of the concatenation; if I take it out (dmail=email1+email2+email3;) then it works fine... How can I further nail down the problem? I get 'INFO: Received Connection.' and nothing else... subsequent to failure, calls to this script show 'SEVERE: no script configured' error //************************************************************************** ******** 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 imailnew extends BaseAGIScript { public void service(AGIRequest request, AGIChannel channel) throws AGIException { String dmail,email1,email2,email3; email1 = "jason"; email2 = "clickforacall"; email3 = "com"; dmail = email1 + email2 + email3; //removal of this line will cause it to succeed System.out.println("success"); } } //************************************************************************** ******* Thank you, Jason |
From: Stefan R. <sr...@re...> - 2006-03-08 20:54:17
Attachments:
signature.asc
|
Jason Wolfe wrote: > The following code hangs evertime on my machine. It's because of the > concatenation; if I take it out (dmail=3Demail1+email2+email3;) then it= works > fine... How can I further nail down the problem? I get 'INFO: Received > Connection.' and nothing else... subsequent to failure, calls to this s= cript > show 'SEVERE: no script configured' error I ran your script here with A-J 0.2 with a ResourceBundleMappingStrategy and besides the fact that it doesnt do anything it run well - even multiple times. =3DStefan --=20 reuter network consulting Neusser Str. 110 50760 K=F6ln Germany Telefon: +49 221 1305699-0 Telefax: +49 221 1305699-90 E-Mail: sr...@re... Jabber: sr...@ja... |
From: Jason W. <jas...@be...> - 2006-03-08 21:29:11
|
thank you, as it turns out... I can't concatenate String variables in java on this machine!? (weird I know) This thing in a main runs on my test and devolepment machines fine, then get's to the production machine as a service and fails... even in a main) As this is now a Java/Linux problem I'll be off topic if I proceed, but any ideas would be very helpful. I looked in var/log/messages and var/log/secure and found nothing. I was running the SElinux and turned that off, the problem may have started when I did this. jason -----Original Message----- From: ast...@li... [mailto:ast...@li...]On Behalf Of Stefan Reuter Sent: Wednesday, March 08, 2006 3:54 PM To: ast...@li... Subject: Re: [Asterisk-java-users] Is this a bug? Jason Wolfe wrote: > The following code hangs evertime on my machine. It's because of the > concatenation; if I take it out (dmail=email1+email2+email3;) then it works > fine... How can I further nail down the problem? I get 'INFO: Received > Connection.' and nothing else... subsequent to failure, calls to this script > show 'SEVERE: no script configured' error I ran your script here with A-J 0.2 with a ResourceBundleMappingStrategy and besides the fact that it doesnt do anything it run well - even multiple times. =Stefan -- reuter network consulting Neusser Str. 110 50760 Köln Germany Telefon: +49 221 1305699-0 Telefax: +49 221 1305699-90 E-Mail: sr...@re... Jabber: sr...@ja... |
From: Stefan R. <sr...@re...> - 2006-03-08 22:26:38
Attachments:
signature.asc
|
Jason Wolfe wrote: > as it turns out... I can't concatenate String variables in java on this= > machine!? (weird I know) This thing in a main runs on my test and > devolepment machines fine, then get's to the production machine as a se= rvice > and fails... even in a main) what JDK are you running on that machine? a sun one or some of the "free" ones like kaffee that sometimes come shipped with linux distros? try a java -version You probably want to make sure you are actually running a recent sun (or bea jrockit) jdk there. =3DStefan --=20 reuter network consulting Neusser Str. 110 50760 K=F6ln Germany Telefon: +49 221 1305699-0 Telefax: +49 221 1305699-90 E-Mail: sr...@re... Jabber: sr...@ja... |
From: Jason W. <jas...@be...> - 2006-03-17 11:53:06
|
I finally found the problem listed below and wanted to communicate it because perhaps it will be a help to others. I had reset the classpath on the machine, and it was not correct(typo). I was able to run all types of simple java programs so I thought that this couldn't be the problem. However, I was not able to concatenate strings. Someone on the groups told me that the chance of the program failing on that line (where the concatenation was) was 0%. Saying the chance of anything failing is 0% is probably never appropriate, as there is always a possibility, and in this case, was the direct key to the problem. The class needed to perform string concatenation couldn't be found at runtime and therefore the DefaultAGIServer just hung, and then gave a severe error on subsequent requests. Is there a way to simply change the way this server works so that it would give detailed error information to the screen when this type of thing happens? would this be a worthwhile change? I had the code in the agi in try-catch blocks, with a system.out of the exception, but didn't see this on the screen. running the program in main I was able to see the problem, so I'll do this quicker next time. perhaps this was more about honing my debugging technique than anything else! :) Thanks again Stefan for your hard work on Asterisk-Java. -----Original Message----- From: ast...@li... [mailto:ast...@li...]On Behalf Of Stefan Reuter Sent: Wednesday, March 08, 2006 5:26 PM To: ast...@li... Subject: Re: [Asterisk-java-users] Is this a bug? Jason Wolfe wrote: > as it turns out... I can't concatenate String variables in java on this > machine!? (weird I know) This thing in a main runs on my test and > devolepment machines fine, then get's to the production machine as a service > and fails... even in a main) what JDK are you running on that machine? a sun one or some of the "free" ones like kaffee that sometimes come shipped with linux distros? try a java -version You probably want to make sure you are actually running a recent sun (or bea jrockit) jdk there. =Stefan -- reuter network consulting Neusser Str. 110 50760 Köln Germany Telefon: +49 221 1305699-0 Telefax: +49 221 1305699-90 E-Mail: sr...@re... Jabber: sr...@ja... |
From: Stefan R. <sr...@re...> - 2006-03-17 12:03:53
Attachments:
signature.asc
|
Jason Wolfe wrote: > The class needed to perform string concatenation couldn't be found at > runtime and therefore the DefaultAGIServer just hung, and then gave a s= evere > error on subsequent requests. Is there a way to simply change the way t= his > server works so that it would give detailed error information to the sc= reen > when this type of thing happens? would this be a worthwhile change?=20 If I should consider a change (e.g. better logging) I need more information about the cause, i.e. which class was not available and where did DefaultAGIServer hang? Did you enable log4j logging and checked that this error was not reported in A-J's logs? silently failing without either a log entry or an exception being thrown is bad and should be fixed. =3DStefan --=20 reuter network consulting Neusser Str. 110 50760 K=F6ln Germany Telefon: +49 221 1305699-0 Telefax: +49 221 1305699-90 E-Mail: sr...@re... |
From: Tony M. <to...@am...> - 2006-03-17 12:08:27
|
I think what you would probably want is for all errors to be logged and = then you can configure a log4j appender to output errors to the console if = that is where you want them to go. Normally you wouldn't want this sort of library, asterisk-java, to = output anything to System.out. =20 -----Original Message----- .... The class needed to perform string concatenation couldn't be found at runtime and therefore the DefaultAGIServer just hung, and then gave a = severe error on subsequent requests. Is there a way to simply change the way = this server works so that it would give detailed error information to the = screen when this type of thing happens? would this be a worthwhile change? I = had the code in the agi in try-catch blocks, with a system.out of the = exception, but didn't see this on the screen. running the program in main I was = able to see the problem, so I'll do this quicker next time. perhaps this was = more about honing my debugging technique than anything else! :) Thanks again Stefan for your hard work on Asterisk-Java. -----Original Message----- From: ast...@li... [mailto:ast...@li...]On Behalf Of Stefan Reuter Sent: Wednesday, March 08, 2006 5:26 PM To: ast...@li... Subject: Re: [Asterisk-java-users] Is this a bug? Jason Wolfe wrote: > as it turns out... I can't concatenate String variables in java on = this > machine!? (weird I know) This thing in a main runs on my test and > devolepment machines fine, then get's to the production machine as a service > and fails... even in a main) what JDK are you running on that machine? a sun one or some of the "free" ones like kaffee that sometimes come shipped with linux distros? try a java -version You probably want to make sure you are actually running a recent sun (or bea jrockit) jdk there. =3DStefan -- reuter network consulting Neusser Str. 110 50760 K=F6ln Germany Telefon: +49 221 1305699-0 Telefax: +49 221 1305699-90 E-Mail: sr...@re... Jabber: sr...@ja... ------------------------------------------------------- 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=3Dlnk&kid=3D110944&bid=3D241720&dat=3D= 121642 _______________________________________________ Asterisk-java-users mailing list Ast...@li... https://lists.sourceforge.net/lists/listinfo/asterisk-java-users |
From: Brett S. <bs...@no...> - 2006-03-09 11:56:07
|
Help.................. I've written a Fast AGI application which calls BaseAGIScript.exec("txfax", data); The application txfax is called successfully. I have two problems. 1. txfax returns a value of -1 but the return from the call to BaseAGIScript.exec("txfax", data) returns a value of 0. 2. I have modified app_txfax.c to set a channel variable to indicate indicate the actual reason for the failure. When I attempt to retrieve the channel value null is returned: e.g. <code> String resultVar = getVariable(SubmitFax.FAX_RESULT); </code> where SubmitFax.FAX_RESULT is defined as: <code> public static final String FAX_RESULT = "FAX_RESULT"; </code> The relevant txfax code uses: <code> ast_log(LOG_DEBUG, "==============================================================================\n"); ast_log(LOG_DEBUG, "Fax send not successful - result %d.\n", result); ast_log(LOG_DEBUG, "==============================================================================\n"); char varResult[64]; sprintf(varResult, "%d", result); pbx_builtin_setvar_helper(chan, "FAX_RESULT", varResult); <code> The last lines of the txfax_exec method is: <code> ast_log(LOG_DEBUG, "returning=%d\n", res); return res; } </code> The log file displays the following: Mar 9 22:41:44 DEBUG[18786] app_txfax.c: ============================================================================== Mar 9 22:41:44 DEBUG[18786] app_txfax.c: Fax send not successful - result 3. Mar 9 22:41:44 DEBUG[18786] app_txfax.c: ============================================================================== Mar 9 22:41:44 DEBUG[18786] app_txfax.c: returning=-1 Mar 9 22:41:44 VERBOSE[18786] logger.c: -- AGI Script agi://192.168.0.3/CallTxFax.agi?channel=ZAP/g0 completed, returning 0 And if I run ngrep I see the following: ngrep -d eth0:1 -s 4000 port 4573 interface: eth0:1 (192.168.0.0/255.255.255.0) filter: ip and ( port 4573 ) #### T 192.168.0.4:33154 -> 192.168.0.3:4573 [AP] agi_network: yes. ## T 192.168.0.4:33154 -> 192.168.0.3:4573 [AP] agi_network_script: CallTxFax.agi?channel=ZAP/g0.agi_request: agi://192.168 .0.3/CallTxFax.agi?channel=ZAP/g0.agi_channel: Zap/3-1.agi_language: en.agi _type: Zap.agi_uniqueid: 1141904464.71.agi_callerid: unknown.agi_calleridna me: unknown.agi_callingpres: 0.agi_callingani2: 0.agi_callington: 0.agi_cal lingtns: 0.agi_dnid: unknown.agi_rdnis: unknown.agi_context: incoming.agi_e xtension: s.agi_priority: 1.agi_enhanced: 0.0.agi_accountcode: .. # T 192.168.0.3:4573 -> 192.168.0.4:33154 [AP] GET VARIABLE "FAX_PATH". ## T 192.168.0.4:33154 -> 192.168.0.3:4573 [AP] 200 result=1 (C:\usr\lib\asterfax\outbox\QWWWxx28423.tif). # T 192.168.0.3:4573 -> 192.168.0.4:33154 [AP] GET VARIABLE "FAX_DEBUG". # T 192.168.0.4:33154 -> 192.168.0.3:4573 [AP] 200 result=1 (DEBUG). # T 192.168.0.3:4573 -> 192.168.0.4:33154 [AP] EXEC "txfax" "C:\usr\lib\asterfax\outbox\QWWWxx28423.tif|caller|debug". ## T 192.168.0.4:33154 -> 192.168.0.3:4573 [AP] 200 result=0. # T 192.168.0.3:4573 -> 192.168.0.4:33154 [AP] GET VARIABLE "FAX_RESULT". ## T 192.168.0.4:33154 -> 192.168.0.3:4573 [AP] 200 result=0. ### |
From: Stefan R. <sr...@re...> - 2006-03-10 01:53:22
Attachments:
signature.asc
|
Hi Brett, > 1. txfax returns a value of -1 but the return from the call to > BaseAGIScript.exec("txfax", data) returns a value of 0. you dont have access to the return value through AGI afaik. > 2. I have modified app_txfax.c to set a channel variable to indicate > indicate the actual reason for the failure. When I attempt to retrieve > the channel value null is returned: yeah thats the way to go. (and with Asterisk 1.2 return values are deprected in favor of channel variables anyway) I dont see why "FAX_RESULT" isnt set correctly and "FAX_DEBUG" seems to be ok... did you do anything different regarding those two variables? Are you sure your code in app_txfax.c is executed? Maybe some debug logging statements help there. =3DStefan --=20 reuter network consulting Neusser Str. 110 50760 K=F6ln Germany Telefon: +49 221 1305699-0 Telefax: +49 221 1305699-90 E-Mail: sr...@re... Jabber: sr...@ja... |