Can we receive inbound faxes in a round robin fashion?

Answered Question
Mar 18th, 2010

We currently have a fax routing setup to our right fax system that directs faxes to 4 different mailboxes based on the area code that the fax is coming from.  We do this via a script in CRS CCX premium 5.0. Calls are directed to 1 of the 4 extensions based on a database lookup against the area code. 

This all works well.  However, it appears some mailboxes get more faxes than others. So my customer would like to change this from area code routing to a round robin type routing. I figured a hunt group would be perfect for this.  However you cannot add a route pattern in to a hunt group, and all right fax extensions are route patterns sending to a route list that is the RF gateway.

I attempted to create some “fake” numbers that are in our standard partition, and placed them in a hunt group.  I then forwarded these numbers to the route patterns.  Apparently forwarding a number residing in the hunt group is not allowed.  It will not look at that part of the DN.

Does anyone know of a way to handle this by chance? Is there a way either via Unified Communication server or CRS?  My CCM is version 6.1.  Is this possible in later version of CCM? My customer is fine with not having this option right now if we know moving to version 7 or 8 will allow this.

Thanks for your help!

Correct Answer by William Bell about 6 years 10 months ago

Under the "if (myNextFaxTag == myMaxFaxTag)" statement, look at your "true" branch.  The variable is an integer and should remain an integer.  So, use set myNextFaxTag=1  not ="1".


The "set myXMLDumpString" statement looks correct.  But this isn't writing anything out to the file.  You still need to write the values to the text file.  That is likely where things are going wrong.


You need a Document variable (e.g. docWriteDynamic).  After you create the myXMLDumpString, you need to assign this string to the document variable:  set docWriteDynamic = myXMLDumpString


You then need write out the document using a command like so:


Write Document (docWriteDynamic to myFaxFileString)


HTH.


Regards,
Bill

Please remember to rate helpful posts.

  • 1
  • 2
  • 3
  • 4
  • 5
Overall Rating: 5 (3 ratings)
Loading.
William Bell Thu, 03/18/2010 - 18:43

If you stick with your CCX theme you could probably accomplish this by tracking calls in a file on the CCX server.  There are multiple ways to do this, but I will keep this to one example.


1. Create a text file called nextfaxnumber.txt

2. File content:


1


3. Upload the document to the Document repository using CCX AppAdmin


Modify your script:


Your CCX script would receive the calls using the same method that you had in place previous.  Then you would read in the text file:


/* variable myMaxFaxTag is used as a control when resetting the nextfaxnumber tag: the value can be set statically and can be a parameter*/

set myMaxFaxTag = 3

/* variable myFaxFileString points to the location of the fax: the value can be set statically and can be a parameter*/

set myFaxFileString = "Documents\user\en_us\nextfaxnumber.txt"


/* we are going to open the text file and retrieve the current tag */

/* myFaxFileDoc and myXMLParserDoc are of type document */

/* myNextFaxTag is of type integer */

myFaxFileDoc = Create File Document (myFaxFileString)

myXMLParserDoc = Create XML Document (myFaxFileDoc)

myNextFaxTag = Get XML Document Data (myXMLParserDoc, "//next")


/*Next, figure out what we want to do*/

Switch int (myNextFaxTag)

    numberone

       set myTransferNumber = "2025551000"

       goto Transfer

    numbertwo

       set myTransferNumber = "2025552000"

       goto Transfer

    numberthree

       set myTransferNumber = "2025553000"

       goto Transfer

:Transfer

/*first update the fax tag variable*/

/*When updating myXMLDumpString (which is a string) use the Expression Builder*/

if (myNextFaxTag==myMaxFaxTag) Then

   true:  set myNextFaxTag = 1

   false:  increment myNextFaxTag


set myXMLDumpString = {

     String myopts = u"<?xml version =\"1.0\" standalone=\"yes\"?>\r\n";

                myopts += u"\r\n\t" + myNextFaxTag.toString() + u"\r\n";

     return myopts;}


/*Now send the call to the fax number stored in "myTransferNumber" (which is a string variable, BTW)*/


After the first run through, the XML file you are using will read:


    2



Now if you have a fourth number, you would need to add another option to the "switch" statement and increase the myMaxFaxTag.  You can do this for the fifth, sixth number, etc.


Like I said, there are probably other ways (and better ways) to track a variable between execution instances of the same script/application.  I also am not sure how you are using CRS today.  You are answering the fax call and transferring it I presume.  Not sure how else you could do that but if you have time to pull a data query then you will have time to read and write a file to the local disk.



HTH.


Regards,
Bill

Please remember to rate helpful posts.


Message was edited by: William Bell (noticed a bug)

pete chirpich Mon, 03/22/2010 - 14:41

Thank you so much for the detail. I will run a few tests and see how it works.!

pete chirpich Wed, 04/28/2010 - 10:02

I finally got approval to start this script. It is close but needs some work.  I have never used "Switch Int" so I used  if then true for that until I can get this working.

The part I am having an issue with is the Doc and XML section, I think.  The script flows through that section ok, but according to my variables, it is never seeing a myNextFaxTag using 1, 2, 3 or 4. Is my syntax for the file correct?


I am attaching a screen shot of the script, as it is pretty basic. For example, in my mind my doc I setup is should be set to myNextFaxTag = 1. So my first "if" statement should work. it basically goes through weach if statement and never hits a true on them. The file I created and uploaded is a txt file, not an xml. is that correct?


Any ideas would be appreciated!

pete chirpich Wed, 04/28/2010 - 14:12

I think I am on to something, not sure.  In my previous post, I am trying checking the value in "myNextFaxTag" and trying if statements looking at that number.  Because that is an integer, will if statement see it? If that is the issue, I will try the Switch Int command but do not understand how to get that working.  Knowing i want to tell the system if value in myNextFaxTag is 1, I want the variable Fax_number = strFaxNumber1, how do I do the "switch" command?

I changed it to this and the commands clears but when I run debug testing it does not dial that number.

I also cannot put “ “ around the actual extension number in the expression. It tells me unable to parse expressions.

This is in dangerous territory for me so if anyone has thoughts, please advise!


Thanks!

pete chirpich Wed, 04/28/2010 - 14:52

OK, time makes me look deeper and learn and I got the switch Int section to work.  I can test it by setting the nextFaxNumber.txt to a number 1, 2,3, or 4 and all route correctly. Cool!


Now the increment integer part is not working! So no matter what I put the txt file to it will always use that same number. It appears it is not writing the file and updating the doc.


That's enough trouble for me today so I will check in tommorow to see if anyone has ideas!


Thanks for listening!

William Bell Wed, 04/28/2010 - 18:37

Pete,


Brother, you have been busy for sure. I was in meetings all day so I am just catching up on this thread. I am not sure where you left off, so you may have fixed some of this.


1. The variable "myNextFaxTag" should be an integer. Mainly because we will increment the value.

2. The switch statement case values you have in your second to last post are incorrect. You want something like:

Switch int (myNextFaxTag)

number2082

set Fax_Number="2082"

GoTo SendCall

number2083

set Fax_Number=2083"

GoTo SendCall


So, if you look at your screen shot in the Modify Case window you should set Value 1 to use Connection number2082. In this CCX step, the "Connection" is simply a label not a command or action. You still have to "set" the Fax_Number variable value.


3. You can increment an integer using the "increment" step under the General step folder.


4. Did you happen to set the myMaxFaxTag variable? This is used to reset the counter back to a value of 1 if the current (myNextFaxTag) is a value of 4 (in your case).


5. Can you post the expression you are using to write out the XML file.


6. You can check whether the XML file is being updated but running an iteration of your script and then going to the console of the UCCX server and checking the content of the text file.


HTH.


Regards,

Bill

pete chirpich Thu, 04/29/2010 - 07:59

/* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman"; mso-ansi-language:#0400; mso-fareast-language:#0400; mso-bidi-language:#0400;}

Thanks so much for the reply. I think my Switch section should be ok. See screen shot. I manually changed my txt file to each fax number, 1,2,3,4 and ran debug call on the script, and each time it went to the correct Switch entry. So that tells me the file is getting read, variable is getting seen for myNextFaxTag and life should be good. 


So we move to the SendCall section.  My if statement always returns false to see if myNextFaxTag = myMaxFaxTag. When I started the script writing, I just used a String variable with parameter so I could set it in the app side. Inever did a set command though. So I now created a new variable strMaxFaxNumbers with Parameter. In the app I set it to 4.  One of my first steps in the script (before create doc and xlm section) is Set myMaxFaxTag = strmaxFaxNumbers.  When I get to the if then to see if it is at 4, it still returns false.  I then changed that command to myMaxFaxTag = 4.  Still returns false.


Within that if statement false area, I do an increment step.  However, it appears it is not doing a write statement.  Honestly I just took what you had written and hoped it worked!  I have no idea how to do a write step.


I do check the txt file and it is always set to what I am manually setting it to, so I know it is not getting updated.

Correct Answer
William Bell Thu, 04/29/2010 - 08:19

Under the "if (myNextFaxTag == myMaxFaxTag)" statement, look at your "true" branch.  The variable is an integer and should remain an integer.  So, use set myNextFaxTag=1  not ="1".


The "set myXMLDumpString" statement looks correct.  But this isn't writing anything out to the file.  You still need to write the values to the text file.  That is likely where things are going wrong.


You need a Document variable (e.g. docWriteDynamic).  After you create the myXMLDumpString, you need to assign this string to the document variable:  set docWriteDynamic = myXMLDumpString


You then need write out the document using a command like so:


Write Document (docWriteDynamic to myFaxFileString)


HTH.


Regards,
Bill

Please remember to rate helpful posts.

pete chirpich Thu, 04/29/2010 - 08:36

So close I can smell it! I was trying difernet things to get that write statement but always get messed up on what variable to create, what type, etc.  That now works!  So I set my txt file to 1 and it picks it up in the script and later sets it to 2. Very cool!


My last issue is it does not seems to be picking up my setting for myMaxFaxTag. So my if statement never hits true. (I did change that true statement so if/when it does hit it, it will reset correctly).


Ijust went through the script again after starting to write this and....

I changed myMaxFaxTag from string to Int and it worked! It reset it to 1 and the txt file was written to accordingly!


I think we may be in business. I will go through it and make sure any possible error cases are handled to at least fax to a line.


Thanks you so much for your help! My user will be delighted!

William Bell Thu, 04/29/2010 - 08:44

Glad to hear it. Let me know how it works out and thanks for taking the time to rate posts. It is greatly appreciated.


Regards,

Bill

pete chirpich Wed, 10/19/2011 - 10:22

Hello again! This script has been working great since we implemented it, many moons ago, and I again thank you for that!


We upgraded to 8.5 last weekend. Not it is not working.  I had to change my file to load in the repository versus telling it the C:\xxx path like it did previously. That part is not an issue. I did, however, convert the file to XML so I could write to it, so I thought. As it turns out it seems it won't write to this doc at all from the script.  I can debug and see that all data is in fact ready to be saved to my file, (Steps "Set myXMLDumpstring " and "Set docWriteDynamic" and "Write Document". They all pass as if it worked, and I can see during debug that the value is trying to change to "2", as it should be. 


On this version, do I need to tell it what user id it can use to write to the repository file with?

pete chirpich Wed, 10/19/2011 - 12:40

We got it going. Found out we had to use the Auth steps and upload document in the new version. All is well in the word again!

Actions

This Discussion