I have been fighting all night with version 1.8 and have not found a way to do this with any command or Perl AGI->command. I need to play a file and wait until the customer presses at least $maxdigits to return, BUT, the file must continue playing until $maxdigits is received or $timeout has expired. So far I found impossible to achieve this functionality. Am I missing something? Philip
Thorsten Göllner
2012-Jun-29 10:27 UTC
[asterisk-users] Please dont tell me this is impossible
Am 29.06.2012 11:38, schrieb CDR:> I have been fighting all night with version 1.8 and have not found a > way to do this with any command or Perl AGI->command. I need to play a > file and wait until the customer presses at least $maxdigits to > return, BUT, the file must continue playing until $maxdigits is > received or $timeout has expired. So far I found impossible to achieve > this functionality. Am I missing something? > PhilipThe Playcommand will be interrupted by the key but the agi result contains the offset. So you can play this file from offset again until you $maxdigits has been pressed. Take a look here: https://wiki.asterisk.org/wiki/display/AST/AGICommand_STREAM+FILE
Paul Belanger
2012-Jun-29 15:07 UTC
[asterisk-users] Please dont tell me this is impossible
On 12-06-29 05:38 AM, CDR wrote:> I have been fighting all night with version 1.8 and have not found a > way to do this with any command or Perl AGI->command. I need to play a > file and wait until the customer presses at least $maxdigits to > return, BUT, the file must continue playing until $maxdigits is > received or $timeout has expired. So far I found impossible to achieve > this functionality. Am I missing something? > Philip >Just use an existing library, rather then rolling your own. -- Paul Belanger | PolyBeacon, Inc. Jabber: paul.belanger at polybeacon.com | IRC: pabelanger (Freenode) Github: https://github.com/pabelanger | Twitter: https://twitter.com/pabelanger
Steve Edwards
2012-Jun-29 16:02 UTC
[asterisk-users] Please dont tell me this is impossible
Please use more meaningful subjects. 'Please dont tell me this is impossible' I'm sure there are lots of things I could tell you that are impossible. 'Issue with Perl-AGI' I'm sure there are many issues with Perl and AGI if you don't understand the protocol. Better subjects = better responses. -- Thanks in advance, ------------------------------------------------------------------------- Steve Edwards sedwards at sedwards.com Voice: +1-760-468-3867 PST Newline Fax: +1-760-731-3000
Thorsten Göllner
2012-Jul-03 13:20 UTC
[asterisk-users] Please dont tell me this is impossible
I just tried it on asterisk 1.8.13 with "agi set debug on". The last log line reveals it - streamfile return the endpos. [2012-07-03 15:16:39] VERBOSE[7046] res_agi.c: <SIP/tgoellner-00000002>AGI Rx << STREAM FILE /audio1/dtmf_detector/2.0 1234567890*# [2012-07-03 15:16:39] VERBOSE[7046] res_agi.c: -- Playing '/audio1/dtmf_detector/2.0' (escape_digits=1234567890*#) (sample_offset 0) [2012-07-03 15:16:40] VERBOSE[7046] res_agi.c: <SIP/tgoellner-00000002>AGI Tx >> 200 result=0 endpos=4800 So please doublecheck your result. Am 03.07.2012 00:47, schrieb CDR:> 1.8 is my version, until the new one is stable. > > On Mon, Jul 2, 2012 at 4:57 PM, Thorsten G?llner <tg at ovm-group.com> wrote: >> What Asterisk version? >> >> Am 02.07.2012 15:14, schrieb CDR: >> >>> Thanks. I already solved it using this command. The only issue was >>> that it gives you as return the ASCII code of the digit pressed >>> instead of the digit itself. For some reason my brain did not process >>> that detail. But it does work. However, the offset played is not >>> returned. Has anybody tested this and has a coding sample in perl? >>> Philip >>> >>> On Mon, Jul 2, 2012 at 8:52 AM, Thorsten G?llner <tg at ovm-group.com> wrote: >>>> >>>> So take a look here: >>>> http://www.voip-info.org/wiki/view/stream+file >>>> >>>> Am 29.06.2012 16:06, schrieb CDR: >>>> >>>>> This is from the documentation of Perl-AGI >>>>> "$AGI->stream_file($filename, $digits, $offset) >>>>> Executes AGI Command "STREAM FILE $filename $digits [$offset]" >>>>> This command instructs Asterisk to play the given sound file and >>>>> listen for the given dtmf digits. The fileextension must not be used >>>>> in the filename because Asterisk will find the most appropriate file >>>>> type. $filename can be an array of files or a single filename. >>>>> Example: $AGI->stream_file('demo-echotest', '0123'); >>>>> $AGI->stream_file(['demo-echotest', 'demo-welcome'], '0123'); >>>>> Returns: -1 on error or hangup, 0 if playback completes without a >>>>> digit being pressed, or the ASCII numerical value of the digit if a >>>>> digit was pressed" >>>>> >>>>> It does not mention that it returns the offset at which the file >>>>> stopped playing. Also, if you could get that number, then restarting >>>>> the stream would result, I guess, in an audible interruption. Please >>>>> advise how to get the offset on the result and I will try. >>>>> Yours >>>>> Philip >>>>> >>>>> >>>>> >>>>> On Fri, Jun 29, 2012 at 6:27 AM, Thorsten G?llner <tg at ovm-group.com> >>>>> wrote: >>>>>> >>>>>> >>>>>> Am 29.06.2012 11:38, schrieb CDR: >>>>>> >>>>>>> I have been fighting all night with version 1.8 and have not found a >>>>>>> way to do this with any command or Perl AGI->command. I need to play a >>>>>>> file and wait until the customer presses at least $maxdigits to >>>>>>> return, BUT, the file must continue playing until $maxdigits is >>>>>>> received or $timeout has expired. So far I found impossible to achieve >>>>>>> this functionality. Am I missing something? >>>>>>> Philip >>>>>> >>>>>> >>>>>> >>>>>> >>>>>> The Playcommand will be interrupted by the key but the agi result >>>>>> contains >>>>>> the offset. So you can play this file from offset again until you >>>>>> $maxdigits >>>>>> has been pressed. Take a look here: >>>>>> https://wiki.asterisk.org/wiki/display/AST/AGICommand_STREAM+FILE >>>>>> >>>> >>>> -- >>>> Thorsten G?llner >>>> >>>> OVM Office Voice Media GmbH >>>> Herderstrasse 68 >>>> 40237 D?sseldorf >>>> >>>> Tel.: +49(0)211 / 618 57 53 >>>> Fax: +49(0)211 / 618 57 54 >>>> >>>> >> >> -- >> Thorsten G?llner >> >> OVM Office Voice Media GmbH >> Herderstrasse 68 >> 40237 D?sseldorf >> >> Tel.: +49(0)211 / 618 57 53 >> Fax: +49(0)211 / 618 57 54 >> >>-- Thorsten G?llner OVM Office Voice Media GmbH Herderstrasse 68 40237 D?sseldorf Tel.: +49(0)211 / 618 57 53 Fax: +49(0)211 / 618 57 54
Thorsten Göllner
2012-Jul-03 14:50 UTC
[asterisk-users] Please dont tell me this is impossible
Sorry, but I am using a self developed PHP-Library where I parse STDIN myself. So I have no problem on this side. You are using a Perl-API? There should be a method available for getting the AGI-Result-String?! I never used Perl myself ... Am 03.07.2012 16:13, schrieb CDR:> Yes, ai saw that information on the debug, but how do you bring it > inside a variable, so you may use it? I could not find a way. Maybe I > am missing something? > > On Tue, Jul 3, 2012 at 9:20 AM, Thorsten G?llner <tg at ovm-group.com> wrote: >> I just tried it on asterisk 1.8.13 with "agi set debug on". The last log >> line reveals it - streamfile return the endpos. >> >> [2012-07-03 15:16:39] VERBOSE[7046] res_agi.c: <SIP/tgoellner-00000002>AGI >> Rx << STREAM FILE /audio1/dtmf_detector/2.0 1234567890*# >> >> [2012-07-03 15:16:39] VERBOSE[7046] res_agi.c: -- Playing >> '/audio1/dtmf_detector/2.0' (escape_digits=1234567890*#) (sample_offset 0) >> >> [2012-07-03 15:16:40] VERBOSE[7046] res_agi.c: <SIP/tgoellner-00000002>AGI >> Tx >> 200 result=0 endpos=4800 >> >> So please doublecheck your result. >> >> Am 03.07.2012 00:47, schrieb CDR: >> >>> 1.8 is my version, until the new one is stable. >>> >>> On Mon, Jul 2, 2012 at 4:57 PM, Thorsten G?llner <tg at ovm-group.com> wrote: >>>> >>>> What Asterisk version? >>>> >>>> Am 02.07.2012 15:14, schrieb CDR: >>>> >>>>> Thanks. I already solved it using this command. The only issue was >>>>> that it gives you as return the ASCII code of the digit pressed >>>>> instead of the digit itself. For some reason my brain did not process >>>>> that detail. But it does work. However, the offset played is not >>>>> returned. Has anybody tested this and has a coding sample in perl? >>>>> Philip >>>>> >>>>> On Mon, Jul 2, 2012 at 8:52 AM, Thorsten G?llner <tg at ovm-group.com> >>>>> wrote: >>>>>> >>>>>> >>>>>> So take a look here: >>>>>> http://www.voip-info.org/wiki/view/stream+file >>>>>> >>>>>> Am 29.06.2012 16:06, schrieb CDR: >>>>>> >>>>>>> This is from the documentation of Perl-AGI >>>>>>> "$AGI->stream_file($filename, $digits, $offset) >>>>>>> Executes AGI Command "STREAM FILE $filename $digits [$offset]" >>>>>>> This command instructs Asterisk to play the given sound file and >>>>>>> listen for the given dtmf digits. The fileextension must not be used >>>>>>> in the filename because Asterisk will find the most appropriate file >>>>>>> type. $filename can be an array of files or a single filename. >>>>>>> Example: $AGI->stream_file('demo-echotest', '0123'); >>>>>>> $AGI->stream_file(['demo-echotest', 'demo-welcome'], '0123'); >>>>>>> Returns: -1 on error or hangup, 0 if playback completes without a >>>>>>> digit being pressed, or the ASCII numerical value of the digit if a >>>>>>> digit was pressed" >>>>>>> >>>>>>> It does not mention that it returns the offset at which the file >>>>>>> stopped playing. Also, if you could get that number, then restarting >>>>>>> the stream would result, I guess, in an audible interruption. Please >>>>>>> advise how to get the offset on the result and I will try. >>>>>>> Yours >>>>>>> Philip >>>>>>> >>>>>>> >>>>>>> >>>>>>> On Fri, Jun 29, 2012 at 6:27 AM, Thorsten G?llner <tg at ovm-group.com> >>>>>>> wrote: >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> Am 29.06.2012 11:38, schrieb CDR: >>>>>>>> >>>>>>>>> I have been fighting all night with version 1.8 and have not found a >>>>>>>>> way to do this with any command or Perl AGI->command. I need to play >>>>>>>>> a >>>>>>>>> file and wait until the customer presses at least $maxdigits to >>>>>>>>> return, BUT, the file must continue playing until $maxdigits is >>>>>>>>> received or $timeout has expired. So far I found impossible to >>>>>>>>> achieve >>>>>>>>> this functionality. Am I missing something? >>>>>>>>> Philip >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> The Playcommand will be interrupted by the key but the agi result >>>>>>>> contains >>>>>>>> the offset. So you can play this file from offset again until you >>>>>>>> $maxdigits >>>>>>>> has been pressed. Take a look here: >>>>>>>> https://wiki.asterisk.org/wiki/display/AST/AGICommand_STREAM+FILE >>>>>>>>