Call Handler changes from external app or SQL query.
Just wondering if anyone has been able to make Call
Handler changes from an external app or SQL query.
My aim is to change the value of a Call Handlers transfer options. I use a caller input value on the subscriber to go to a call handler which has a transfer to an external number, i would like to be able to change this from a web page.
Re: Call Handler changes from external app or SQL query.
In this case youll need to edit values on the ContactRule table which at this time doesnt have any stored procedures wrapping it youll have to edit the table directly. Most of the stored procedures weve been working on up front since 4.0(1)s release have been related to subscriber creation/deletion/editing since thats what most sites doing programmatic administration are interested in. Well get stored procs in front of all objects in the database eventually, but for now youll have to do this one in the buff as it were.
In the Data Object Model document on the Documents page of www.CiscoUnityTools.com I talk about the contact rules and how they apply to call handlers the short story is every call handler is associated with 3 contact rules: an alternate, off hours and standard.
In your case Im assuming that the call handlers are already configured and the transfer rule you want to edit is the alternate. You can substitute standard or off hours in the SQL strings below if not. Also, if you dont have the latest CUDLE installed off www.CiscoUnityTools.com, itd probably be a good idea to get that its helpful to see the brief explanations for what all the columns mean in each of the tables as you go with such projects.
First, you want to find the call handler in question and then go fetch the contact rules for that guy. Im assuming youre probably finding call handlers by alias here. To get the alternate contact rule for the call handler with an alias of OperatorCH (the operator call handler) youd use a query like this:
SELECT ContactRule.* FROM ContactRule INNER JOIN vw_CallHandler
WHERE ContactRule.Alias='Alternate' AND vw_CallHandler.Alias='OperatorCH'
If youre using extensions to find handlers instead of aliases thatd work as well, youd just substitute AND vw_CallHandler.DTMFAccessID=1234 into the query above.
Notice that were not using the view for the contact rule here since were going to be editing it directly.
The examples out on the code samples page cover how to attach to SQL either on box or on a remote server and how to use queries like the above, that should get you from A to B for that. Just be sure to open the recordset as a keyset and allow optimistic updates if youre using ADO (as I do in all my examples).
If the call handler is already setup to do a transfer using this contact rule the only value you need to change is the Extension column this is the actual dial string that the transfer rule will use (be sure to include the CO prefix if necessary). Save it and youre done.
If the contact rule is not configured to transfer or youre not sure one way or the other youll want to check a few fields (explanations for these can all be found in CUDLE, of course). Make sure the Action field is set to 1 this means to attempt the transfer with this rule. Make sure the TimeExpires field is set to NULL this means the rule is active a time in the past means its disabled. Make sure the TransferType value is either 0 for release or 1 for supervised if its supervised make sure the TransferRings is set to the number of rings you want.
Thats about it. Not overly complicated, you just need to be careful. The one thing thatll bite you here is making sure the transfer string entered is allowed by the transfer restriction table of the person making the change Im not sure how youre setting up this web page or how users will authenticate or whatever, but one way or another youll want to grab the Class of Service of the person requesting the transfer string change and make sure the string they enter is allowed by their restriction tables. Ill post a brief VB source clip in the next post that shows how to do that so I dont run over my max allowed characters in a post here
Re: Call Handler changes from external app or SQL query.
Heres some VB code I pulled out of dbWalker that shows how to grab a COS entry and check a transfer string against its transfer restriction table rules. Unfortunately when I paste it in here it loses all it's indentation and color so it's not as fabulously readable as it is in my dev environment. Also, just in case one of my former Computer Science professors is reading this, I've yanked out the error handling code here to make it shorter - honest.
Just for review here restriction tables are a collection of pattern matching strings made up of numbers and wildcard characters and an allow or dont allow flag they are processed in order from top to bottom until the dial string matches and the allow/dont is evaluated. The last rule is always * which will match anything so youre guaranteed a rule will match.
For this routine, you pass in the Class of Service ObjectID of the subscriber and the transfer string you want to check and it returns True or False depending on if the string is allowed by that COS transfer restriction table or not.
This code uses a nifty little VBScript object called RegExp which is a RegularExpression object. To use it in VB you need to include the Microsoft VBScript Regular Expressions 5.5 object in your project references.
Private Function IsTransferStringLegal(strStringToCheck as String, strCOSObjectID as string) as Boolean
Dim rsRT As ADODB.Recordset
Dim rsPatterns As ADODB.Recordset
Dim rsCOS as ADODB.Recordset
Dim strPattern As String
Dim myRegExp As New RegExp
If Len(strStringToCheck) = 0 Then
'We assume that an empty string is legal
Assume false here
Setup the regular expression object here
myRegExp.IgnoreCase = True
myRegExp.Global = False
Set rsCOS=New ADODB.Recordset
rsCOS.Open "SELECT * FROM vw_COS WHERE COSObjectID='" + strCOSObjectID + "'",strConnectionString, adOpenKeySet, adLockReadOnly
If rsCOS.RecordCount=0 Then
Msgbox (error) could not find COS reference
Set rsRT = New ADODB.Recordset
rsRT.Open "SELECT * FROM vw_RestrictionTable WHERE RestrictionObjectID="+ rsCOS("XferRestrictionObjectID") + "'", strConnectionString, adOpenKeyset, adLockReadOnly
If rsRT.Recordcount=0 Then
MsgBox(error) could not find restriction table for transfer
Pull the patterns associated with the restriction table out. Be sure to preserve the index order since the order in which theyre evaluated is important.
Set rsPatterns = New ADODB.Recordset
rsPatterns.CursorLocation = adUseClient
rsPatterns.Open "Select * from VW_RestrictionPattern WHERE ParentObjectID='" + rsRT("RestrictionObjectID") + "' ORDER BY [Index]", strConnectionString, adOpenStatic, adLockReadOnly
If rsPatterns.RecordCount = 0 Then
MsgBox (error) no restriction table patterns found for restriction table
I'm not able to access my old voice mail messages all of a sudden. The recording says something like 'the message is currently not available'. This has never happened before in all the years I have been using this system. I have t...
If you have 2 ISR routers, one acting as Failover, do we need to have both the same number of SRST licenses on the 2 routers?
No. You will only need the SRST licenses on the primary router. Because this feature...