[Home]

Summary:ASTERISK-12488: Bridging channels too early when Macro is used to control callee leg
Reporter:Beri bener (tapic)Labels:
Date Opened:2008-07-30 18:21:42Date Closed:2011-06-07 14:02:45
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Applications/app_dial
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) 20080801__issue13200.diff
Description:Expected flow:
mikail calls 200.
mikail hears welcome.
mikail hears ringing. beri's phone start to ring.
beri picks up the phone and hears welcome.
beri presses a key.
if beri has pressed 5 then mikail and beri should start conversation - else beri should be hanged up and mikail should continue to interact.

AGI script (FastAGI- runs on machine 10.10.1.41):

AGI.StreamFile("welcome");
AGI.Execute("Dial", "SIP/beri|25|A(welcome)M(agentmacro)");

Dialplan:

[default]
exten =>  _273,1,Dial(SIP/beri)
exten =>  _275,1,Dial(SIP/mikail)

exten => _200,1,AGI(agi://10.10.1.41/customivr)
exten => _200,2,Hangup()

[macro-agentmacro]
exten => s,1,Read(ACCEPT||1)
exten => s,n,GotoIf($[${ACCEPT}=5]?yes:no)
exten => s,n(no),Set(MACRO_RESULT=CONTINUE)
exten => s,n(yes),Set(test=1)

*CLI output :
 == Spawn extension (default, 200, 1) exited non-zero on 'SIP/mikail-081d9420'
   -- Executing [200@default:1] AGI("SIP/mikail-081d9420", "agi://10.10.1.41/customivr") in new stack
   -- Playing 'welcome' (escape_digits=) (sample_offset 0)
   -- AGI Script Executing Application: (Dial) Options: (SIP/beri|25|A(welcome)M(agentmacro))
   -- Called beri
   -- SIP/beri-081e8b18 is ringing
   -- SIP/beri-081e8b18 answered SIP/mikail-081d9420
@@  -- <SIP/beri-081e8b18> Playing 'welcome' (language 'en')
   -- Executing [s@macro-agentmacro:1] Read("SIP/beri-081e8b18", "ACCEPT|welcome|1") in new stack
   -- Accepting a maximum of 1 digits.
   -- <SIP/beri-081e8b18> Playing 'welcome' (language 'en')
   -- User entered '5'
   -- Executing [s@macro-agentmacro:2] GotoIf("SIP/beri-081e8b18", "1?yes:no") in new stack
   -- Goto (macro-agentmacro,s,4)
   -- Executing [s@macro-agentmacro:4] Set("SIP/beri-081e8b18", "test=1") in new stack
   -- Native bridging SIP/mikail-081d9420 and SIP/beri-081e8b18
 == Spawn extension (default, 200, 1) exited non-zero on 'SIP/mikail-081d9420'

line with @@ : this file does not play here although it says so. And already bridged here, although it is expected to bridge after beri enters 5. After asterisk restart, everything works as expected for 1-2 times.
I have also seen :  ERROR[4883]: app_dial.c:1581 dial_exec_full: Could not stop autoservice on calling channel if caller side hangups the phone.

Same result with the configuration below:

FastAGI:
AGI.StreamFile("welcome");  
AGI.Execute("Dial", "SIP/beri|25|M(agentmacro)");

[macro-agentmacro]
exten => s,1,Answer()
exten => s,n,Wait(1)
exten => s,n,Read(ACCEPT|welcome|1)
exten => s,n,GotoIf($[${ACCEPT}=5]?yes:no)
exten => s,n(no),Set(MACRO_RESULT=CONTINUE)
exten => s,n(yes),Set(test=1)

*CLI

   -- Executing [200@default:1] AGI("SIP/mikail-081e3090", "agi://10.10.1.41/customivr") in new stack
   -- Playing 'welcome' (escape_digits=) (sample_offset 0)
   -- AGI Script Executing Application: (Dial) Options: (SIP/beri|25|M(agentmacro))
   -- Called beri
   -- SIP/beri-081e8870 is ringing
   -- SIP/beri-081e8870 answered SIP/mikail-081e3090
@@  -- Executing [s@macro-agentmacro:1] Answer("SIP/beri-081e8870", "") in new stack
   -- Executing [s@macro-agentmacro:2] Wait("SIP/beri-081e8870", "1") in new stack
   -- Executing [s@macro-agentmacro:3] Read("SIP/beri-081e8870", "ACCEPT|welcome|1") in new stack
   -- Accepting a maximum of 1 digits.
@@  -- <SIP/beri-081e8870> Playing 'welcome' (language 'en')
   -- User entered '5'
   -- Executing [s@macro-agentmacro:4] GotoIf("SIP/beri-081e8870", "1?yes:no") in new stack
   -- Goto (macro-agentmacro,s,6)
   -- Executing [s@macro-agentmacro:6] Set("SIP/beri-081e8870", "test=1") in new stack
   -- Native bridging SIP/mikail-081e3090 and SIP/beri-081e8870
 == Spawn extension (default, 200, 1) exited non-zero on 'SIP/mikail-081e3090'

bridging happens on 1st @@ line and welcome does not get played as said in 2nd @@ line.


Thank you for your help.


****** ADDITIONAL INFORMATION ******

My system is:
ubuntu 2.6.24-16-server
Comments:By: Brett Bryant (bbryant) 2008-07-31 19:08:23

tapic, please try the following patch and see if it fixes your issue. When an annoucement is played, asterisk automatically waits for a key press to continue on with the call. I'm not sure why it does this, but by moving the order of operations around and letting the macro execute first then the macro can control after the peer has been connected whether the annoucement will play and the call will be connected.



By: Beri bener (tapic) 2008-08-01 03:00:07

thank you for the update.
The unexpected behavior is not observed in Asterisk 1.4.11.

How should I apply this patch? I could not find any information on the net about applying patches to Asterisk. When I do wget in CLI in asterisk source directory I get :

root@trcivr1:/usr/src/asterisk-1.4.21.2# wget 'http://bugs.digium.com/file_download.php?file_id=19738&type=bug' -O - | patch -p0
--11:07:15--  http://bugs.digium.com/file_download.php?file_id=19738&type=bug
          => `-'
Resolving bugs.digium.com... 216.27.40.102
Connecting to bugs.digium.com|216.27.40.102|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 7,876 (7.7K) [text/plain]

100%[=====================================================================================================================================>] 7,876         15.70K/s

11:07:16 (15.67 KB/s) - `-' saved [7876/7876]

can't find file to patch at input line 5
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|Index: channels/chan_dahdi.c
|===================================================================
|--- channels/chan_dahdi.c      (revision 134653)
|+++ channels/chan_dahdi.c      (working copy)
--------------------------
File to patch:

(end of my message)



By: Brett Bryant (bbryant) 2008-08-01 07:24:25

tapic, that's the correct way to apply it i just made a mistake in the patch. Please try the new one the same way.

By: snuffy (snuffy) 2008-08-19 01:39:21

Have you tried the updated patch?, your feedback is required on this issue.

By: Leif Madsen (lmadsen) 2008-12-05 11:01:48.000-0600

tapic: as you are the original reporter of this issue, we need your feedback in order to resolve the issue. Please let us know if the attached patch works for you. I will need to close this issue in a week if it appears we can't move it forward, but you are welcome to ask a bug marshall in #asterisk-bugs to reopen the issue for you on the IRC network at irc.freenode.net should it get closed before you have a chance to test it. Thanks!

By: Mark Michelson (mmichelson) 2009-01-20 18:36:32.000-0600

As much as I don't like doing this, I am suspending this issue since there has been no response from the reporter since a new patch was uploaded last August.