Asterisk, and other worldly endeavours.

A blog by Leif Madsen

Posts Tagged ‘documentation

Scheduling automated calls between two participants with res_calendar

Here is a little dialplan snippet I wrote this morning for the next edition of the Asterisk book. While I’m not going to delve into all the aspects of setting up res_calendar like we do in the book, I thought for those of you who might already have this working might enjoy it.

(The calendaring modules are available in Asterisk 1.8, which is currently in release candidate status. Check out http://www.asterisk.org/downloads for the current version.)

I started with this little bit of dialplan that gets triggered when a call is answered from the calendaring module:



[AutomatedMeetingSetup]
exten => start,1,Verbose(2,Triggering meeting setup for two participants)
   same => n,Set(DeviceToDial=${FILTER(0-9A-Za-z,${CALENDAR_EVENT(location)})})
   same => n,Dial(SIP/${DeviceToDial},30)
   same => n,Hangup()

The location field in my calendar event (which in this case is labeled as Destination in my Google Calendar) contains the string 0000FFFF0002 which is the device identifier in my example.

Once you get that working, the cool magic happens below. In the following example, a call is placed from the calendaring module when a meeting needs to take place between two participants. The first part of the dialplan allows the first person called to accept or reject the meeting, and if accepted, to record a message for the other party. Once that recording is saved, the dialplan will go ahead and trigger a call to the other meeting participant.

When that meeting participant answers the call, a Macro() is employed to allow them to listen to the recorded message left by the first party, (i.e. “Hey Jim, this is Leif. We have a meeting scheduled right now.”). That person is then presented the same option to accept or reject the call by pressing 1 or 2.

Of course the dialplan could even by further expanded to play back messages when the calls were rejected, the option for the called party to leave a return message of why they are rejecting the call, and maybe even the ability to post-pone the call for a few minutes. All it takes is some clever dialplan!

[AutomatedMeetingSetup]
exten => start,1,Verbose(2,Triggering meeting setup for two participants)
same => n,Read(CheckMeetingAcceptance,to-confirm-wakeup&press-1&otherwise&press-2,,1)
same => n,GotoIf($["${CheckMeetingAcceptance}" != "1"]?hangup,1)

same => n,Playback(silence/1&pls-rcrd-name-at-tone&and-prs-pound-whn-finished)
same => n,Set(__RandomNumber=${RAND()})
same => n,Record(/tmp/meeting-invite-${RandomNumber}.ulaw)

same => n,Set(DeviceToDial=${FILTER(0-9A-Za-z,${CALENDAR_EVENT(location)})})
same => n,Dial(SIP/${DeviceToDial},30,M(CheckConfirm))
same => n,Hangup()

exten => hangup,1,Verbose(2,Call was rejected)
same => n,Playback(vm-goodbye)
same => n,Hangup()

[macro-CheckConfirm]
exten => s,1,Verbose(2,Allowing called party to accept or reject)
same => n,Playback(/tmp/meeting-invite-${RandomNumber})
same => n,Read(CheckMeetingAcceptance,to-confirm-wakeup&press-1&otherwise&press-2,,1)
same => n,GotoIf($["${CheckMeetingAcceptance}" != "1"]?hangup,1)

exten => hangup,1,Verbose(2,Call was rejected by called party)
same => n,Playback(vm-goodbye)
same => n,Hangup()
Advertisements

Written by Leif Madsen

2010/09/29 at 9:25 am

Starting work on Asterisk: TFoT 3rd edition

As many of you know, I’m a co-author of Asterisk: The Future of Telephony. While my girlfriend is away in Mexico for a week with the girls, I’m going to try and focus a bunch of attention on getting A:TFoT 3rd edition started (which is much overdue).

If you have any ideas for topics you would like covered in the new edition, or something that wasn’t covered as heavily as you wanted in the 1st and 2nd editions, feel free to let me know, and your ideas will be considered! I hope to get the installation chapter written today, and as things progress, we’ll get them posted up on the web (likely somewhere on http://www.asteriskdocs.org) for review by the community.

We’re going to try and write mostly in the open as we have things ready to go, so a more thorough community review can be done this time around rather than the closed review we’ve used in the past and the “get it when it’s done” approach.

More information to follow in the coming week(s)!

Written by Leif Madsen

2009/11/23 at 9:03 am

Posted in Asterisk

Tagged with , , ,

Building Queues with Asterisk

Wow it’s been a long time since I’ve update my blog. Well, lets do that! 🙂

I’ve just posted some documentation to the Asterisk issue tracker for review. It’s about building queues with Asterisk. It is the start of probably 2 or 3 sets of documentation on building queues with Asterisk that I’ll be submitting. You can find the documentation here for now:

https://issues.asterisk.org/view.php?id=16237

This documentation will likely be merged into core Asterisk at some point in the near future (doc/ subdirectory of your Asterisk source) and likely posted on http://blogs.asterisk.org as well.

Check it out, and let me know if you find any spelling errors, documentation errors, anything that isn’t clear, or errors in the examples. Of course suggestions for future documentation to be written would also be welcomed.

Thanks!

Written by Leif Madsen

2009/11/14 at 10:07 am