Diving In: Questions About AGI and Events

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

Diving In: Questions About AGI and Events

lars.lehtonen@gmail.com

I was talking to Jay and Jason on #adhearsion about these issues, and
I am going to continue talking with them today.  If not answered here
I'll come back and post the answers to these questions using whatever
I learn via irc.

1.  How do I use the arguments that I pass with the AGI application in
the Asterisk dialplan?  I'd like to know how to use the "knife" and
the "boat" in something like:

exten => 100,2,AGI(agi://1.2.3.4,"knife", "boat")

2.  When Adhearsion takes control of a call it puts to stdout a hash
that contains stuff like
{ :calleridname=>"ip320", :channel=>"SIP/ip320-
f40b8cf0", :type=>"SIP"}

How do I get at the values in this hash once I'm in dialplan.rb?

3.  Adhearsion events are painfully opaque to me.  Reading the docs
only sows confusion.
<http://docs.adhearsion.com/display/adhearsion/Events>

Here is a description of what I am trying to do.  I'll mark what I
think to be "events" as such.  Am I understanding "events" properly?

Call is already up, caller is already interacting with the dialplan.
1.  Get a phone number from the caller
2.  Use AMI to originate a call to the phone number, with a meetme
extension as its destination.  This is non-blocking.
3.  Caller continues to interact with dialplan

*EVENT* If the ami originate returns a NewState: Up at any point after
step 2 then I want to use an AMI redirect to grab the caller's channel
and move it in to the same meetme extension as the now-connected call
from the AMI Originate.

-----
Lars Lehtonen
--~--~---------~--~----~------------~-------~--~----~
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: Diving In: Questions About AGI and Events

JasonGoecke

On the first question, please see below:

> 1.  How do I use the arguments that I pass with the AGI application in
> the Asterisk dialplan?  I'd like to know how to use the "knife" and
> the "boat" in something like:
>
> exten => 100,2,AGI(agi://1.2.3.4,"knife", "boat")
>

I do not believe that Adhearsion currently supports the passing of
arguments with the AGI request itself. As based on my own testing, you
may see that nothing comes across the channel when the call comes in
with a similar example to the above:

http://gist.github.com/66479

The recommended way is to use the Set command to create channel
variables before making the AGI call, and then using the method
get_variable in your Ahn dialplan to fetch them. You may see an
example here:

http://gist.github.com/66485

With this, you may achieve the same thing by assigning values to the
channel created.
--~--~---------~--~----~------------~-------~--~----~
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: Diving In: Questions About AGI and Events

JasonGoecke
In reply to this post by lars.lehtonen@gmail.com

On question 2, please see my comments below:

> 2.  When Adhearsion takes control of a call it puts to stdout a hash
> that contains stuff like
> { :calleridname=>"ip320", :channel=>"SIP/ip320-
> f40b8cf0", :type=>"SIP"}
>
> How do I get at the values in this hash once I'm in dialplan.rb?

These are simply in scope in the dialplan as follows:

##dialplan.rb
inbound {
  ahn_log.dialplan.debug chan
}

##ahn debug log
DEBUG dialplan: SIP/127.0.0.1-0083e000

--~--~---------~--~----~------------~-------~--~----~
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: Diving In: Questions About AGI and Events

JasonGoecke

that should be:

inbound {
  ahn_log.dialplan.debug channel
}

On Feb 18, 11:59 am, JasonGoecke <[hidden email]> wrote:

> On question 2, please see my comments below:
>
> > 2.  When Adhearsion takes control of a call it puts to stdout a hash
> > that contains stuff like
> > { :calleridname=>"ip320", :channel=>"SIP/ip320-
> > f40b8cf0", :type=>"SIP"}
>
> > How do I get at the values in this hash once I'm in dialplan.rb?
>
> These are simply in scope in the dialplan as follows:
>
> ##dialplan.rb
> inbound {
>   ahn_log.dialplan.debug chan
>
> }
>
> ##ahn debug log
> DEBUG dialplan: SIP/127.0.0.1-0083e000
--~--~---------~--~----~------------~-------~--~----~
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: Diving In: Questions About AGI and Events

JasonGoecke
In reply to this post by lars.lehtonen@gmail.com

On question number 3 please see my comments below:

> 3.  Adhearsion events are painfully opaque to me.  Reading the docs
> only sows confusion.
> <http://docs.adhearsion.com/display/adhearsion/Events>
>
> Here is a description of what I am trying to do.  I'll mark what I
> think to be "events" as such.  Am I understanding "events" properly?
>
> Call is already up, caller is already interacting with the dialplan.
> 1.  Get a phone number from the caller
> 2.  Use AMI to originate a call to the phone number, with a meetme
> extension as its destination.  This is non-blocking.
> 3.  Caller continues to interact with dialplan
>
> *EVENT* If the ami originate returns a NewState: Up at any point after
> step 2 then I want to use an AMI redirect to grab the caller's channel
> and move it in to the same meetme extension as the now-connected call
> from the AMI Originate.

I have written an example app that may do the above for you, details
here:

http://gist.github.com/66539

In this case the following happens:

1. Caller 1 dials in and gets in input prompt to enter a phone number
2. A dialplan method in the component is invoked to do an async
originate (ie - non-blocking)
3. Caller 1 then starts hearing beeps every 10 seconds while waiting
for caller 2 to arrive in the conference room
4. Caller 2 arrives and triggers an event that invokes a method in the
component to redirect caller 1
5. Caller 1 is then also redirected into the conference room

I choose to use app_conference for conferencing on Asterisk as it is
much more efficient than MeetMe. Although if you want to use MeetMe
you may use the dialplan method join.

Also, of course you may dynamically assign conference rooms so that
each two callers have their own private room. I hope that helps. Also,
we welcome any recommendations on improving the documentation as the
whole point of Adhearsion is to make this all the more approachable.


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