[Asterisk-Dev] Interrupt AGI command (DIAL after call is
established)
Ledion B
tekixhunga at yahoo.com
Fri Apr 29 09:07:10 MST 2005
Hi all,
I have been working with AGI for quite some time now,
and I think it is a great addition to the asterisk. It
does however leave room for improvement, and in one I
case I have managed to add features that I needed.
I'll describe first the context in which I am using
*'s AGI and issue that I am currently having.
I am building a calling card platform, where
User ---> 800 DID -----> Asterisk ----> Callee
the calling platform will be controlling multiple *-s,
so I am using AGI <-----TCP/IP -----> JAVA server (I
know I can use FastAGI, but I just like to have some
control right at the communication path for failover
capabilities). So there will multiple Asterisks that
will consult the JAVA server for
IVR/authentication/authorization and call routing (i.e
choose from a list of providers). After
authent/authorization I choose a provider, I issue a
Dial command like DIAL(SIP/1234 at domain.com .....) with
all the necessary option. Now if before completion of
the Dial command the JAVA server goes down, then I am
able to detect it within my AGI script, but I cannot
do anything about the ongoing call. I want to
disconnect the call as soon as JAVA goes down. I have
looked at the code and exec does not return control
until dial completes, is it save to run exec in a
thread and then keep on listening for commands and
only process a CANCEL command for example that will
hangup the channel? I know how to do it I just need
some input as to how safe it is to the general health
of the asterisk ??
Feature that I added (I anyone needs this let me know)
Scenario (calling card, probably others)
Caller (authenticated/authorized) wants to dial 12345
and let's assume will let the phone ring for about 1
minute before we decide there was no answer.
After issuing DIAL(Protocol/12345 at ......), the call is
making progress and is answered within 20 seconds of
issuing. The user talks for 1 minute and hangsup. If
the caller hangsup all the channel variables are
destroyed, so there is no way we can get ANSWEREDTIME
or DIALEDTIME. Solution, trivial see how long Dial
takes to return and that is the talk-time that needs
to be billed. Correct??
Maybe not so trivial.
What if there is no answer and the caller decides to
hangup after 59sec -> we'll be billing him for time
not used.
If the time it takes dial to return is > 1 minute than
we're sure the call was connected, but have no idea of
how long it lasted. OK, so do not do billing unless
dial returns after > 1min. What if the call was
answered but lasts < 1min, we just implemented a bug.
Why not use CDRs, in my case they don't seem to be
working properly. If I have a caller that will issue
more than one DIAL (serially), then the CDRs are
messed up, it has been mentioned on the list too.
My solution
Add a command to the AGI called agiDial, that takes
the same parameters as the DIAL command, but it
returns information about the status of the DIAL.
Currently it returns the values of these variables
1. DIALSTATUS
2. DIALEDTIME
3. ANSWEREDTIME.
Thanks
Ledion
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
More information about the asterisk-dev
mailing list