Hi all,<div><br></div><div>I am trying to control the whole call using a FastAGI script. To that effect I launch a FastAGI script (written with asterisk-java).</div><div><br></div><div>Basically, I want to DIAL from within the FastAGI script. When the call ends I want to control the hangup (if executed at the remote end), and depending on the cause, dial again, play a message, or hang up. This is a pretty standard telephony scenario. I did it before by executing the AGI, setting variables, calling the DIAL command from the dialplan, and then executing a second AGI script for the cleanup logic. However, now that I am using FastAGI it seems like a better idea to keep the AGI script alive during the duration of the call. This gives me a lot of control and fexibility on reporting.</div>
<div><br></div><div>However, as far as I can tell, once the called party hangs up, the CDR is generated and posted, _even though my script is still in execution_! As you can see from the sample below, the called party hangs up, and dialplan execution starts immediately at the h extension, even though my script is still running. In fact, I have quite a bit of cleanup to do, adding variables to the CDR's, and none of them are saved! I believe this is because the CDR is already finised. </div>
<div><br></div><div>It's like if once you call the DIAL aplication, the dialplan forks off and your script is running in a different place. I do not understand it. I assumed when I called DIAL from within a script, that the script execution would suspend, but be resumed once the DIAL command returned, but this is not what is happening.</div>
<div><br></div><div>Is there any way to get that behaviour?</div><div><br></div><div>Regards,</div><div><br></div><div>Alex</div><div><br></div><div><br></div><div><div><br></div><div>"Entering customer extension"</div>
<div> -- Executing [629999999@customer:2] Verbose("SIP/139255423-0000004c", "5,"Dialed - 629999999"") in new stack</div><div> > "Dialed - 629999999"</div><div> -- Executing [629999999@customer:3] Set("SIP/139255423-0000004c", "origincontext=customer") in new stack</div>
<div> -- Executing [629999999@customer:4] Goto("SIP/139255423-0000004c", "transform,629999999,1") in new stack</div><div> -- Goto (transform,629999999,1)</div><div> -- Executing [629999999@transform:1] Goto("SIP/139255423-0000004c", "customer,0034629999999,transform") in new stack</div>
<div> -- Goto (customer,0034629999999,5)</div><div> -- Executing [0034629999999@customer:5] Verbose("SIP/139255423-0000004c", "5,"New dialnum - 0034629999999"") in new stack</div><div> > "New dialnum - 0034629999999"</div>
<div> -- Executing [0034629999999@customer:6] Set("SIP/139255423-0000004c", "CDR(server)=7") in new stack</div><div> -- Executing [0034629999999@customer:7] Set("SIP/139255423-0000004c", "CDR(srcip)=") in new stack</div>
<div> -- Executing [0034629999999@customer:8] AGI("SIP/139255423-0000004c", "agi://localhost/auth") in new stack</div><div>AGI Tx >> agi_network: yes</div><div>AGI Tx >> agi_network_script: auth</div>
<div><SIP/139255423-0000004c>AGI Tx >> agi_request: agi://localhost/auth</div><div><SIP/139255423-0000004c>AGI Tx >> agi_channel: SIP/139255423-0000004c</div><div><SIP/139255423-0000004c>AGI Tx >> agi_language: es</div>
<div><SIP/139255423-0000004c>AGI Tx >> agi_type: SIP</div><div><SIP/139255423-0000004c>AGI Tx >> agi_uniqueid: 1340616655.76</div><div><SIP/139255423-0000004c>AGI Tx >> agi_version: 10.5.0</div>
<div><SIP/139255423-0000004c>AGI Tx >> agi_callerid: 139255</div><div><SIP/139255423-0000004c>AGI Tx >> agi_calleridname: unknown</div><div><SIP/139255423-0000004c>AGI Tx >> agi_callingpres: 0</div>
<div><SIP/139255423-0000004c>AGI Tx >> agi_callingani2: 0</div><div><SIP/139255423-0000004c>AGI Tx >> agi_callington: 0</div><div><SIP/139255423-0000004c>AGI Tx >> agi_callingtns: 0</div>
<div><SIP/139255423-0000004c>AGI Tx >> agi_dnid: 629999999</div><div><SIP/139255423-0000004c>AGI Tx >> agi_rdnis: unknown</div><div><SIP/139255423-0000004c>AGI Tx >> agi_context: customer</div>
<div><SIP/139255423-0000004c>AGI Tx >> agi_extension: 0034629999999</div><div><SIP/139255423-0000004c>AGI Tx >> agi_priority: 8</div><div><SIP/139255423-0000004c>AGI Tx >> agi_enhanced: 0.0</div>
<div><SIP/139255423-0000004c>AGI Tx >> agi_accountcode: 704741</div><div><SIP/139255423-0000004c>AGI Tx >> agi_threadid: 1104279872</div><div><SIP/139255423-0000004c>AGI Tx >> </div><div>
<SIP/139255423-0000004c>AGI Rx << GET VARIABLE "CDR(src)"</div><div><SIP/139255423-0000004c>AGI Tx >> 200 result=1 (139255423)</div><div><SIP/139255423-0000004c>AGI Rx << SET VARIABLE "CDR(accountcode)" "704741"</div>
<div><SIP/139255423-0000004c>AGI Tx >> 200 result=1</div><div><SIP/139255423-0000004c>AGI Rx << SET VARIABLE "CDR(dest_id)" "507"</div><div><SIP/139255423-0000004c>AGI Tx >> 200 result=1</div>
<div><SIP/139255423-0000004c>AGI Rx << SET VARIABLE "CDR(routeplan)" "11261"</div><div><SIP/139255423-0000004c>AGI Tx >> 200 result=1</div><div><SIP/139255423-0000004c>AGI Rx << SET VARIABLE "CDR(carrier)" "69"</div>
<div><SIP/139255423-0000004c>AGI Tx >> 200 result=1</div><div><SIP/139255423-0000004c>AGI Rx << EXEC "Dial" "SIP/100034629999999@x.x.x.x"</div><div> -- AGI Script Executing Application: (Dial) Options: (SIP/100034629999999@x.x.x.x)</div>
<div> == Using SIP RTP CoS mark 5</div><div> -- Called SIP/<a href="mailto:100034629999999@193.17.66.71">100034629999999@193.17.66.71</a></div><div> -- SIP/193.17.66.71-0000004d is making progress passing it to SIP/139255423-0000004c</div>
<div> -- SIP/193.17.66.71-0000004d is ringing </div><div> -- SIP/193.17.66.71-0000004d is making progress passing it to SIP/139255423-0000004c</div><div> -- SIP/193.17.66.71-0000004d answered SIP/139255423-0000004c</div>
<div> -- Executing [h@customer:1] Set("SIP/139255423-0000004c", "CDR(q931)=16") in new stack</div><div> -- Executing [h@customer:2] Set("SIP/139255423-0000004c", "CDR(userfield)={"agi":"","a-leg-id":"2118d872-305e-4bb4-8c47-30e1514cb934","b-leg-id":"36b232e73ac326bd0407b1594627c589@y.y.y.y:5060"}") in new stack</div>
<div><SIP/139255423-0000004c>AGI Tx >> 200 result=-1</div><div><SIP/139255423-0000004c>AGI Tx >> HANGUP</div><div><SIP/139255423-0000004c>AGI Rx << GET VARIABLE "HANGUPCAUSE"</div>
<div><SIP/139255423-0000004c>AGI Tx >> 200 result=1 (16)</div><div><SIP/139255423-0000004c>AGI Rx << GET VARIABLE "Q16"</div><div><SIP/139255423-0000004c>AGI Tx >> 200 result=1 (0)</div>
<div><SIP/139255423-0000004c>AGI Rx << SET VARIABLE "AJ_AGISTATUS" "SUCCESS"</div><div><SIP/139255423-0000004c>AGI Tx >> 200 result=1</div><div> -- <SIP/139255423-0000004c>AGI Script agi://localhost/auth completed, returning 4</div>
<div><SIP/139255423-0000004c>AGI Tx >> HANGUP</div><div> == Spawn extension (customer, 0034629999999, 8) exited non-zero on 'SIP/139255423-0000004c'</div></div>