Greetings, I started looking at issue 8030 yesterday, which adds the S() and L() options to MeetMe, which act the same as those options for the Dial application.
http://bugs.digium.com/view.php?id=8030 After thinking about it, I decided it would make more sense to attempt to make a way to use these features for any application, instead of putting this code in a lot of places. I have a little bit of the code actually written, but I have an idea for how I want all of it to work in my head. Right now, I just wanted to show my plan for the interface I plan to build to see if anyone has any comments on things that would make the features easier to use before I get too far with coding it. Requirements: Today, the Dial application has the S() and L() options. The S() option lets you limit how long a call will last. The L() option does the same, but also plays sounds to warn the user when time is running out. So, to make these features generic, I have decided to implement the following three application independent features: 1) Scheduled announcements 2) Periodic announcements 3) Application timeout Design: 1) Scheduled announcements To accomplish playing an announcement to a channel at some point in the future, I plan to make two functions, START_ANNOUNCE, and STOP_ANNOUNCE. These will have the announcement mixed with whatever other audio the channel is receiving at the time of the announcement. ; Schedule a beep for 2 minutes from now exten => s,1,Set(ANNOUNCE_ID=${START_ANNOUNCE(beep,120)}) ; 2 minutes into a conference, hear a beep exten => s,n,MeetMe(1234) ; Unschedule the beep exten => s,n,NoOp(Unscheduling the beep ${UNSCHED_ANNOUNCE(${ANNOUNCE_ID})} seconds later) 2) Periodic announcements This just uses an additional argument to START_ANNOUNCE, to set a repeat interval. ; Set a periodic announement to play a beep every 10 seconds exten => s,1,Set(ANNOUNCE_ID=${START_ANNOUNCE(beep,0,10)}) ; Call someone and have a beep in your ear every 10 seconds. exten => s,n,Dial(IAX2/123) ; Stop the announcement exten => s,n,NoOp(Announcement ran for ${STOP_ANNOUNCE(${ANNOUNCE_ID})} seconds) 3) Application timeout This is the trickiest one to implement. The idea is to be able to set a custom timeout to make it break out of whatever application it is currently in when hit. ; Limit conference to 5 minutes exten => s,1,Set(TIMEOUT(application)=300) exten => s,n,MeetMe(1234) ; Turn timeout back off exten => s,n,Set(TIMEOUT(application)=0) Full example: ; Limit a call to 5 minutes exten => s,1,Set(TIMEOUT(application)=300) ; Play a beep every 5 seconds for the last minute exten => s,n,Set(ANNOUNCE_ID1=${START_ANNOUNCE(beep,240,5)}) ; Let them know just before the timeout hits exten => s,n,Set(ANNOUNCE_ID2=${START_ANNOUNCE(timeup,395)}) exten => s,n,Dial(SIP/1234) ; Cancel announcements in case the call ended early exten => s,n,NoOp(Cancel beep after ${STOP_ANNOUNCE(${ANNOUNCE_ID1})} seconds) exten => s,n,NoOp(Cancel timeup after ${STOP_ANNOUNCE(${ANNOUNCE_ID2})} seconds) ; Turn off application timeout exten => s,n,Set(TIMEOUT(application)=0) -- Russell Bryant Software Engineer Digium, Inc. _______________________________________________ --Bandwidth and Colocation Provided by http://www.api-digital.com-- asterisk-dev mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-dev
