[asterisk-users] Urgent help = RUBY & AGI
Zarko Zivanovic
outlaw011 at gmail.com
Tue Jul 27 11:28:45 CDT 2010
Jim thanks.
I will test this first thing in the morning as I am out of the office now.
As a matter of fact I cant wait to test this, as it has been the first
reasonable thing that looks like it could work.
In the meantime , do you happen to know if there is a way to call both macro
(M) and music on hold (m) in that $agi.exec line?
or is the right thing to do to place moh command in macro?
As I said, I cant wait to try it first thing in the morning and tell you
(and others) how it went. I am sure this will be the good reference to other
people looking for the same thing online as I have found quite a bunch of
similar open threads.
Zarko
On Tue, Jul 27, 2010 at 5:31 PM, Jim Dickenson <dickenson at cfmc.com> wrote:
> 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 <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
>
>
>
> --
> _____________________________________________________________________
> -- 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/20775cbe/attachment.htm
More information about the asterisk-users
mailing list