John Todd
2003-Sep-07 14:15 UTC
[Asterisk-Users] chan_local environments: unexpected results
I'm having some difficulty with chan_local dial requests. It seems that when a chan_local call is picked up, that the native bridge "pops" the environment back to the settings of the original call. This is unexpected and leads to very frustrating results. My example below is a very distilled sample of a much more complex dialplan problem I'm having with chan_local, but it illustrates the point. In my example below, the variable MYTEST is set in the "original" call. Then, the call is handed to chan_local at a different dialed number. Then, as expected, a new environment is set up, and I cannot see the value I set for MYTEST in this new environment - so far,so goo. I create another variable called OTHERTEST in this new environment. However, as soon as the "Answer" application is called, I see the Local channel hangs up. Suddenly, the environment of the call is handed back to the original call's settings! This seems counter-intuitive, since my dial plan is following a path and expecting variable settings that may not be available in the original call's environment. I would think that Local calls would be "sandboxed" such that they cannot see the environments from other calls, since that is how all the other channel types work... Is this the expected behavior? JT Calls are handed from my SIP phone directly to [local]. The user at SIP extension 2209 is not registered, so the "Busy" (priority 105 in this case) routines will be called. [local] exten => 2213,1,SetVar(MYTEST=ishouldnotseethis) exten => 2213,2,Dial(Local/2209@local) exten => 2209,1,SetVar(OTHERTEST=goodness) exten => 2209,2,NoOp(${MYTEST}) exten => 2209,3,NoOp(${OTHERTEST}) exten => 2209,4,Dial(SIP/2209) exten => 2209,105,Answer exten => 2209,106,Playback(invalid) exten => 2209,107,NoOp(${MYTEST}) exten => 2209,108,NoOp(${OTHERTEST}) exten => 2209,109,Hangup ms1*CLI> -- Executing SetVar("SIP/2203-2496", "MYTEST=ishouldnotseethis") in new stack -- Executing Dial("SIP/2203-2496", "Local/2209@local") in new stack -- Called 2209@local -- Executing SetVar("Local/2209@local-2af6,2", "OTHERTEST=goodness") in new stack -- Executing NoOp("Local/2209@local-2af6,2", "") in new stack -- Executing NoOp("Local/2209@local-2af6,2", "goodness") in new stack -- Executing Dial("Local/2209@local-2af6,2", "SIP/2209") in new stack == Everyone is busy at this time -- Executing Answer("Local/2209@local-2af6,2", "") in new stack -- Local/2209@local-2af6,1 answered SIP/2203-2496 -- Executing Playback("Local/2209@local-2af6,2", "invalid") in new stack -- Playing 'invalid' == Spawn extension (local, 2213, 2) exited non-zero on 'Local/2209@local-2af6,2<ZOMBIE>' ms1*CLI> [I hear the recording on my SIP phone at this point] ms1*CLI> -- Executing NoOp("SIP/2203-2496", "ishouldnotseethis") in new stack -- Executing NoOp("SIP/2203-2496", "") in new stack -- Executing Hangup("SIP/2203-2496", "") in new stack == Spawn extension (local, 2209, 109) exited non-zero on 'SIP/2203-2496' ms1*CLI>