[asterisk-users] Urgent help = RUBY & AGI
Jim Dickenson
dickenson at cfmc.com
Tue Jul 27 10:31:16 CDT 2010
I have never used 1.2.9.1 or anything in the 1.2.x range so I can not give you an exact solution but I can tell you that the script that you are using will not work. In the dial command you need to add the M option which will call a macro when the call is connected. In that macro you can then find the channel that answered the call and do what you want from there. You can call another AGI or set variables or whatever. If agi.exec works like a dialplan step then the dial step will hang if the call is answered and the agi.get_variable statement will not execute unless the call was not answered.
Try
> r = $agi.exec('DIAL', SIP/voipuser&Zap/32&Zap/33&Zap/34&Zap/35,,M(testing))
And then have something like this in extensions.conf
[macro-testing]
exten => s,1,DumpChan()
You will see that this macro runs when the call is answered and you will see on the CLI all the variables that are available to you. ${CHANNEL} will have SIP/ voipuser-e989 in your example below.
--
Jim Dickenson
mailto:dickenson at cfmc.com
CfMC
http://www.cfmc.com/
On Jul 27, 2010, at 7:21 AM, Zarko Zivanovic wrote:
> Here’s something that should be easy for RUBY pro’s.
>
> Here is a script:
>
> 1.times do
> r = $agi.exec('DIAL', SIP/voipuser&Zap/32&Zap/33&Zap/34&Zap/35)
> r = $agi.get_variable('DIALSTATUS')
>
> # $agi.set_variable(' WHOANSWERED ',...)
>
> retry if r.message.include?('BUSY')
> end
>
>
> when it’s executed it shows this in the console:
>
>
>
> AGI Rx << ANSWER
> AGI Tx >> 200 result=0
> AGI Rx << EXEC DIAL SIP/voipuser&Zap/32&Zap/33&Zap/34&Zap/35
> -- AGI Script Executing Application: (DIAL) Options: (SIP/voipuser&Zap/32&Zap/33&Zap/34&Zap/35)
> -- Called voipuser
> -- Called 32
> -- Called 33
> -- Called 34
> -- Called 35
> -- Zap/32-1 is ringing
> -- Zap/33-1 is ringing
> -- Zap/34-1 is ringing
> -- Zap/35-1 is ringing
> -- SIP/voipuser-e989 is ringing
> -- SIP/ voipuser-e989 answered Zap/1-1
>
>
> What we need is to be able to populate the variable WHOANSWERED with info SIP/ voipuser
> In this case, or whoever answers next time.
>
> Thanks in advance!
>
>
>
>
>
>
>
>
> __________ Information from ESET NOD32 Antivirus, version of virus signature database 5317 (20100727) __________
>
> The message was checked by ESET NOD32 Antivirus.
>
> http://www.eset.com
> --
> _____________________________________________________________________
> -- 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20100727/714ba7fe/attachment.htm
More information about the asterisk-users
mailing list