How to use "menu command" in components.

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

How to use "menu command" in components.

David Stalin

Dear friends,
                   I am new to adhearsion. I wanted to use `menu
command ' in component. If anyone
knows pls send Asap.

Thanks.
Stalin
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Adhearsion" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/adhearsion?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: How to use "menu command" in components.

JasonGoecke

There is documentation on components here:

http://docs.adhearsion.com/display/adhearsion/Components

And the Menu command here:

http://api.adhearsion.com/Adhearsion/VoIP/Asterisk/Commands.html#menu-instance_method

If you need more than that, please be more specific on the questions/
issues you have.

On Feb 23, 4:26 am, David Stalin <[hidden email]> wrote:
> Dear friends,
>                    I am new to adhearsion. I wanted to use `menu
> command ' in component. If anyone
> knows pls send Asap.
>
> Thanks.
> Stalin
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Adhearsion" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/adhearsion?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: How to use "menu command" in components.

David Stalin

Thanks for reply. I want to explain my problem with an example
# This is my file path
components/sample_component/sample_component.rb

methods_for :dialplan do
  def call_menu
   Myclass.new(self).start
  end
end

class Myclass
  def initialize(adhearsion)
                @adhearsion=adhearsion
  end

  def start
       @adhearsion.menu 'Main_prompt',:timeout => 4.seconds,:tries =>
3 do |link|

# if the user presses any key from 1 to 5 , I call do_it . In
component I don't know where I have write do_it method.
            link.do_it 1..5

            link.on_invalid { @adhearsion.play 'invalid'}
            link.on_premature_timeout do |str|
                                @adhearsion.play 'sorry'
                        end
           link.on_failure do
                        @adhearsion.play 'vm-goodbye'
                        @adhearsion.hangup
                   end
    end


For above code, I want to write the method do_it.Where I have to
define 'do_it' method.

On Feb 23, 7:10 pm, JasonGoecke <[hidden email]> wrote:

> There is documentation on components here:
>
> http://docs.adhearsion.com/display/adhearsion/Components
>
> And the Menu command here:
>
> http://api.adhearsion.com/Adhearsion/VoIP/Asterisk/Commands.html#menu...
>
> If you need more than that, please be more specific on the questions/
> issues you have.
>
> On Feb 23, 4:26 am, David Stalin <[hidden email]> wrote:
>
> > Dear friends,
> >                    I am new to adhearsion. I wanted to use `menu
> > command ' in component. If anyone
> > knows pls send Asap.
>
> > Thanks.
> > Stalin
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Adhearsion" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/adhearsion?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: How to use "menu command" in components.

JasonGoecke

My recommendation would be to add another file in your component,
something like like:

my_component.dialplan.rb

Then, in the .ahnrc of the project's root directory you may add this
dialplan to the initialization:

  dialplan: ["dialplan.rb", "components/my_component/
my_component.dialplan.rb"]

Then use it like this:

adhearsion {
  +dialplans_from_my_component
}

Dropping your menu requirements into the new component dialplan you
have created.

On Feb 24, 12:06 am, David Stalin <[hidden email]> wrote:

> Thanks for reply. I want to explain my problem with an example
> # This is my file path
> components/sample_component/sample_component.rb
>
> methods_for :dialplan do
>   def call_menu
>    Myclass.new(self).start
>   end
> end
>
> class Myclass
>   def initialize(adhearsion)
>                 @adhearsion=adhearsion
>   end
>
>   def start
>        @adhearsion.menu 'Main_prompt',:timeout => 4.seconds,:tries =>
> 3 do |link|
>
> # if the user presses any key from 1 to 5 , I call do_it . In
> component I don't know where I have write do_it method.
>             link.do_it 1..5
>
>             link.on_invalid { @adhearsion.play 'invalid'}
>             link.on_premature_timeout do |str|
>                                 @adhearsion.play 'sorry'
>                         end
>            link.on_failure do
>                         @adhearsion.play 'vm-goodbye'
>                         @adhearsion.hangup
>                    end
>     end
>
> For above code, I want to write the method do_it.Where I have to
> define 'do_it' method.
>
> On Feb 23, 7:10 pm, JasonGoecke <[hidden email]> wrote:
>
> > There is documentation on components here:
>
> >http://docs.adhearsion.com/display/adhearsion/Components
>
> > And the Menu command here:
>
> >http://api.adhearsion.com/Adhearsion/VoIP/Asterisk/Commands.html#menu...
>
> > If you need more than that, please be more specific on the questions/
> > issues you have.
>
> > On Feb 23, 4:26 am, David Stalin <[hidden email]> wrote:
>
> > > Dear friends,
> > >                    I am new to adhearsion. I wanted to use `menu
> > > command ' in component. If anyone
> > > knows pls send Asap.
>
> > > Thanks.
> > > Stalin
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Adhearsion" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/adhearsion?hl=en
-~----------~----~----~----~------~----~------~--~---