Haiku #63

Is that the phone? Should

I answer? No, let the call

Action handle it.


Historically, the third part of a three-part series hasn't always been well-received; for example, one critic remarked that the movie Godfather III was "An epic without epic scope, a muted, strained, unnatural affair that never comes into dramatic focus."


Oh, wait, never mind: that quote was actually from an editor who was editing something written by the author of today's haiku. But you get the idea. Return of the Jedi? It was OK, but compared to its predecessor (The Empire Strikes Back) the author of today's haiku found it "An epic without epic scope, a muted, strained, unnatural affair that never comes into dramatic focus." Back to the Future 3? Oh, please: after doing such a masterful job of setting the rules and regulations of time travel in the first two movies, in Back to the Future 3 they broke every single one of those rules. Star Trek 3? Well, about the best you can say about that movie is that it wasn't Star Trek 4, that weird one about going back in time to help a pair of whales save the Earth.


Note. What's that? Revenge of the Nerds 3? Well, to be honest, we didn't actually see Revenge of the Nerds 3. But we're guessing that if you've seen one Nerd movie (which we haven't) then you've probably seen them all.


So why are we so concerned about the third part of a three-part series? Oh, no reason, really. Except for this: today we present the third part of our three-part series on configuring Response Group application questions and answer. That's right, it time for Return/Revenge of New-CsRgsCallAction III.


Note. Critics are already calling it "A haiku without epic scope, a muted, strained, unnatural affair that never comes into dramatic focus."


You might recall that, in our first episode (which we were going to call Star Wars Episode 4: A New Hope, until we found out that title had already been taken) we explained how to use the New-CsRgsAnswer cmdlet to create an answer to a Response Group question. As you know (or at least will know after this trilogy comes out on DVD), the Response Group enables you to ask callers a question when they phone a number associated with the Response Group application. The example we used was this:


"Would you like English or Spanish? Say English or Spanish, or press 1 for English or 2 for Spanish."


As we said, that's an example of a Response Group question, something we covered in detail in Episode 2. The answers to that question (which we discussed in the first episode) represent the allowed responses to the question. In this case, callers can say English (or press 1) to be transferred to the English-language help desk, or say Spanish (or press 2) to be transferred to the Spanish-language help desk. And that's pretty much all they can do.


Note. So does that mean that Episode 1 really should have been Episode 2, and that Episode 2 really should have been Episode 1? Maybe. But, then again, practically all trilogies start with Episode 1 and then go on to Episode 2. We didn't want to be accused of copying anyone!


Without completely giving the dramatic ending away, by the time Episode 2 reached its heart-stopping climax, we had successfully created a Response Group question, and even added a couple of answers to that question. (Man, that was an action-packed episode, wasn't it?) But we still had a problem: our question existed only in memory, and wasn't actually tied to a Response Group workflow. In turn, that meant that our question would never be used.


That's what we said: dang.


The solution to this problem? That was easy: go back in time and find a couple of whales who can help us assign our new question to a Response Group workflow. Unfortunately, though, that didn't turn out to be anywhere near as easy as we thought it would be. (Go figure.) Consequently, we did the next best thing: we found a couple of whales in our own time era who pointed us towards the help documentation for New-CsRgsCallAction. (Thanks, guys!)


As it turns out, the name "call action" is a pretty good description of what a Response Group call action does: it defines the action to be taken when someone calls a number associated with the Response Group. (Call actions can also be used at other times; for example, when we set up our answers we used call actions to define the actions to be taken when someone selects one of those answer.) When you create a new call action with the New-CsRgsCallAction cmdlet, your biggest chore is defining the action that will be taken; that means setting the Action parameter to one of the following:


·         Terminate – The call is terminated.

·         TransferToQueue – The call is transferred to a Response Group queue.

·         TransferToQuestion – The call is transferred to a Response Group question.

·         TransferToUri – The call is transferred to the specified SIP Uniform Resource Identifier (URI).

·         TransferToVoiceMailUri – The call is transferred to voice mail.

·         TransferToPSTN – The call is transferred to a public switched telephone network (PSTN) telephone.


In this continuing example, we're going to set the Action to TransferToQuestion. Why? You got it: because when people call our help desk phone number we want them to automatically be transferred to the question that asks if they want the English-language help desk or the Spanish-language help desk.


Yesterday we used the following line of code (plus some additional code that we won't repeat today) in order to create a Response Group question:


$question = New-CsRgsQuestion -Prompt $prompt -AnswerList $englishAnswer, $spanishAnswer


Now that we've done that, our next task is to add that question to a call action. How are we going to do that? Funny you should ask:


$callAction = New-CsRgsCallAction -Action TransferToQuestion –Question $question.Identity


As you can see, there isn't much to this command. We simply call the New-CsRgsCallAction cmdlet, setting the value of the Action parameter to TransferToQuestion and the value of the Question parameter to the Identity of our question object ($question.Identity). Keep in mind that this is how you transfer a call to a question. To so something else, like transfer a call to a Response Group queue, you'll need to set the Action to the correct value and then use the corresponding parameter:


$callAction = New-CsRgsCallAction -Action TransferToQueue -QueueID $queue.Identity


In that example, the corresponding parameter is QueueID, because we want to transfer the call to a queue. If we wanted to transfer a call to a URI (including a voice mail URI) or a PSTN phone number we would use the Uri parameter followed by the appropriate URI:


$callAction = New-CsRgsCallAction -Action TransferToUri -Uri "sip:helpdesk@litwareinc.com"


Etc., etc.


So now do we have a real question that can be used by the Response Group application? Well, no, not yet, although we are getting closer. You might have noticed that, when we called the New-CsRgsCallAction cmdlet, we stored the resulting call action in a variable named $callAction. What we have to do now is retrieve an instance of a Response Group workflow and then assign that call action to the workflow. Without going into a lot of detail, that process might look something like this:


$workflow = Get-CsRgsWorkflow service:ApplicationServer:atl-cs-001.litwareinc.com -Name "Help Desk"

$x.DefaultAction = $callAction

Set-CsRgsWorkflow -Instance $workflow


What we've done here is use the Get-CsRgsWorkflow cmdlet to create an object reference to the Help Desk workflow. We set the DefaultAction property to the variable $callAction, then use Set-CsRgsWorkflow to make those changes take effect. And now, three days later, we finally have a system that actually works: if a caller calls the help desk, he or she will automatically be transferred to a question that asks if the caller wants English or Spanish. The callers picks a language, and then gets transferred to the desired help desk queue (English or Spanish).




Note. We should point out that even though it took us three days to get this far, it shouldn't take you more than 5 or 10 minutes to put together the code to create a working question and set of answers. Just follow the examples used in this trilogy and you should be fine.


In the meantime, and with a nod towards Douglas Adams and his classic work So Long, and Thanks for All the Fish, we'll be working on the fourth installment in our trilogy. We're not sure what that one will be about, but Star Wars 4 was about whales, and So Long, and Thanks for All the Fish was about dolphins, so we're guessing that our Episode 4 will probably be about herring, or possibly smoked cod. Stay tuned!


Comments (0)

Skip to main content