Re: [asterisk-users] Urgent help = RUBY AGI

2010-07-29 Thread Zarko Zivanovic
Unfortunately, even after two more days of testing, I was not able to get
that channel info from macro into my ruby script.

As it is now - I do not see the way to do it, and this is unsolved.

If any of you good folks have any idea how to pull the dumpchan data from
macro to ruby/agi script please let me know.







On Wed, Jul 28, 2010 at 2:02 PM, Zarko Zivanovic outlaw...@gmail.comwrote:

  Works like charm Danny,



 Tested and works fine.



 I sent this to Jim, but this is something you could know:



 I managed to start a macro and get info about the channel that picked up
 the call.

 Also, as said in the thread, i was able to start moh beside the macro and
 it all works like charm.



 The only thing that I cant do so far, is capturing the ${CHANNEL} variable
 in the ruby script that started the macro.



 Is that variable accessible from the ruby script too or just from the
 macro?



 Here’s a snippet from my ruby script:





 dial_params  ||M(testing)m(moh-0900...@moh_id})
 if moh_available?()



 1.times do

 r = $agi.exec('DIAL', dial_params)

 r = $agi.get_variable('DIALSTATUS')

 retry if r.message.include?('BUSY')


 end




 and further below:



 $loc = testing



 $my.query(UPDATE call_log SET
 local='#{$loc}', endtime = NOW() WHERE id = #{call_log_id})



 Works fine, but as soon as I try:



 $loc = ${CHANNEL} or something like that – it breaks. Any idea how to pass
 that ${CHANNEL} to my ruby script and use it to update DB in that query?





 Thanks a bunch !

















 *From:* asterisk-users-boun...@lists.digium.com [mailto:
 asterisk-users-boun...@lists.digium.com] *On Behalf Of *Danny Nicholas
 *Sent:* Tuesday, July 27, 2010 6:32 PM
 *To:* 'Asterisk Users Mailing List - Non-Commercial Discussion'

 *Subject:* Re: [asterisk-users] Urgent help = RUBY  AGI



 *From:* asterisk-users-boun...@lists.digium.com [mailto:
 asterisk-users-boun...@lists.digium.com] *On Behalf Of *Zarko Zivanovic
 *Subject:* Re: [asterisk-users] Urgent help = RUBY  AGI



 snip
 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?

 This should work:

   r = $agi.exec('DIAL', SIP/voipuserZap/32Zap/33Zap/34Zap/35,,m
 M(testing))





 __ Information from ESET NOD32 Antivirus, version of virus
 signature database 5318 (20100727) __


 The message was checked by ESET NOD32 Antivirus.

 http://www.eset.com



 __ Information from ESET NOD32 Antivirus, version of virus
 signature database 5319 (20100728) __


 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

Re: [asterisk-users] Urgent help = RUBY AGI

2010-07-29 Thread Danny Nicholas
 

Strictly a shot in the dark, but have you tried
$loc=$agi.get_variable('CHANNEL') ?

-- 
_
-- 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

Re: [asterisk-users] Urgent help = RUBY AGI

2010-07-29 Thread Zarko Zivanovic
Danny hi, I just did:

 

$loc=$agi.get_variable('CHANNEL')

 

$my.query(UPDATE call_log SET local = #{$loc},
endtime = NOW() WHERE id = #{call_log_id})   

 

 

 

No success - what happens is that it breaks somewhere and neither local nor
endtime gets updated.

 

If i remove $loc = ... and SET local = #{$loc}, from query, it works.

 

Here is the logging from the console that I have now:

 

 

 

 

 

 

-- SIP/vaso-065a answered Zap/22-1

-- Hungup 'Zap/35-1'

-- Hungup 'Zap/34-1'

-- Hungup 'Zap/33-1'

-- Hungup 'Zap/32-1'

-- Executing DumpChan(SIP/vaso-065a, ) in new stack

 

Dumping Info For Channel: SIP/vaso-065a:




Info:

Name=   SIP/vaso-065a

Type=   SIP

UniqueID=   1280409971.1496

CallerID=   8221

CallerIDName=   (N/A)

DNIDDigits= (N/A)

State=  Up (6)

Rings=  0

NativeFormat=   2

WriteFormat=4

ReadFormat= 4

1stFileDescriptor=  74

Framesin=   4

Framesout=  0

TimetoHangup=   0

ElapsedTime=0h0m0s

Context=macro-testing

Extension=  s

Priority=   1

CallGroup=

PickupGroup=

Application=DumpChan

Data=   (Empty)

Blocking_in=(Not Blocking)

 

Variables:

MACRO_DEPTH=1

MACRO_PRIORITY=1

MACRO_CONTEXT=siptest




-- Executing Set(SIP/vaso-065a, WHO=SIP/vaso-065a) in new stack

-- Executing Answer(SIP/vaso-f139, ) in new stack

  == Auto fallthrough, channel 'SIP/vaso-f139' status is 'UNKNOWN'

-- Channel 0/22, span 1 got hangup request

AGI Tx  200 result=-1

  == Spawn extension (incoming, 8221, 1) exited non-zero on 'Zap/22-1'

-- Hungup 'Zap/22-1'

-- Executing Answer(SIP/vaso-e6cd, ) in new stack

  == Auto fallthrough, channel 'SIP/vaso-e6cd' status is 'UNKNOWN'

 

 

In case you wanted to tell me to try 

 

$loc=$agi.get_variable('WHO') - tried that too, same thing.

 

 

This is driving me nuts to be frank.

 

 

 

 

 

From: asterisk-users-boun...@lists.digium.com
[mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Danny Nicholas
Sent: Thursday, July 29, 2010 3:09 PM
To: 'Asterisk Users Mailing List - Non-Commercial Discussion'
Subject: Re: [asterisk-users] Urgent help = RUBY  AGI

 

 

Strictly a shot in the dark, but have you tried
$loc=$agi.get_variable('CHANNEL') ?



__ Information from ESET NOD32 Antivirus, version of virus signature
database 5323 (20100729) __

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

Re: [asterisk-users] Urgent help = RUBY AGI

2010-07-29 Thread Danny Nicholas
I can't even spell RUBY, so I don't have a clue as to how the AGI works.  I
do know a little bit about AGI in general.  The way I typically run my AGI's
is something like this:

exten = 933,1,Answer

exten = 933,n,Set(ABA=02107)

exten = 933,n,Set(city=Birmingham)

exten = 933,n,Set(state=AL)

exten = 933,n,Set(zip=35244)

exten =
933,n,AGI(cityweather.agi,${ABA},${city},${state},${zip},${CHANNEL(language)
})

exten = 933,n,hangup()

 

I'm a PERL weenie, so I can shell check my agi's by going to
/var/lib/asterisk/agi-bin and doing

./cityweather.agi 02107 Birmingham AL 35244 en

 

And getting back a STDOUT output that simulates what I should get from the
CLI output.

-- 
_
-- 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

Re: [asterisk-users] Urgent help = RUBY AGI

2010-07-29 Thread Zarko Zivanovic
That looks easy. I must say that I am very frustrated as this has took my
all week, and beside dumpling that data via macro I wasnt able to
use that data in the ruby script that we have. I didnt write the script is
something old that we use but i was sure we could add few things in that
very script and continue
to use it. I posted almost all script that we use and it surprised me that
no one was able to find the solution so far.

Zarko




On Thu, Jul 29, 2010 at 3:46 PM, Danny Nicholas da...@debsinc.com wrote:

  I can’t even spell RUBY, so I don’t have a clue as to how the AGI works.
 I do know a little bit about AGI in general.  The way I typically run my
 AGI’s is something like this:

 exten = 933,1,Answer

 exten = 933,n,Set(ABA=02107)

 exten = 933,n,Set(city=Birmingham)

 exten = 933,n,Set(state=AL)

 exten = 933,n,Set(zip=35244)

 exten =
 933,n,AGI(cityweather.agi,${ABA},${city},${state},${zip},${CHANNEL(language)})

 exten = 933,n,hangup()



 I’m a PERL weenie, so I can “shell check” my agi’s by going to
 /var/lib/asterisk/agi-bin and doing

 ./cityweather.agi 02107 Birmingham AL 35244 en



 And getting back a STDOUT output that simulates what I should get from the
 CLI output.

 --
 _
 -- 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

Re: [asterisk-users] Urgent help = RUBY AGI

2010-07-29 Thread Steve Edwards

On Thu, 29 Jul 2010, Danny Nicholas wrote:

I’m a PERL weenie, so I can “shell check” my agi’s by going to 
/var/lib/asterisk/agi-bin and doing


./cityweather.agi 02107 Birmingham AL 35244 en

And getting back a STDOUT output that simulates what I should get from 
the CLI output.


You can go a step further and feed the AGI environment and responses to 
your AGI requests.


Create a file like:

agi_accountcode:
agi_callerid: 1234567890
agi_calleridname: sedwards
.
.
.
agi_request: cityweather.agi
agi_type: SIP
agi_uniqueid: 1195070681.28

200 result=1 (localhost)
200 result=1 (dbuser)
200 result=1 (dbpass)

This would feed the AGI environment* and database credentials (via channel 
variables) to your AGI when executed like:


./cityweather.agi 02107 Birmingham AL 35244 en agi-env-n-resp

As long as you don't need to directly interact with a live Asterisk 
instance (like the OP), you can get a lot of debugging done offline.


*) At least 1 of the published AGI libraries assumes the environment is 
presented in a specific order. Personally, I prefer to present the 
environment in alphabetic order and coded my library to parse it 
correctly.


--
Thanks in advance,
-
Steve Edwards   sedwa...@sedwards.com  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

Re: [asterisk-users] Urgent help = RUBY AGI

2010-07-29 Thread Jim Dickenson
Do you just have one agi you are running? If so that will not work. Your one 
agi is hung on the dial step until it finishes at which time the agi will go 
away, I think. You need the one agi to cause the dial to occur and another one 
to capture the information when the macro runs. You can try adding option g to 
the dial command and then retrieve the variable you set in the macro after the 
dial step finishes. I do not use agi's much so I might be off base with all 
this but it is something to look in to.
-- 
Jim Dickenson
mailto:dicken...@cfmc.com

CfMC
http://www.cfmc.com/



On Jul 29, 2010, at 7:22 AM, Zarko Zivanovic wrote:

 That looks easy. I must say that I am very frustrated as this has took my all 
 week, and beside dumpling that data via macro I wasnt able to
 use that data in the ruby script that we have. I didnt write the script is 
 something old that we use but i was sure we could add few things in that very 
 script and continue
 to use it. I posted almost all script that we use and it surprised me that no 
 one was able to find the solution so far.
 
 Zarko
 
 
 
 
 On Thu, Jul 29, 2010 at 3:46 PM, Danny Nicholas da...@debsinc.com wrote:
 I can’t even spell RUBY, so I don’t have a clue as to how the AGI works.  I 
 do know a little bit about AGI in general.  The way I typically run my AGI’s 
 is something like this:
 
 exten = 933,1,Answer
 
 exten = 933,n,Set(ABA=02107)
 
 exten = 933,n,Set(city=Birmingham)
 
 exten = 933,n,Set(state=AL)
 
 exten = 933,n,Set(zip=35244)
 
 exten = 
 933,n,AGI(cityweather.agi,${ABA},${city},${state},${zip},${CHANNEL(language)})
 
 exten = 933,n,hangup()
 
  
 I’m a PERL weenie, so I can “shell check” my agi’s by going to 
 /var/lib/asterisk/agi-bin and doing
 
 ./cityweather.agi 02107 Birmingham AL 35244 en
 
  
 And getting back a STDOUT output that simulates what I should get from the 
 CLI output.
 
 
 --
 _
 -- 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

-- 
_
-- 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

Re: [asterisk-users] Urgent help = RUBY AGI

2010-07-28 Thread Zarko Zivanovic
Update on this - breaktrough! :-)

 

Finally, I was able to do it. Yes you were right again as you said, I saw
that you mentioned using macros but for some reason I thought that macros
were not available in asterisk 1.2...

 

So what I managed to do is o start a macro and get info about the channel
that picked up the call. 

Also, as said in the thread, i was able to start moh beside the macro and it
all works like charm.

 

The only thing that I cant do so far, is capturing the ${CHANNEL} variable
in the ruby script that started the macro.

 

Is that variable accessible from the ruby script too or just from the macro?

 

Here's a snippet from my ruby script:

 

 

dial_params  ||M(testing)m(moh-0900...@moh_id})
if moh_available?()

 

1.times do

r = $agi.exec('DIAL', dial_params)

r = $agi.get_variable('DIALSTATUS')

retry if r.message.include?('BUSY')

end


 

and further below:

 

$loc = testing



$my.query(UPDATE call_log SET
local='#{$loc}', endtime = NOW() WHERE id = #{call_log_id})

 

Works fine, but as soon as I try:

 

$loc = ${CHANNEL} or something like that - it breaks. Any idea how to pass
that ${CHANNEL} to my ruby script and use it to update DB in that query?

 

 

Thanks a bunch !

 

 

 

 

 

 

From: asterisk-users-boun...@lists.digium.com
[mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Jim Dickenson
Sent: Tuesday, July 27, 2010 5:31 PM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: Re: [asterisk-users] Urgent help = RUBY  AGI

 

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/voipuserZap/32Zap/33Zap/34Zap/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:dicken...@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/voipuserZap/32Zap/33Zap/34Zap/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/voipuserZap/32Zap/33Zap/34Zap/35

-- AGI Script Executing Application: (DIAL) Options:
(SIP/voipuserZap/32Zap/33Zap/34Zap/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

 



__ Information from ESET NOD32 Antivirus, version of virus signature
database 5318 (20100727) __

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com

-- 
_
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New

Re: [asterisk-users] Urgent help = RUBY AGI

2010-07-28 Thread Zarko Zivanovic
Just to mention... I also tried:

 

 

$my.query(UPDATE call_log SET local='#{$CHANNEL}', endtime = NOW() WHERE id
= #{call_log_id})

 

 

But then the local is empty - meaning $CHANNEL is empty in ruby.

 

The question is how do i pass that macro dumpchan data to ruby?

 

Zrko

 

From: asterisk-users-boun...@lists.digium.com
[mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Jim Dickenson
Sent: Tuesday, July 27, 2010 6:35 PM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: Re: [asterisk-users] Urgent help = RUBY  AGI

 

You can put multiple options in the dial command if that is what you are
asking.

 

And by the way several emails, including a previous one of mine, told you to
use the M option and a macro.

 

In this email I gave you more detailed information but if you had done core
show application dial on CLI you should have been able to ask more directed
questions.

-- 

Jim Dickenson

mailto:dicken...@cfmc.com

 

CfMC

http://www.cfmc.com/

 

 

 

On Jul 27, 2010, at 9:28 AM, Zarko Zivanovic wrote:





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 dicken...@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/voipuserZap/32Zap/33Zap/34Zap/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:dicken...@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/voipuserZap/32Zap/33Zap/34Zap/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/voipuserZap/32Zap/33Zap/34Zap/35

-- AGI Script Executing Application: (DIAL) Options:
(SIP/voipuserZap/32Zap/33Zap/34Zap/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 http://www.eset.com/ 

-- 


_
-- Bandwidth and Colocation Provided by http://www.api-digital.com
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
http://www.api-digital.com/  --
New to Asterisk? Join us for a live introductory webinar every Thurs

Re: [asterisk-users] Urgent help = RUBY AGI

2010-07-28 Thread Zarko Zivanovic
Works like charm Danny,

 

Tested and works fine.

 

I sent this to Jim, but this is something you could know:

 

I managed to start a macro and get info about the channel that picked up the
call. 

Also, as said in the thread, i was able to start moh beside the macro and it
all works like charm.

 

The only thing that I cant do so far, is capturing the ${CHANNEL} variable
in the ruby script that started the macro.

 

Is that variable accessible from the ruby script too or just from the macro?

 

Here's a snippet from my ruby script:

 

 

dial_params  ||M(testing)m(moh-0900...@moh_id})
if moh_available?()

 

1.times do

r = $agi.exec('DIAL', dial_params)

r = $agi.get_variable('DIALSTATUS')

retry if r.message.include?('BUSY')

end


 

and further below:

 

$loc = testing



$my.query(UPDATE call_log SET
local='#{$loc}', endtime = NOW() WHERE id = #{call_log_id})

 

Works fine, but as soon as I try:

 

$loc = ${CHANNEL} or something like that - it breaks. Any idea how to pass
that ${CHANNEL} to my ruby script and use it to update DB in that query?

 

 

Thanks a bunch !

 

 

 

 

 

 

 

 

From: asterisk-users-boun...@lists.digium.com
[mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Danny Nicholas
Sent: Tuesday, July 27, 2010 6:32 PM
To: 'Asterisk Users Mailing List - Non-Commercial Discussion'
Subject: Re: [asterisk-users] Urgent help = RUBY  AGI

 

From: asterisk-users-boun...@lists.digium.com
[mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Zarko
Zivanovic
Subject: Re: [asterisk-users] Urgent help = RUBY  AGI

 

snip
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?

This should work:

r = $agi.exec('DIAL', SIP/voipuserZap/32Zap/33Zap/34Zap/35,,mM(testing))

 



__ Information from ESET NOD32 Antivirus, version of virus signature
database 5318 (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

Re: [asterisk-users] Urgent help = RUBY AGI

2010-07-27 Thread Tim Nelson

- Zarko Zivanovic outlaw...@gmail.com wrote: 
 
Here’s something that should be easy for RUBY pro’s. 



Here's something that would be infinitely easier: 




You could understand that this list isn't your personal technical support 
resource where you can delegate how urgent or not your issue is. If you're 
really having 'urgent' issues, find someone who knows what they're doing and 
pay them. Don't spam the list with 'Urgent' on every new post you make. 




Frankly, I'm surprised you've received such a response already. I had some 
thoughts and ideas on your previous issues but simply chose to ignore you since 
I found your 'Urgency' distasteful. Others apparently have not... 




Tzafrir has already mentioned this to you. Maybe you missed that message? Here 
it is so you may review it: 




http://lists.digium.com/pipermail/asterisk-users/2010-July/251677.html 




--Tim 


-- 
_
-- 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

Re: [asterisk-users] Urgent help = RUBY AGI

2010-07-27 Thread Danny Nicholas
From: asterisk-users-boun...@lists.digium.com
[mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Tim Nelson
Subject: Re: [asterisk-users] Urgent help = RUBY  AGI

 

- Zarko Zivanovic outlaw...@gmail.com wrote: 
 

Here's something that should be easy for RUBY pro's. 

 My .02 (perhaps irrelevant);  Out of the thousands/millions of Asterisk
users (and the hundreds/thousands that read and reply to this list), I would
wager that a very small percentage of us (royal we) are Ruby pro's.  From
what I read, the language proficiencies of most users are either PHP, Perl
or C.  Once you stop making things urgent and become as Asterisk Pro,
perhaps you will also be this Ruby Pro that you speak of :-)

-- 
_
-- 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

Re: [asterisk-users] Urgent help = RUBY AGI

2010-07-27 Thread Kevin P. Fleming
On 07/27/2010 09:38 AM, Danny Nicholas wrote:
 *From:* asterisk-users-boun...@lists.digium.com
 [mailto:asterisk-users-boun...@lists.digium.com] *On Behalf Of *Tim Nelson
 *Subject:* Re: [asterisk-users] Urgent help = RUBY  AGI
 
  
 
 - Zarko Zivanovic outlaw...@gmail.com wrote:

 
Here’s something that should be easy for RUBY pro’s.
 
  My .02 (perhaps irrelevant);  Out of the thousands/millions of Asterisk
 users (and the hundreds/thousands that read and reply to this list), I
 would wager that a very small percentage of us (royal we) are “Ruby
 pro’s”.  From what I read, the language proficiencies of most users are
 either PHP, Perl or C.  Once you stop making things urgent and become as
 “Asterisk Pro”, perhaps you will also be this “Ruby Pro” that you speak of J

... and since you are using Ruby already, you could switch to using the
Adhearsion framework, which makes interaction with Asterisk trivially
easy, and handles all the AGI/AMI stuff 'under the covers' for you.

-- 
Kevin P. Fleming
Digium, Inc. | Director of Software Technologies
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
skype: kpfleming | jabber: kflem...@digium.com
Check us out at www.digium.com  www.asterisk.org

-- 
_
-- 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


Re: [asterisk-users] Urgent help = RUBY AGI

2010-07-27 Thread Zarko Zivanovic
I am sorry, I wasn’t aware that there is such a problem with urgency, as well 
as I never found it when it was directed to me on the other boards and lists, 
but that is the whole other issue.

I always try to help others with what I know (In this area I must say that is 
not much), and I admit that once a while when I bump into an area that I do not 
know much of, as this one,

I get frustrated with being unable to do some things that look pretty basic.

 

And yes, so far I got much more replies where people were directing me to other 
solutions not related to issue I have and that is why i decided to start this 
thread and mention that

I look to a solution to this very specific problem and I am not able to install 
other packages, use other languages etc. It should be that simple.

 

Again I am apologizing for urgency, as much as I didnt mean to cause stress to 
any of users, neither to cause any harm.

 

But for my 2 cents, let me say that it really surprised me that so far I didnt 
get a single precise answer to the question even though I posted almost a full 
script that we are using atm.

 

 

 

 

From: asterisk-users-boun...@lists.digium.com 
[mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Tim Nelson
Sent: Tuesday, July 27, 2010 4:30 PM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: Re: [asterisk-users] Urgent help = RUBY  AGI

 

- Zarko Zivanovic outlaw...@gmail.com wrote: 
 

Here’s something that should be easy for RUBY pro’s. 

 

Here's something that would be infinitely easier:

 

You could understand that this list isn't your personal technical support 
resource where you can delegate how urgent or not your issue is. If you're 
really having 'urgent' issues, find someone who knows what they're doing and 
pay them. Don't spam the list with 'Urgent' on every new post you make.

 

Frankly, I'm surprised you've received such a response already. I had some 
thoughts and ideas on your previous issues but simply chose to ignore you since 
I found your 'Urgency' distasteful. Others apparently have not...

 

Tzafrir has already mentioned this to you. Maybe you missed that message? Here 
it is so you may review it:

 

http://lists.digium.com/pipermail/asterisk-users/2010-July/251677.html

 

--Tim

 



__ 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

Re: [asterisk-users] Urgent help = RUBY AGI

2010-07-27 Thread Zarko Zivanovic
Thanks Danny,

 

I have no intentions to become either Ruby pro or Asterisk pro, and I
believe that there are many people here who understand asterisk much better
than I will ever do.

 

That is why I am here and looking for this specific fix.

 

 

 

 

From: asterisk-users-boun...@lists.digium.com
[mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Danny Nicholas
Sent: Tuesday, July 27, 2010 4:38 PM
To: 'Asterisk Users Mailing List - Non-Commercial Discussion'
Subject: Re: [asterisk-users] Urgent help = RUBY  AGI

 

From: asterisk-users-boun...@lists.digium.com
[mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Tim Nelson
Subject: Re: [asterisk-users] Urgent help = RUBY  AGI

 

- Zarko Zivanovic outlaw...@gmail.com wrote: 
 

Here's something that should be easy for RUBY pro's. 

 My .02 (perhaps irrelevant);  Out of the thousands/millions of Asterisk
users (and the hundreds/thousands that read and reply to this list), I would
wager that a very small percentage of us (royal we) are Ruby pro's.  From
what I read, the language proficiencies of most users are either PHP, Perl
or C.  Once you stop making things urgent and become as Asterisk Pro,
perhaps you will also be this Ruby Pro that you speak of J



__ 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

Re: [asterisk-users] Urgent help = RUBY AGI

2010-07-27 Thread Zarko Zivanovic
Hello Kevin.

Thanks for your suggestion, these ruby scripts are something that we
currently cant change due to many reasons.
We are currently only looking for that specific fix that no one seemed to be
able to sort out so far.




-Original Message-
From: asterisk-users-boun...@lists.digium.com
[mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Kevin P.
Fleming
Sent: Tuesday, July 27, 2010 4:42 PM
To: asterisk-users@lists.digium.com
Subject: Re: [asterisk-users] Urgent help = RUBY  AGI

On 07/27/2010 09:38 AM, Danny Nicholas wrote:
 *From:* asterisk-users-boun...@lists.digium.com
 [mailto:asterisk-users-boun...@lists.digium.com] *On Behalf Of *Tim Nelson
 *Subject:* Re: [asterisk-users] Urgent help = RUBY  AGI
 
  
 
 - Zarko Zivanovic outlaw...@gmail.com wrote:

 
Here's something that should be easy for RUBY pro's.
 
  My .02 (perhaps irrelevant);  Out of the thousands/millions of Asterisk
 users (and the hundreds/thousands that read and reply to this list), I
 would wager that a very small percentage of us (royal we) are Ruby
 pro's.  From what I read, the language proficiencies of most users are
 either PHP, Perl or C.  Once you stop making things urgent and become as
 Asterisk Pro, perhaps you will also be this Ruby Pro that you speak of
J

... and since you are using Ruby already, you could switch to using the
Adhearsion framework, which makes interaction with Asterisk trivially
easy, and handles all the AGI/AMI stuff 'under the covers' for you.

-- 
Kevin P. Fleming
Digium, Inc. | Director of Software Technologies
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
skype: kpfleming | jabber: kflem...@digium.com
Check us out at www.digium.com  www.asterisk.org

-- 
_
-- 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
 

__ Information from ESET NOD32 Antivirus, version of virus signature
database 5317 (20100727) __

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com
 
 

__ 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


Re: [asterisk-users] Urgent help = RUBY AGI

2010-07-27 Thread Randy R
Hi,

I missed the beginning of this thread but you or anyone else looking
for help with Ruby + Asterisk should contact Jason Goecke (@jsgoecke
on Twitter or if you don't do Twitter you can look for contact info
there http://twitter.com/gsgoecke).

Jason probably knows as much about that world as anyone and he con
help you find someone. Kevin's advice is good (as usual): check out
Adhearsion. Jason is a part of that, too.

/r

-- 
_
-- 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


Re: [asterisk-users] Urgent help = RUBY AGI

2010-07-27 Thread Jim Dickenson
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/voipuserZap/32Zap/33Zap/34Zap/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:dicken...@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/voipuserZap/32Zap/33Zap/34Zap/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/voipuserZap/32Zap/33Zap/34Zap/35
 -- AGI Script Executing Application: (DIAL) Options: 
 (SIP/voipuserZap/32Zap/33Zap/34Zap/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

Re: [asterisk-users] Urgent help = RUBY AGI

2010-07-27 Thread Zarko Zivanovic
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 dicken...@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/voipuserZap/32Zap/33Zap/34Zap/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:dicken...@cfmc.com dicken...@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/voipuserZap/32Zap/33Zap/34Zap/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/voipuserZap/32Zap/33Zap/34Zap/35
 -- AGI Script Executing Application: (DIAL) Options:
 (SIP/voipuserZap/32Zap/33Zap/34Zap/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

-- 
_
-- 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

Re: [asterisk-users] Urgent help = RUBY AGI

2010-07-27 Thread Danny Nicholas
From: asterisk-users-boun...@lists.digium.com
[mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Zarko
Zivanovic
Subject: Re: [asterisk-users] Urgent help = RUBY  AGI

 

snip
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?

This should work:



r = $agi.exec('DIAL', SIP/voipuserZap/32Zap/33Zap/34Zap/35,,mM(testing))

 

-- 
_
-- 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

Re: [asterisk-users] Urgent help = RUBY AGI

2010-07-27 Thread Jim Dickenson
You can put multiple options in the dial command if that is what you are asking.

And by the way several emails, including a previous one of mine, told you to 
use the M option and a macro.

In this email I gave you more detailed information but if you had done core 
show application dial on CLI you should have been able to ask more directed 
questions.
-- 
Jim Dickenson
mailto:dicken...@cfmc.com

CfMC
http://www.cfmc.com/



On Jul 27, 2010, at 9:28 AM, Zarko Zivanovic wrote:

 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 dicken...@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/voipuserZap/32Zap/33Zap/34Zap/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:dicken...@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/voipuserZap/32Zap/33Zap/34Zap/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/voipuserZap/32Zap/33Zap/34Zap/35
 -- AGI Script Executing Application: (DIAL) Options: 
 (SIP/voipuserZap/32Zap/33Zap/34Zap/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
 
 -- 
 _
 -- 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

-- 

Re: [asterisk-users] Urgent help = RUBY AGI

2010-07-27 Thread Steve Edwards
On Tue, 27 Jul 2010, Jim Dickenson wrote:

 In this email I gave you more detailed information but if you had done 
 core show application dial on CLI you should have been able to ask 
 more directed questions.

Maybe RTFHT* should have been the first response :)

*) Read The Frick'n Help Text

-- 
Thanks in advance,
-
Steve Edwards   sedwa...@sedwards.com  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


Re: [asterisk-users] Urgent help = RUBY AGI

2010-07-27 Thread Danny Nicholas
From: asterisk-users-boun...@lists.digium.com
[mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Steve Edwards
Subject: Re: [asterisk-users] Urgent help = RUBY  AGI

Maybe RTFHT* should have been the first response :)

*) Read The Frick'n Help Text

Don't know about the Ruby part, but don't you have that book on 1.2 :)?


-- 
_
-- 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