smc+astuser@dogphilosophy.net
2006-Apr-02 12:46 UTC
[Asterisk-Users] Asterisk "answering machine" replacement, "WaitForRing()", application return values
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
Dovid Bender
2006-Apr-03 03:52 UTC
[Asterisk-Users] Asterisk "answering machine" replacement, "WaitForRing()", application return values
> 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.Not sure if this wil work and if I am wrond some one out there please correct me. I think you can try this. Exten => s,1,Wait(35) Exten => s,2,Answer Exten => s,3,Voicemail(1) Exten => s,4,Hangup __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com