[asterisk-users] asterisk 1.6 agi problem with PHP
Hello everyone, I am sure that someone can help with this. We decided to do a fresh install of asterisk 1.6.2.19 And after we did that, the problem that we have is this - We cant run a single Php file! Here's the output: -- Executing [8212@from-pstn:1] Answer(DAHDI/23-1, ) in new stack -- Executing [8212@from-pstn:2] AGI(DAHDI/23-1, testera.agi) in new stack -- Launched AGI Script /var/lib/asterisk/agi-bin/testera.agi DAHDI/23-1AGI Tx agi_request: testera.agi DAHDI/23-1AGI Tx agi_channel: DAHDI/23-1 DAHDI/23-1AGI Tx agi_language: en DAHDI/23-1AGI Tx agi_type: DAHDI DAHDI/23-1AGI Tx agi_uniqueid: 1310825293.10 DAHDI/23-1AGI Tx agi_version: 1.6.2.19 DAHDI/23-1AGI Tx agi_callerid: 112686649 DAHDI/23-1AGI Tx agi_calleridname: unknown DAHDI/23-1AGI Tx agi_callingpres: 3 DAHDI/23-1AGI Tx agi_callingani2: 0 DAHDI/23-1AGI Tx agi_callington: 33 DAHDI/23-1AGI Tx agi_callingtns: 0 DAHDI/23-1AGI Tx agi_dnid: 8212 DAHDI/23-1AGI Tx agi_rdnis: unknown DAHDI/23-1AGI Tx agi_context: from-pstn DAHDI/23-1AGI Tx agi_extension: 8212 DAHDI/23-1AGI Tx agi_priority: 2 DAHDI/23-1AGI Tx agi_enhanced: 0.0 DAHDI/23-1AGI Tx agi_accountcode: DAHDI/23-1AGI Tx agi_threadid: -1223132272 DAHDI/23-1AGI Tx DAHDI/23-1AGI Rx verbose Failed to execute '/var/lib/asterisk/agi-bin/testera.agi': No such file or directory 1 testera.agi: Failed to execute '/var/lib/asterisk/agi-bin/testera.agi': No such file or directory DAHDI/23-1AGI Tx 200 result=1 VERIFIED EVERYTHING: [root@localhost agi-bin]# ls -l total 48 -rwxr-xr-x 1 asterisk asterisk 1742 Jul 1 18:57 agi-test.agi -rwxr-xr-x 1 asterisk asterisk 9909 Jul 1 18:57 eagi-sphinx-test -rwxr-xr-x 1 asterisk asterisk 8724 Jul 1 18:57 eagi-test -rwxr-xr-x 1 asterisk asterisk 14530 Jul 1 18:57 jukebox.agi -rwxr-xr-x 1 asterisk asterisk 1508 Jul 16 16:04 testera.agi [root@localhost agi-bin]# which php /usr/bin/php Here's the agi - simple test that we picked from the net.: #!/usr/bin/php ? ob_implicit_flush(false); set_time_limit(6); $stdin = fopen('php://stdin', 'r'); $stdlog = fopen('my_agi.log', 'w'); $debug = true; /* Read input from Asterisk and output via $astOutput */ function astRead() { global $stdin, $debug, $stdlog; $astOutput = str_replace(\n, , fgets($stdin, 4096)); if ($debug) fputs($stdlog, read: $input\n); return $astOutput ; } /* Write AGI command to Asterisk */ function astWrite($agiCommand) { global $debug, $stdlog; if ($debug) fputs($stdlog, write: $agiCommand\n); echo $agiCommand.\n; } /* Handling execution input from Asterisk */ $agivar = array(); while (!feof($stdin)) { $temp = fgets($stdin); $temp = str_replace(\n,,$temp); $s = explode(:,$temp); $agivar[$s[0]] = trim($s[1]); if ($temp == ) { break; } } /* Operational Code starts here */ /* Playback the demo-congrats.gsm file from the * directory /var/lib/asterisk/sounds/ */ astWrite(STREAM FILE /var/lib/asterisk/sounds/en/tt-monkeys #); astRead(); /* Say the number 123456 astWrite(SAY NUMBER 123456 #); astRead();*/ /* Finalization of AGI script and clean-ups */ fclose ($stdin); fclose ($stdlog); exit(0); ? All help is appreciated. Thanks, Z. Zivanovic -- _ -- 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
[asterisk-users] SIP - no audio behind nat problem
Hello, We have 2 grandstream GX 2000 phones behind NAT and Asterisk outside this natted network. We have the issue with calls to these SIP phones - no audio. It is probably the problem with port forwarding on router - but I am not sure how can I forward same sip ports (5004 to 5100) to two phones (nat addresses?)? Any help appreciated! Z. Zivanovic -- _ -- 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
[asterisk-users] using better quality wav or mp3 in Asterisk 1.2.x
Hello, I would need a little help about using 16 bit wav or mp3 files for moh on asterisk 1.2.x When i try to use these files as moh, the caller gets disconnected. Please advise. Regards, Z. Zivanovic -- _ -- 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
[asterisk-users] agi macro problem
I am trying this approach to see who picked the line: Here is what i am doing: EXEC DIAL SIP/ vaso Zap/35||M(testing^30086) Macro: [macro-testing] exten = s,1,DumpChan() exten = s,2,AGI(whopicked.rb) exten = s,3,Hangup() From console: -- SIP/ vaso -e26c answered Zap/14-1 -- Executing DumpChan(SIP/ vaso -e26c, ) in new stack -- Executing DumpChan(SIP/vaso-e26c, ) in new stack Dumping Info For Channel: SIP/vaso-e26c: Info: Name= SIP/vaso-e26c Type= SIP UniqueID= 1280487752.1809 CallerID= 8221 CallerIDName= (N/A) DNIDDigits= (N/A) State= Up (6) Rings= 0 NativeFormat= 2 WriteFormat=4 ReadFormat= 4 1stFileDescriptor= 74 Framesin= 3 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 ARG1=30086 MACRO_PRIORITY=1 MACRO_CONTEXT=siptest -- Executing AGI(SIP/vaso-e26c, whopicked.rb) in new stack -- Launched AGI Script /var/lib/asterisk/agi-bin/whopicked.rb AGI Tx agi_request: whopicked.rb AGI Tx agi_channel: SIP/vaso-e26c AGI Tx agi_language: en AGI Tx agi_type: SIP AGI Tx agi_uniqueid: 1280487752.1809 AGI Tx agi_callerid: 8221 AGI Tx agi_calleridname: unknown AGI Tx agi_callingpres: 3 AGI Tx agi_callingani2: 0 AGI Tx agi_callington: 33 AGI Tx agi_callingtns: 0 AGI Tx agi_dnid: unknown AGI Tx agi_rdnis: unknown AGI Tx agi_context: macro-testing AGI Tx agi_extension: s AGI Tx agi_priority: 2 AGI Tx agi_enhanced: 0.0 AGI Tx agi_accountcode: AGI Tx -- AGI Script whopicked.rb completed, returning 0 -- Executing Hangup(SIP/vaso-e26c, ) in new stack I need simple whopicked.agi (instead of .rb) which will simply take the value 30086 (that I pass to macro) And do this: UPDATE call_log SET local = 'CHANNEL' WHERE id = '30086' Where channel is agi_channel: SIP/vaso-e26c This should be simple - no ruby - just agi. -- _ -- 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
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
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
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
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
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
[asterisk-users] Passing Variables From Dial Macro To Parent Ruby
Thanks to help from Jim Dickenson I managed to start a macro and get info about the channel that picked up the call from my ruby script. 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 ! -- _ -- 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
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 - capturing 'answered'
Thats great, However I need to find a solution to this very problem, not able to code something from scratch. Even this: # Create a new file and write to it File.open('log.txt', 'w') do |f2| # use \n for two lines of text f2.puts Created by Satish\nThank God!\n my variables are '$loc', '$agi.get_variable(EXTEN)', '$variable1', '$variable2' end $my.query(UPDATE call_log SET endtime = NOW() WHERE id = #{call_log_id}) - query gets executed, but log.txt wasnt created. Not to mention that I still didnt manage to catch who answered the call. -Original Message- From: asterisk-users-boun...@lists.digium.com [mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Steve Edwards Sent: Monday, July 26, 2010 8:10 PM To: and...@telesip.net; Asterisk Users Mailing List - Non-Commercial Discussion Subject: Re: [asterisk-users] URgent - capturing 'answered' On Mon, 26 Jul 2010, Andres wrote: When I troubleshoot AGI scripts, I output stuff to text files for debugging purposes. I suggest you output all your variables to a file and then you will learn if the variables do have the info you need. Something like: $message=/bin/echo my variables are '$loc', '$variable1', '$variable2', etc /tmp/variables.txt; system($message); I prefer syslog(). ) You don't litter your system with little files. ) You get nicely timestamped messages you can centralize across servers. ) You can control how much verbosity you want by setting the logging priority. ) You can vary the logging priority at run time. ) You can leave the logging code in place in production. I code all of my AGIs to recognize (via getopt_long()) --debug and --verbose command line options. When something weird starts to happen, I can enable debugging in the dialplan and debug the code that is running in production. -- 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 __ Information from ESET NOD32 Antivirus, version of virus signature database 5315 (20100726) __ The message was checked by ESET NOD32 Antivirus. http://www.eset.com __ Information from ESET NOD32 Antivirus, version of virus signature database 5315 (20100726) __ 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 - capturing 'answered'
No, neither that didnt work. Even this: # Create a new file and write to it File.open('log.txt', 'w') do |f2| # use \n for two lines of text f2.puts Created by Satish\nThank God!\n my variables are '$loc', '$agi.get_variable(EXTEN)', '$variable1', '$variable2' end $my.query(UPDATE call_log SET endtime = NOW() WHERE id = #{call_log_id}) - query gets executed, but log.txt wasnt created. Not to mention that I still didnt manage to catch who answered the call. -Original Message- From: asterisk-users-boun...@lists.digium.com [mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Steve Edwards Sent: Monday, July 26, 2010 8:16 PM To: Asterisk Users Mailing List - Non-Commercial Discussion Subject: Re: [asterisk-users] URgent - capturing 'answered' On Mon, 26 Jul 2010, Zarko Zivanovic wrote: I did try what you said, but it didnt create any files: $message=/bin/echo my variables are '$loc', '$variable1', '$variable2' /tmp/variables.txt; system($message); I'm just a c weenie, but that syntax would execute a command named $message, not the value of the variable $message. Would system($message); do what you want? -- 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 __ Information from ESET NOD32 Antivirus, version of virus signature database 5315 (20100726) __ The message was checked by ESET NOD32 Antivirus. http://www.eset.com __ Information from ESET NOD32 Antivirus, version of virus signature database 5315 (20100726) __ 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 - capturing 'answered'
I tried this: # Create a new file and write to it File.open('log.txt', 'w') do |f2| # use \n for two lines of text f2.puts Created by Satish\nThank God!\n my variables are '$loc', '$agi.get_variable(EXTEN)', '$variable1', '$variable2' end $my.query(UPDATE call_log SET endtime = NOW() WHERE id = #{call_log_id}) - query gets executed, but log.txt wasnt created. Not to mention that I still didnt manage to catch who answered the call. -Original Message- From: asterisk-users-boun...@lists.digium.com [mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Andres Sent: Monday, July 26, 2010 8:09 PM To: Asterisk Users Mailing List - Non-Commercial Discussion Subject: Re: [asterisk-users] URgent - capturing 'answered' On 7/26/2010 1:40 PM, Zarko Zivanovic wrote: Hi Andres, I did try what you said, but it didnt create any files: $message=/bin/echo my variables are '$loc', '$variable1', '$variable2' /tmp/variables.txt; system($message); This is what I do with Perl AGI scripts and it works fine. You need to figure out how to output to a text file with Ruby. I don't think the 'system' command would work with Ruby. Start with a basic AGI script and test wether you can write to a file or not. That is the best way to troubleshoot. Andres http://www.neuroredes.com permissions seem to be fine, echo is in place. I posted the whole script that i am using in the main thread - if you can please loook at it. Zarko. -Original Message- From: asterisk-users-boun...@lists.digium.com [mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Andres Sent: Monday, July 26, 2010 6:47 PM To: Asterisk Users Mailing List - Non-Commercial Discussion Subject: Re: [asterisk-users] URgent - capturing 'answered' On 7/26/2010 12:27 PM, Zarko Zivanovic wrote: I tried this: loc = $agi.get_variable('EXTEN') $my.query(UPDATE call_log SET local = #{loc}, endtime = NOW() WHERE id = #{call_log_id}) When I troubleshoot AGI scripts, I output stuff to text files for debugging purposes. I suggest you output all your variables to a file and then you will learn if the variables do have the info you need. Something like: $message=/bin/echo my variables are '$loc', '$variable1', '$variable2', etc /tmp/variables.txt; system($message); Andres http://www.neuroredes.com No success. Anybody please help! -Original Message- From: asterisk-users-boun...@lists.digium.com [mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Leif Madsen Sent: Monday, July 26, 2010 3:44 PM To: asterisk-users@lists.digium.com Subject: Re: [asterisk-users] URgent - capturing 'answered' On 10-07-26 08:10 AM, Zarko Zivanovic wrote: Hello Steve and thanks for your answer, However I tried: $my.query(UPDATE call_log SET local='#{CDR(dstchannel)}', endtime = NOW() WHERE id = #{call_log_id}) And it does write nothing to the database. I guess there is a error in ruby expression above but I am not sure what is wrong - if you have any idea please help. If that is your literal quote, then I think you need to change the # to a $ as Asterisk dialplan functions and variables start with ${ vs #{ Unless that is some special indication in SQL that I'm unfamiliar with. Leif Madsen. -- _ -- 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 5315 (20100726) __ The message was checked by ESET NOD32 Antivirus. http://www.eset.com __ Information from ESET NOD32 Antivirus, version of virus signature database 5315 (20100726) __ 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 - capturing 'answered'
Great, but how exactly do i find that channel - that is my question - which command. I am using ruby instead of agi - and i am looking for a command to capture it in ruby. I tried this: # Create a new file and write to it File.open('log.txt', 'w') do |f2| # use \n for two lines of text f2.puts Created by Satish\nThank God!\n my variables are '$loc', '$agi.get_variable(EXTEN)', '$variable1', '$variable2' end $my.query(UPDATE call_log SET endtime = NOW() WHERE id = #{call_log_id}) - query gets executed, but log.txt wasnt created. Not to mention that I still didnt manage to catch who answered the call. -Original Message- From: asterisk-users-boun...@lists.digium.com [mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Jim Dickenson Sent: Monday, July 26, 2010 7:50 PM To: Asterisk Users Mailing List - Non-Commercial Discussion Subject: Re: [asterisk-users] URgent - capturing 'answered' If all you need to do is the the channel name of the channel that answered the phone why are you doing so much work? Version 1.4 allows for an agi to be called when the dial command is answered. Version 1.6+ allows an agi as well as a macro to be called. You can find the channel that answered a multi channel dial command. Is this not what you wanted to know? -- Jim Dickenson mailto:dicken...@cfmc.com CfMC http://www.cfmc.com/ On Jul 26, 2010, at 10:40 AM, Zarko Zivanovic wrote: Hi Andres, I did try what you said, but it didnt create any files: $message=/bin/echo my variables are '$loc', '$variable1', '$variable2' /tmp/variables.txt; system($message); permissions seem to be fine, echo is in place. I posted the whole script that i am using in the main thread - if you can please loook at it. Zarko. -Original Message- From: asterisk-users-boun...@lists.digium.com [mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Andres Sent: Monday, July 26, 2010 6:47 PM To: Asterisk Users Mailing List - Non-Commercial Discussion Subject: Re: [asterisk-users] URgent - capturing 'answered' On 7/26/2010 12:27 PM, Zarko Zivanovic wrote: I tried this: loc = $agi.get_variable('EXTEN') $my.query(UPDATE call_log SET local = #{loc}, endtime = NOW() WHERE id = #{call_log_id}) When I troubleshoot AGI scripts, I output stuff to text files for debugging purposes. I suggest you output all your variables to a file and then you will learn if the variables do have the info you need. Something like: $message=/bin/echo my variables are '$loc', '$variable1', '$variable2', etc /tmp/variables.txt; system($message); Andres http://www.neuroredes.com No success. Anybody please help! -Original Message- From: asterisk-users-boun...@lists.digium.com [mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Leif Madsen Sent: Monday, July 26, 2010 3:44 PM To: asterisk-users@lists.digium.com Subject: Re: [asterisk-users] URgent - capturing 'answered' On 10-07-26 08:10 AM, Zarko Zivanovic wrote: Hello Steve and thanks for your answer, However I tried: $my.query(UPDATE call_log SET local='#{CDR(dstchannel)}', endtime = NOW() WHERE id = #{call_log_id}) And it does write nothing to the database. I guess there is a error in ruby expression above but I am not sure what is wrong - if you have any idea please help. If that is your literal quote, then I think you need to change the # to a $ as Asterisk dialplan functions and variables start with ${ vs #{ Unless that is some special indication in SQL that I'm unfamiliar with. Leif Madsen. -- _ -- 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 5314 (20100726) __ The message was checked by ESET NOD32 Antivirus. http://www.eset.com __ Information from ESET NOD32 Antivirus, version of virus signature database 5315 (20100726) __ 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
Re: [asterisk-users] URgent - capturing 'answered'
Hello Jim, We're using Asterisk 1.2.9.1 Zarko -Original Message- From: asterisk-users-boun...@lists.digium.com [mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Jim Dickenson Sent: Tuesday, July 27, 2010 1:02 PM To: Asterisk Users Mailing List - Non-Commercial Discussion Subject: Re: [asterisk-users] URgent - capturing 'answered' Which version of Asterisk are you running? -- Jim Dickenson mailto:dicken...@cfmc.com CfMC http://www.cfmc.com/ On Jul 27, 2010, at 2:19 AM, Zarko Zivanovic wrote: Great, but how exactly do i find that channel - that is my question - which command. I am using ruby instead of agi - and i am looking for a command to capture it in ruby. I tried this: # Create a new file and write to it File.open('log.txt', 'w') do |f2| # use \n for two lines of text f2.puts Created by Satish\nThank God!\n my variables are '$loc', '$agi.get_variable(EXTEN)', '$variable1', '$variable2' end $my.query(UPDATE call_log SET endtime = NOW() WHERE id = #{call_log_id}) - query gets executed, but log.txt wasnt created. Not to mention that I still didnt manage to catch who answered the call. -Original Message- From: asterisk-users-boun...@lists.digium.com [mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Jim Dickenson Sent: Monday, July 26, 2010 7:50 PM To: Asterisk Users Mailing List - Non-Commercial Discussion Subject: Re: [asterisk-users] URgent - capturing 'answered' If all you need to do is the the channel name of the channel that answered the phone why are you doing so much work? Version 1.4 allows for an agi to be called when the dial command is answered. Version 1.6+ allows an agi as well as a macro to be called. You can find the channel that answered a multi channel dial command. Is this not what you wanted to know? -- Jim Dickenson mailto:dicken...@cfmc.com CfMC http://www.cfmc.com/ On Jul 26, 2010, at 10:40 AM, Zarko Zivanovic wrote: Hi Andres, I did try what you said, but it didnt create any files: $message=/bin/echo my variables are '$loc', '$variable1', '$variable2' /tmp/variables.txt; system($message); permissions seem to be fine, echo is in place. I posted the whole script that i am using in the main thread - if you can please loook at it. Zarko. -Original Message- From: asterisk-users-boun...@lists.digium.com [mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Andres Sent: Monday, July 26, 2010 6:47 PM To: Asterisk Users Mailing List - Non-Commercial Discussion Subject: Re: [asterisk-users] URgent - capturing 'answered' On 7/26/2010 12:27 PM, Zarko Zivanovic wrote: I tried this: loc = $agi.get_variable('EXTEN') $my.query(UPDATE call_log SET local = #{loc}, endtime = NOW() WHERE id = #{call_log_id}) When I troubleshoot AGI scripts, I output stuff to text files for debugging purposes. I suggest you output all your variables to a file and then you will learn if the variables do have the info you need. Something like: $message=/bin/echo my variables are '$loc', '$variable1', '$variable2', etc /tmp/variables.txt; system($message); Andres http://www.neuroredes.com No success. Anybody please help! -Original Message- From: asterisk-users-boun...@lists.digium.com [mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Leif Madsen Sent: Monday, July 26, 2010 3:44 PM To: asterisk-users@lists.digium.com Subject: Re: [asterisk-users] URgent - capturing 'answered' On 10-07-26 08:10 AM, Zarko Zivanovic wrote: Hello Steve and thanks for your answer, However I tried: $my.query(UPDATE call_log SET local='#{CDR(dstchannel)}', endtime = NOW() WHERE id = #{call_log_id}) And it does write nothing to the database. I guess there is a error in ruby expression above but I am not sure what is wrong - if you have any idea please help. If that is your literal quote, then I think you need to change the # to a $ as Asterisk dialplan functions and variables start with ${ vs #{ Unless that is some special indication in SQL that I'm unfamiliar with. Leif Madsen. -- _ -- 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 5314 (20100726) __ The message was checked by ESET NOD32 Antivirus. http://www.eset.com __ Information from ESET NOD32 Antivirus, version of virus signature database 5315 (20100726) __ The message was checked by ESET NOD32 Antivirus. http
[asterisk-users] Urgent help = RUBY AGI
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! -- _ -- 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
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
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
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
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
[asterisk-users] URGENT - who picked up the call??
Hello, I've been looking for this on voip-info and this list threads, and I am guessing I am not looking right. What I need is the way to capture (and write to DB) the information on who 'picked' or 'received' the incoming call. Here is the example of .rb file that is called from extensions.conf: private def lokal call_log_id = nil begin call_log_id = call_log() $agi.answer $agi.exec('WAIT', '2') local_channels = get_locals() dial_params = local_channels.join('') dial_params ||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 ensure call_log(call_log_id) unless call_log_id.nil? end end private def get_locals local_channels = @locals.map { |x| 'Sip/operator1Zap/' + x.strip } # FIX - ovaj raise treba da prijavi nedefinisane lokale za servis a ne za telefon raise Nisu definisani lokalni kanali u settings za telephone_id = #...@settings_row['telephone_id']} if local_channels.empty? local_channels end As you see the call can be picked either by the Zap channels in locals of SIP/operator user. Now i Need to know here: $my.select_db('tvr2') $my.query(UPDATE call_log SET endtime = NOW(), local=#SOMETHINGHERE# WHERE id = #{call_log_id}) raise 'Cant write from log: call_log_id = #{call_log_id}' if $my.affected_rows() != 1 if place of #SOMETHINGHERE# - where the call was transferred (from the part above). Anyone? -- _ -- 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
[asterisk-users] URgent - capturing 'answered'
Hello everyone. I need a quick help on how to capture who answered the call with agi. Here is an example: -- Zap/32-1 is ringing -- Zap/33-1 is ringing -- Zap/34-1 is ringing -- Zap/35-1 is ringing -- SIP/operator1-e77f answered Zap/23-1 So how can I capture this value and write it to mysql? I already have this: $my.query(UPDATE call_log SET endtime = NOW() WHERE id = #{call_log_id}) And i needed to do something like: $my.query(UPDATE call_log SET endtime = NOW(),answeredby= #{$agi.WHOANSWEREDTHEPHONE} WHERE id = #{call_log_id}) And in above example it would write SIP/operator1-e77f into answeredby. Any help is greatly appreciated! -- _ -- 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 - capturing 'answered'
Hi Faisal, Isn't it possible to be done via asterisk variables? I would need it to be done that way - i am sure there's a variable capturing who answered. Zarko From: asterisk-users-boun...@lists.digium.com [mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Faisal Hanif Sent: Monday, July 26, 2010 12:57 PM To: asterisk-users@lists.digium.com Subject: Re: [asterisk-users] URgent - capturing 'answered' You need to do it by manager interface Regards, Faisal Hanif On 7/26/2010 3:41 PM, Zarko Zivanovic wrote: Hello everyone. I need a quick help on how to capture who answered the call with agi. Here is an example: -- Zap/32-1 is ringing -- Zap/33-1 is ringing -- Zap/34-1 is ringing -- Zap/35-1 is ringing -- SIP/operator1-e77f answered Zap/23-1 So how can I capture this value and write it to mysql? I already have this: $my.query(UPDATE call_log SET endtime = NOW() WHERE id = #{call_log_id}) And i needed to do something like: $my.query(UPDATE call_log SET endtime = NOW(),answeredby= #{$agi.WHOANSWEREDTHEPHONE} WHERE id = #{call_log_id}) And in above example it would write SIP/operator1-e77f into answeredby. Any help is greatly appreciated! __ Information from ESET NOD32 Antivirus, version of virus signature database 5313 (20100726) __ The message was checked by ESET NOD32 Antivirus. http://www.eset.com __ Information from ESET NOD32 Antivirus, version of virus signature database 5313 (20100726) __ 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 - capturing 'answered'
Hello Steve and thanks for your answer, However I tried: $my.query(UPDATE call_log SET local='#{CDR(dstchannel)}', endtime = NOW() WHERE id = #{call_log_id}) And it does write nothing to the database. I guess there is a error in ruby expression above but I am not sure what is wrong - if you have any idea please help. Zarko -Original Message- From: asterisk-users-boun...@lists.digium.com [mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Steve Davies Sent: Monday, July 26, 2010 1:37 PM To: Asterisk Users Mailing List - Non-Commercial Discussion Subject: Re: [asterisk-users] URgent - capturing 'answered' On 7/26/2010 3:41 PM, Zarko Zivanovic wrote: Hello everyone. I need a quick help on how to capture who answered the call with agi. Here is an example: -- Zap/32-1 is ringing -- Zap/33-1 is ringing -- Zap/34-1 is ringing -- Zap/35-1 is ringing -- SIP/operator1-e77f answered Zap/23-1 So how can I capture this value and write it to mysql? If you use cdr_mysql, then this data should already be written to the dstchannel column in the cdr table. I already have this: $my.query(UPDATE call_log SET endtime = NOW() WHERE id = #{call_log_id}) And i needed to do something like: $my.query(UPDATE call_log SET endtime = NOW(),answeredby= #{$agi.WHOANSWEREDTHEPHONE} WHERE id = #{call_log_id}) Alternatively you may be able to access ${CDR(dstchannel)}. I've not checked any of the above, but I believe it is right. Regards, Steve -- _ -- 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 5313 (20100726) __ The message was checked by ESET NOD32 Antivirus. http://www.eset.com __ Information from ESET NOD32 Antivirus, version of virus signature database 5313 (20100726) __ 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 - capturing 'answered'
Ok Lief, here's an update: I changed the ruby script line to: $my.query(UPDATE call_log SET local='${CDR(dstchannel)}', endtime = NOW() WHERE id = #{call_log_id}) As you suggested, but now in mysql local field i have exactly this written: ${CDR(dstchannel)} If wasnt changed to a variable, instead it was directly written to mysql. Any suggestions? Zarko -Original Message- From: asterisk-users-boun...@lists.digium.com [mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Leif Madsen Sent: Monday, July 26, 2010 3:44 PM To: asterisk-users@lists.digium.com Subject: Re: [asterisk-users] URgent - capturing 'answered' On 10-07-26 08:10 AM, Zarko Zivanovic wrote: Hello Steve and thanks for your answer, However I tried: $my.query(UPDATE call_log SET local='#{CDR(dstchannel)}', endtime = NOW() WHERE id = #{call_log_id}) And it does write nothing to the database. I guess there is a error in ruby expression above but I am not sure what is wrong - if you have any idea please help. If that is your literal quote, then I think you need to change the # to a $ as Asterisk dialplan functions and variables start with ${ vs #{ Unless that is some special indication in SQL that I'm unfamiliar with. Leif Madsen. -- _ -- 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 5314 (20100726) __ The message was checked by ESET NOD32 Antivirus. http://www.eset.com __ Information from ESET NOD32 Antivirus, version of virus signature database 5314 (20100726) __ 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 - capturing 'answered'
I tried this: loc = $agi.get_variable('EXTEN') $my.query(UPDATE call_log SET local = #{loc}, endtime = NOW() WHERE id = #{call_log_id}) No success. Anybody please help! -Original Message- From: asterisk-users-boun...@lists.digium.com [mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Leif Madsen Sent: Monday, July 26, 2010 3:44 PM To: asterisk-users@lists.digium.com Subject: Re: [asterisk-users] URgent - capturing 'answered' On 10-07-26 08:10 AM, Zarko Zivanovic wrote: Hello Steve and thanks for your answer, However I tried: $my.query(UPDATE call_log SET local='#{CDR(dstchannel)}', endtime = NOW() WHERE id = #{call_log_id}) And it does write nothing to the database. I guess there is a error in ruby expression above but I am not sure what is wrong - if you have any idea please help. If that is your literal quote, then I think you need to change the # to a $ as Asterisk dialplan functions and variables start with ${ vs #{ Unless that is some special indication in SQL that I'm unfamiliar with. Leif Madsen. -- _ -- 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 5314 (20100726) __ The message was checked by ESET NOD32 Antivirus. http://www.eset.com __ Information from ESET NOD32 Antivirus, version of virus signature database 5314 (20100726) __ 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 - capturing 'answered'
return $my.insert_id else $my.select_db('tvr2') loc = $agi.get_variable('LOC') $my.query(UPDATE call_log SET local = #{loc}, endtime = NOW() WHERE id = #{call_log_id}) raise 'Ne mogu da se ispisem iz call_log-a: call_log_id = #{call_log_id}' if $my.affected_rows() != 1 end nil end end Maybe you figure out something. Zarko -Original Message- From: asterisk-users-boun...@lists.digium.com [mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Steve Davies Sent: Monday, July 26, 2010 6:48 PM To: Asterisk Users Mailing List - Non-Commercial Discussion Subject: Re: [asterisk-users] URgent - capturing 'answered' On 26 July 2010 17:27, Zarko Zivanovic outlaw...@gmail.com wrote: I tried this: loc = $agi.get_variable('EXTEN') $my.query(UPDATE call_log SET local = #{loc}, endtime = NOW() WHERE id = #{call_log_id}) No success. Anybody please help! -Original Message- From: asterisk-users-boun...@lists.digium.com [mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Leif Madsen Sent: Monday, July 26, 2010 3:44 PM To: asterisk-users@lists.digium.com Subject: Re: [asterisk-users] URgent - capturing 'answered' On 10-07-26 08:10 AM, Zarko Zivanovic wrote: Hello Steve and thanks for your answer, However I tried: $my.query(UPDATE call_log SET local='#{CDR(dstchannel)}', endtime = NOW() WHERE id = #{call_log_id}) And it does write nothing to the database. I guess there is a error in ruby expression above but I am not sure what is wrong - if you have any idea please help. If that is your literal quote, then I think you need to change the # to a $ as Asterisk dialplan functions and variables start with ${ vs #{ Unless that is some special indication in SQL that I'm unfamiliar with. Leif Madsen. The # prefix is probably something to do with the combination of Ruby, MySQL and AGI - I am not particularly familiar with Ruby. You do not say at what stage when you call your AGI in the call path, and at what stage you access the database. 1) Use AGI In order to make the call, and do not exit AGI until after the call is over: 2) Call AGI after call is over In case 1) you'll need the following somewhere in your script after the call is answered or completed. $agi.execute('Set(LOC=${CDR(dstchannel)})') In case 2) just put Set(LOC=${CDR(dstchannel)}) in your dialplan before calling the AGI Then in your script try: loc = $agi.get_variable('LOC') CDR() is a built-in function rather than a variable, hence the need for the indirection. I am still guessing a bit here... Good luck. Cheers, Steve -- _ -- 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 5314 (20100726) __ The message was checked by ESET NOD32 Antivirus. http://www.eset.com __ Information from ESET NOD32 Antivirus, version of virus signature database 5315 (20100726) __ 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 - capturing 'answered'
Hi Andres, I did try what you said, but it didnt create any files: $message=/bin/echo my variables are '$loc', '$variable1', '$variable2' /tmp/variables.txt; system($message); permissions seem to be fine, echo is in place. I posted the whole script that i am using in the main thread - if you can please loook at it. Zarko. -Original Message- From: asterisk-users-boun...@lists.digium.com [mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Andres Sent: Monday, July 26, 2010 6:47 PM To: Asterisk Users Mailing List - Non-Commercial Discussion Subject: Re: [asterisk-users] URgent - capturing 'answered' On 7/26/2010 12:27 PM, Zarko Zivanovic wrote: I tried this: loc = $agi.get_variable('EXTEN') $my.query(UPDATE call_log SET local = #{loc}, endtime = NOW() WHERE id = #{call_log_id}) When I troubleshoot AGI scripts, I output stuff to text files for debugging purposes. I suggest you output all your variables to a file and then you will learn if the variables do have the info you need. Something like: $message=/bin/echo my variables are '$loc', '$variable1', '$variable2', etc /tmp/variables.txt; system($message); Andres http://www.neuroredes.com No success. Anybody please help! -Original Message- From: asterisk-users-boun...@lists.digium.com [mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Leif Madsen Sent: Monday, July 26, 2010 3:44 PM To: asterisk-users@lists.digium.com Subject: Re: [asterisk-users] URgent - capturing 'answered' On 10-07-26 08:10 AM, Zarko Zivanovic wrote: Hello Steve and thanks for your answer, However I tried: $my.query(UPDATE call_log SET local='#{CDR(dstchannel)}', endtime = NOW() WHERE id = #{call_log_id}) And it does write nothing to the database. I guess there is a error in ruby expression above but I am not sure what is wrong - if you have any idea please help. If that is your literal quote, then I think you need to change the # to a $ as Asterisk dialplan functions and variables start with ${ vs #{ Unless that is some special indication in SQL that I'm unfamiliar with. Leif Madsen. -- _ -- 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 5314 (20100726) __ The message was checked by ESET NOD32 Antivirus. http://www.eset.com __ Information from ESET NOD32 Antivirus, version of virus signature database 5315 (20100726) __ 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