Martin Rudack
Giga Sage

bannerklein.jpg

 

While setting up my first AI Voice Agent I ran into a problem which forced me to open a support case. Normally you would think that this is something bad but in retrospect I would say I am glad that I ran into this problem because this forced me to dig deeper into technology and gave me a better understanding of it.

Initially I planned to write an article on how to configure an AI Voice Agent, but this is already well documented in the docs, so I decided to write about the problem I ran into and the troubleshooting process. This provides more value than repeating the docs.

 

 

On a high level, what do you need to configure?

Create an AI Voice Assistant: The Voice Assistant is where you configure the basic stuff like language settings, authentication methods, voice personality and the telephony provider. This is also the place where you add the AI Agents which can be used by this Voice Assistant. You can find this in the docs here: https://www.servicenow.com/docs/bundle/zurich-intelligent-experiences/page/administer/now-assist-ai-...

 

Create one or more AI Voice Agents: These are AI Agents from type Voice and can be created in the AI Agent Studio just like do it with chat AI Agents. See docs: https://www.servicenow.com/docs/bundle/zurich-intelligent-experiences/page/administer/now-assist-ai-...

 

Integration with a CCaaS Provider:

Once you have an AI Voice Assistant with one more AI Voice Agents configured the last step is to configure a webhook URL within your telephony provider.

And that’s where I ran into a problem because the needed URL should be provided on the Telephony Provider tab on the Voice Assistant configuration. But for me the URL was just a “-“.

 

missiing url.png

 

According to the docs, I have done everything correctly. This is where the fun began.

 

Let’s start troubleshooting.

Step 1 – Where is the provider URL generated?

According to the URL of the current page, we are in the Conversational Studio Experience. But there is a surprise waiting for you when you open the Conversational Studio Experience in UI Builder. The Experience consists only of one page and that is a 404 page.

 

conversational studio.png

 

When you open this page anyway you will see that there is only one component on the page, the Conversational Studio Main Appshell. This does not help.

So back to the Assistant Designer. When inspecting the source of the page you see that the page contains a iframe loding a page from the Now Assist with VA Experience.

 

untersuchen tele.png

 

Back in the UI Builder we see that the Now Assist with VA Experience contains the Telephony Provider page.

 

Part of this page is the Generate provider url data resource. This transform data resource is the place where the URL is generated. A transform data resource is basically just a server-side script. If we follow the script includes, we find the code where the URL is generated.

 

telephony uib.png

 

Now we know what the URL should be.

https://aivoiceservice-prod-main-amer.sncapps.service-now.com/twilio/voice/agent_operator?instance_n...>

 

Step 2 Test the correct URL

I still don’t know exactly why the URL is not available in the UI, but I know the correct URL and can test it. Entering the URL as webhook when a call comes in is everything there is to do on Twilio side.

 

twilio.png

 

Calling the number…

 

Connection gets established…

 

Waiting to hear something…

 

4 seconds later the connection gets terminated.

 

When troubleshooting a process, it is always good to know what is happening in the background.

On a high level, when calling my Twilio number, Twilio will call the URL of the AI Voice Service that is running in a ServiceNow Compute Hub. This is the place where the Voice Orchestrator lives and all the voice2text and text2voice is happening. The Voice Orchestrator will use the AI Voice REST API of the ServiceNow instance to fetch the meta data of the Voice Agent so that it can decide which agent and tool to execute on the instance.

 

Step 3 Check Twilio logs

 

twilio log.png

 

The Twilio logs indicate that the connection from Twilio to the AI Voice Service was successful. But then the WebSocket was closed. That’s everything there is on the Twilio side.

 

Step 4 Check transaction logs.

Because we don’t have access to the AI Voice Service next step is to check whether we can find any communication on the ServiceNow instance.

 

transactions.png

 

Starting with the transaction logs we see that the AI voice agent REST API was invoked by the AI Voice Orchestrator.

These calls are to fetch the voice system config, the agent meta data, and to start a conversation.

In addition to that there is also a error message in the system log:

Logs: *** Script: Error in AI Voice Agent conversation Rest API: "Request signature validation failed"

 

Step 5 debug AI Voice REST API

While stepping through the Create Conversation REST API, I was able to locate the error.

When creating a conversation, the system loads the configuration of the Voice Assistant and does some checks. This also includes the provider URL configured in ServiceNow. Because this is still “-“, the verification fails, no conversation is created and the phone call gets terminated.

 

In the meantime, I created a support case for my problem. ServiceNow Support confirmed that already a problem exists for the missing provider URL and that it should be fixed in the next release. They also provided a workaround. If you run into the same problem, see the workaround at the end of this article.

After applying the workaround, I was able to see the correct URL in the Assistant Designer for my Voice Assistant I created before. But it was still not working. That’s because the URL is generated when the UI gets loaded. The URL is not loaded from the configuration. Therefore, you need to change an attribute so that you can save the Assistant again or manually change the Now Assist Deployment Config Attribute [sys_now_assist_deployment_config_attributes] with the name provider_url.

 

After this small correction, everything was working fine. If you want to see a short demo video you can find it here: https://www.linkedin.com/posts/martin-rudack-4b4baa186_servicenow-ai-voiceagent-activity-74166623477...

 

Workaround: 

update the _getServiceEndpointUrl function in the VoiceServiceConfigurationSNC script include to this:

_getServiceEndpointUrl: function(serviceId) {
    const url = sn_one_extend.GenerativeAIUtility.getServiceRecordURL(serviceId);
    if (!url || !url.trim()) {
        gs.error(gs.getMessage('VoiceServiceConfigurationSNC: Invalid URL for service endpoint: {0}', [serviceId]));
        return null;
    }
    const urlWithoutProtocol = url.includes('//') ? url.split('//')[1] : url;
    return urlWithoutProtocol;
},

 

 

 

8 Comments
Luis Rosado2
ServiceNow Employee

Thank you for the article Martin. It was super helpful! in my case, I had already done almost everything but was lacking the "manually change the Now Assist Deployment Config Attribute [sys_now_assist_deployment_config_attributes] with the name provider_url." step. 

 

Thanks!!

Pallabi Mitra1
Tera Contributor

Hi,

Thanks for the detailed process and error handling and work around. But I am facing the same issue. I have updated everything as mentioned in the post including config but in the log I am getting the below error:

*** Script: Error in AI Voice Agent conversation Rest API: "Internal Error: Auth token retrieval failed for app: ServiceNowAIVoiceAgent."

Also, I have trial account in Twilio.

Regards,

Pallabi Mitra

Martin Rudack
Giga Sage

And you picked the Auth Token from the Twilio Account Dashboard and provided it correctly as Authentication Token for your Voice Agent? 

Pallabi Mitra1
Tera Contributor

Hi,

Yes I did.
Below is the log from Twilio:

PallabiMitra1_0-1771554155794.png

The call is getting disconnected after sometime

 

Pallabi Mitra1
Tera Contributor

Hi,

It is resolved. But now, the user authentication is failing. I have added my phone number and softpin. AI agent is asking for my phone number and softpin but it is unable to recognize my user record. 

Regards,

Pallabi Mitra

User687957
Tera Contributor

hello @Pallabi Mitra1 , I am in same situation as you now.
I have define my pet name as a caller identification and a Pin code for double auth, but it cannot recognise it when I enter it.
Did you manage to get it to work ?

regards

eluc
Tera Explorer

@User687957 

Don't use petname, it won't work because the field must be numeric only. I'd suggest using zip_code instead, since that field already exists on sys_user and is purely numeric, making it a safe test value.

The example ServiceNow provides uses business phone, and they likely have some parsing logic to normalize the format. The problem is that the phone number coming in from Twilio may be in a different format (e.g., +12815550100 vs (281) 555-0100), which is probably why it fails to match.

User687957
Tera Contributor

hello @eluc , during the time if your answer I change it to business phone number same as in the serviceNow exemple and thats ok now but I face now to a wierd issue using Twilio provider and Assistant Designer Authentication . I am stuck days now to pass the MFA layer without any success.

I hope you can help or give me a clue.

My current configuration is as below now :

AwirWGs0lf.png

 

Bass on this configuration, I have enrol a SoftPin from Authentication Factors -> SoftPin ->Enrol and define one.

 

Here is what is happening :

  1. A call is made to Twilio number which then reads the welcome message from the configuration
  2. The agent ask for my phone numer
  3. I then enter the phone numer based on caller Id identification and it pass succesfully
  4. Then it ask for the SoftPin code as defined in the caller authentication
  5. Then I enter the SoftPin that I have enroll with my mobile keypad
  6. Then it says that it did not work and I am sure a 100% of what I type in

Note : I have even try to switch as primary method for Auth to use the Auth App but same thing

As a conclusion, whatever I select for caller Authentication, the MFA failed all time

 

MFA works fine if I am login in to the platform using Auth App.

What I am suspecting is that MFA for web site authentication are mapped to a user session profile to make it work, but then when using with Twilio, not sure if that session is really build based on the caller identification process.

 

So I am honestly gets stuck here to pass the MFA through Twilio provider. After contacting Twilio support the issue is not in their ends because their are just routing and not blocking any authentication method.

 

How to solve this caller Authentication with twilio provider ?

Does the MFA is really supported ?

 

Thanks for your help in what should be done

 

Regards