Hello Steve,

Thanks again for the effort.
I tried your dialplan like this in my extention:

exten=> 777,1, Goto(absolute-timeout-test,777,1)
[absolute-timeout-test]
        exten = T,1,                    verbose(1,[${CONTEXT}:${EXTEN}])
        exten = T,n,                    hangup()

        exten = h,1,                    verbose(1,[${CONTEXT}:${EXTEN}])
        exten = h,n,                    hangup()

        exten = 777,1,                  verbose(1,[${CONTEXT}:${EXTEN}])
        exten = 777,n,                  set(TIMEOUT(absolute)=10)
        exten = 777,n,                  dial(IAX2/400)
        exten = 777,n,                  hangup()

Then user IAX/200 calls 777, here is my output:

debian*CLI> set verbose 3
Verbosity is at least 3
    -- Accepting AUTHENTICATED call from 192.168.1.34:
       > requested format = ulaw,
       > requested prefs = (),
       > actual format = ulaw,
       > host prefs = (ulaw|alaw),
       > priority = mine
    -- Executing [...@iax:1] Dial("IAX2/200-7016", "IAX2/777|60") in new stack
[Jun  7 18:52:16] WARNING[4264]: chan_iax2.c:3034 create_addr: No such host: 777
[Jun  7 18:52:16] WARNING[4264]: app_dial.c:1183 dial_exec_full: Unable to 
create channel of type 'IAX2' (cause 3 - No route to destination)
  == Everyone is busy/congested at this time (1:0/0/1)
  == Auto fallthrough, channel 'IAX2/200-7016' status is 'CHANUNAVAIL'

I do not know why it is printing No such host:777

For the STDOUT (System.out.println) i was watching what the AgiServer printing 
as information.


Regrads

 



________________________________
De : Steve Edwards <[email protected]>
À : Asterisk Users Mailing List - Non-Commercial Discussion 
<[email protected]>
Envoyé le : Lun 7 juin 2010, 17h 52min 09s
Objet : Re: [asterisk-users] Controlling calls

On Mon, 7 Jun 2010, Adil Zaaraoui wrote:

> I tried your statement in my extension like this:

("context" or "dialplan" would be "more correct" than "extension.")

>   exten = 777,n,                  set(TIMEOUT(absolute)=10)
>   exten = 777,n,                  dial(iax2/400)
>   exten = 777,n,                  hangup()
> 
> If peer (400) answers the call the call persists, no autohangup is made after 
> 10 senconds (absolute timeout), but the if peer does not hangup, it rings for 
> 10 seconds and stops.

This is unexpected. When the absolute timer expires, the call should "jump" to 
the "T" extension in the context. If there isn't a "T" extension, the call 
should hang up.

Please use a "goto(absolute-timeout-test,777,1)" to execute the following 
context with the CLI verbosity set to at least 3:

[absolute-timeout-test]
        exten = T,1,                    verbose(1,[${CONTEXT}:${EXTEN}])
        exten = T,n,                    hangup()

        exten = h,1,                    verbose(1,[${CONTEXT}:${EXTEN}])
        exten = h,n,                    hangup()

        exten = 777,1,                  verbose(1,[${CONTEXT}:${EXTEN}])
        exten = 777,n,                  set(TIMEOUT(absolute)=10)
        exten = 777,n,                  dial(sip/201)
        exten = 777,n,                  hangup()

And compare your console output to:

[absolute-timeout-test:777]
    -- Executing Set("SIP/501-090e8700", "TIMEOUT(absolute)=10") in new stack
    -- Channel will hangup at 2010-06-07 15:34:29 UTC.
    -- Executing Dial("SIP/501-090e8700", "sip/201") in new stack
    -- Called 201
    -- SIP/201-0910b9a8 is ringing
    -- SIP/201-0910b9a8 answered SIP/501-090e8700
    -- Attempting native bridge of SIP/501-090e8700 and SIP/201-0910b9a8
  == Spawn extension (absolute-timeout-test, 777, 3) exited non-zero on 
'SIP/501-090e8700'
    -- Executing Verbose("SIP/501-090e8700", "1|[absolute-timeout-test:T]") in 
new stack
[absolute-timeout-test:T]
    -- Executing Hangup("SIP/501-090e8700", "") in new stack
  == Spawn extension (absolute-timeout-test, T, 2) exited non-zero on 
'SIP/501-090e8700'
    -- Executing Verbose("SIP/501-090e8700", "1|[absolute-timeout-test:h]") in 
new stack
[absolute-timeout-test:h]
    -- Executing Hangup("SIP/501-090e8700", "") in new stack
  == Spawn extension (absolute-timeout-test, h, 2) exited non-zero on 
'SIP/501-090e8700'

I'm calling from SIP/501 to SIP/201, but your output should be similar.

While following the console output, I realize this solution may not do what you 
want. The absolute timer starts counting when it is set, not when the peer 
answers the call. I don't know if this difference is important to your 
application.

Looking at the dial application options again, there is "S(x) - Hang up the 
call after 'x' seconds *after* the called party has answered the call." This 
may be more appropriate for you. I'd still recommend looking up the peer and 
duration in the AGI, set channel variables, and then do the dial command in the 
dialplan.

> "Are you saying that when you execute the dial application from your AGI 
> Asterisk dials the peer and when peer answers they get dead air for 13 
> seconds before being bridged with the caller?"
> 
> No, the communication is up we hear each other, but the satament 
> System.out.println("after dial app") which is just after exec("dial.... is 
> executed after about 13 seconds, and sometimes not, the dial blocks the 
> script to continue.

Going back to a previous email where you asked what I meant about it being easy 
to violate the AGI protocol:

> The AGI protocol is implemented by issuing requests and receiving responses 
> via STDOUT and STDIN respectively. (FastAGI uses network sockets.)
> 
> Most programmer's first "fail" is not reading the AGI environment from STDIN 
> first. Next, they fail to realize that for every request, they must read the 
> response. Lastly, they try to debug their AGI by reading something from STDIN 
> or writing something to STDOUT, not remembering that STDIN and STDOUT are 
> "connected" to Asterisk, not their console.
> 
> I always recommend that programmers use an existing library rather than 
> developing their own. The chance of success is much higher.
> 
> Most AGI problems I have seen (mine and others) can be resolved by 
> understanding the above and enabling AGI debugging on the console and 
> observing the output.

I'm not a Java programmer, but "System.out.println()" sounds like writing 
something to STDOUT to me. If you are still executing your AGI via FastAGI 
("agi://") this may not apply.

Note that I say "AGI" not "script." An AGI can (and should IMHO) be written in 
a compiled language like C.

> How to set the channel variable in the AGI script??

This depends on your AGI library. There should be a function or method that 
ends up sending "set variable x y" to Asterisk.

-- Thanks in advance,
-------------------------------------------------------------------------
Steve Edwards      [email protected]      Voice: +1-760-468-3867 PST
Newline                                              Fax: +1-760-731-3000



      
-- 
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
               http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Reply via email to