[Asterisk-java-users] HELP: Fast AGI exed return value.
Brought to you by:
srt
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. ### |