[Asterisk-Users] Asterisk "answering machine" replacement,
"WaitForRing()", application return values
smc+astuser at dogphilosophy.net
smc+astuser at dogphilosophy.net
Sun Apr 2 12:46:25 MST 2006
This is possibly a dumb question, but I've googled around and poked through
the documentation and I'm a bit confused.
My initial experiment with Asterisk involves setting it up in place of my old
dedicated "answering machine". That means I've still got a regular old phone
on the line which we normally answer calls with.[1]
I'm trying to set up Asterisk to leave the line alone if someone picks up the
regular phone within a certain number of rings. Google came up with a few
people asking how to do the same thing but no definitive descriptions or
indications as to what worked.
I THINK I actually have this set up now, but I'm unclear on how
"WaitForRing()" is supposed to work.
Depending on which set of documentation you look it, it seems
"WaitForRing($seconds)" is supposed to either A)Wait $seconds seconds AFTER
the next ring it detects or B)Wait $seconds for the next ring (and fail if no
ring occurs in that time) or possibly C)Wait $seconds seconds, then listen
for the next ring.
(The OReilly book has one description for the application as the "summary",
then another as the full description...)
I'm operating on the assumption that B) is supposed to be correct when you use
"WaitForRing()" in the context of an incoming call?
Also, while googling I did find that you can't do anything with the "return
values" of applications (looks like the "return values" are only for
programmers writing asterisk modules). Is it correct that if an applications
fails ("returns -1") the thread stops at that point due to the failure?
Basically, my approach in extensions.conf right now is:
;wait about 3-4 rings
Wait(14)
;listen for one more ring - if there isn't one, leave the line alone
;because we assume someone picked up the "regular" phone in time
WaitForRing(1)
;I assume if WaitForRing(1) fails [returns -1] it kills the
;thread automatically?
;otherwise - answer and have Asterisk take over handling the call
Answer()
etc.
(Any other recommended approaches for this would be appreciated, too...)
Thanks, all
[1] money is an issue, otherwise I could just swap in a VoIP phone or buy the
expensive (for my budget at the moment) TDM card with an FXO and FXS module
instead of the cheap X101P clone I'm using now.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: not available
Url : http://lists.digium.com/pipermail/asterisk-users/attachments/20060402/a8ae0b89/attachment.pgp
More information about the asterisk-users
mailing list