cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
4488
Views
35
Helpful
10
Replies

UCCX - Passing Variables between 2 IVR Scripts

ln33147
Level 4
Level 4

Dears,

I have created 2 very basic scripts trying to test how to pass variables between them.

What I'm facing is that I'm always getting null when retrieving the session variables in the second script(RetrievingSessionVariables.aef).

I have attached the scripts.

I appreciate if someone can take a look at them and advise on what could be missing.

Thank you in advance.

1 Accepted Solution

Accepted Solutions

Okay, I had a chance to run these through a debug and made a few minor changes.  The first issue I encountered was the use of the "Place Call" step should probably be a "Call Redirect" step instead.  A "Place Call" step does not connect the current calling contact to the next script.  Is this desired? 

If you meant to disconnect the call and start a separate application without the contact continuing, then I found I had to modify the property settings for the "Place Call" step properties to match my call control groups.  Make sure yours are correct for you system, as the call will drop immediately if media and call control cannot be established via the designated CTI port--in which I experienced the same outcome for null output for the variables you want to pass...

Try experimenting with the attached scripts and set the boolean parameter on the administrative user interface for the variable I created (bUseCallRedirect) to "true" and evaluate if the "Call Redirect" step works the way you expect.  Call Redirect will transfer the call contact to the next script with the session variables you want to pass with the expected outcome I think you are trying to achieve.

I also modified the get session processes to use a "Get Session" step, instead of using a "Get Contact Info" for the session data. (New Session radio button is selected on the "TestSessionVariables" script, and not set on the "RetrieveSessionVariables" script).

-Sean

View solution in original post

10 Replies 10

Sean Lynch
Level 7
Level 7

I didn't try running your script, however this is what I think is causing your issue:

 

2018-1016-sessionData.png

Let me know if this helps.  If not, I'll run it through a reactive debug and see what's missing.

 

-Sean

Hello Sean,

Thank you for taking the time to respond. I tried removing "Set Contact Info" but it is still the same issue.

Thank you in advance for your support.

Lara

Okay, I had a chance to run these through a debug and made a few minor changes.  The first issue I encountered was the use of the "Place Call" step should probably be a "Call Redirect" step instead.  A "Place Call" step does not connect the current calling contact to the next script.  Is this desired? 

If you meant to disconnect the call and start a separate application without the contact continuing, then I found I had to modify the property settings for the "Place Call" step properties to match my call control groups.  Make sure yours are correct for you system, as the call will drop immediately if media and call control cannot be established via the designated CTI port--in which I experienced the same outcome for null output for the variables you want to pass...

Try experimenting with the attached scripts and set the boolean parameter on the administrative user interface for the variable I created (bUseCallRedirect) to "true" and evaluate if the "Call Redirect" step works the way you expect.  Call Redirect will transfer the call contact to the next script with the session variables you want to pass with the expected outcome I think you are trying to achieve.

I also modified the get session processes to use a "Get Session" step, instead of using a "Get Contact Info" for the session data. (New Session radio button is selected on the "TestSessionVariables" script, and not set on the "RetrieveSessionVariables" script).

-Sean

The original poster's problem was that they were dealing with two different Triggering Contacts' Sessions, and was storing data in one, while reading from the other; that's not going to work.

 

So, yes, you were right in your assumption that a Call Redirect might have been more appropriate.  Not only from a Session handling perspective, but from a call flow perspective.  But, what do I know, maybe he actually meant to use the Place Call step.

 

There were a few mistakes on your part, and I wasn't going to correct them, since the OP already marked your reply as the solution; however, it looks like there is some misinformation going around about how to work with Sessions.

 

Take this YouTube video for example, which looks similar to your Rev2 script solution:

https://www.youtube.com/watch?v=9HXivETA8bE

 

There's a few things wrong here, and I'd like to address them.

 

1) UCCX automatically creates a new session for every call, and so, you don't have to.  Not only do you not need to, you really shouldn't, because you're now causing UCCX to create two sessions for every call.

 

Using Real Time Reporting (RTR), we can see what a Session looks like for a call, where UCCX creates it automatically:

uccx-rtr-auto-session.png

 

2) If you were actually in need of a separate and new session from the one automatically created for you, like say if you were wanting to hold some cached data for all Contacts to use, then you would use the Get Session step, and provide it with a mapping ID.

 

uccx-script-manual-session.png

uccx-rtr-manual-session.png

Notice how my completely arbitrary mapping name of "banana" shows up as the Mapping ID in RTR.

 

The reason for the mapping ID in the first place is because, like I said before, UCCX will create a new Session for every call.  So, a caller who just called back, would likely have a previous session existing already, and we'd need a way to retrieve that existing session.  The way we do that is by using the Session Mapping, which we might map to, let's say the caller's phone number, or perhaps we asked them for their account number, we could use that instead.

 

Note that if you assign the same mapping to two different Sessions, the last session to get the mapping will steal it from the previous, leaving the previous session with no mapping at all, and no way* to retrieve it.  Therefore, be careful what you use for mappings.

 

Also note that you can assign more than one Mapping to a Session, so you'll have the possibility of recalling it in multiple ways.  This isn't really necessary, but it's interesting to know nonetheless.

 

uccx-rtr-dual-mapping.png

 

What you don't want to do, is use the Session object as the Mapping ID like you did, because at the time of Session creation, the value of the Session object is null, and now your Session is known as nothing.

 

uccx-script-manual-session-null.png

uccx-rtr-manual-session-null.png

 

Notice how the Mapping ID is blank.  You might not think that's all that bad.  But consider this: If you took in a second call, while that first Session was still active/idle, then when you create the new Session again, with null as your Mapping ID, the second call will overwrite the first call's Session data.

 

uccx-script-manual-session-null-two-calls.png

 

This actually saved you in your test.  See, in your first script, you created a new Session with null mapping, and then in your second script you did it again, but unknowingly using null as the mapping, causing it to retrieve the original Session.  This is one reason why you should test some of your scripts under load, and not just with a single call.

 

3) Your use of the Set step, to set the sessionCustomerInfo to its own self, is unnecessary.

 

*I said there was no way to retrieve a session once you steal its mapping, but actually, if you understood everything I said so far, then you could retrieve it by using a null mapping.

 

I hope you find my reply helpful.  Let me know if you have any questions.

This is a very good explanation of something that I have used in the past and don't have a better reference of why it works the way that it does. Very interesting concept of how 'null' results and works unexpectedly. I will re-test this in my lab and kick-the-tires a bit more. Thank you for taking the time to explain this.

Thanks Anthony, you rock!

Woah, I'm just seeing this comment today.  Thanks so much for the compliment! 

Anthony, I can't thank you enough for this thorough explanation. I was also a victim of the bad information given on that YouTube video you referenced, which cost me hours of time trying to figure out where I was going wrong. Your post put me on the right track and gave me a better understanding of how sessions work as a whole. 

James, thank you for taking the time to respond and mark the post as helpful. It's really awesome to see just how far the ripples in time travel, when I post something online, and continue to help people long into the future. Take care!

jijeshkt
Level 1
Level 1

Hi Team,

We have requirement to receive existing case incident number from the caller and that need to be validated in the service now.

for an instance please consider our incident number is INC0000325 but user will give only numeric value alone from the incident number.  After getting the input from the user we need to add INC and then whole digits need to be validated in service now application.