Wednesday, March 5, 2014

Genesys Routing Integration with Web Services

Summary

This is a continuation of my previous article on SIP UUI header decoding.  In this article, I'll be demonstrating how to call that web service directly from a Genesys routing strategy developed in Interaction Routing Designer (IRD).

Environmentals

Genesys Universal Router Server (URS) has provided a two-way web interface (HTTP Bridge) for several years.  To enable the interface and its logging, you need to add a 'web' section to the Options configuration for the URS object.  Figures 1 and 2 below depict the Options configuration I used.

Figure 1
Figure 2
Side Note:  You must configure the 'http_port' option to enable URS to connect to external web servers.  That option opens a server socket on the server where URS resides.  I can't make sense of the logic behind a mandate to open a server socket on URS just to enable client sockets, but it is what it is.

Routing Strategy

Figure 3 depicts a toy routing strategy written with IRD.  The strategy demonstrates the basics of calling a web service.  I execute the following logic in this strategy:

  1. I configured a Web Service object to make a call to the UUI header 'decode' web service I developed and described here.  Filling in the required info for the General Tab (Figure 4) is accomplished easiest by simply importing the WSDL for your target web service.  Here I'm setting up the hex value of 3836372d35333039;encoding=hex as the input parameter for the web service call.  Figure 5 depicts the Result tab, which corresponds to the output.
  2. I use the Function object (Figure 6) to assign the web service result to a local variable.  Genesys URS assumes all web service results are arrays, so I'm using the List function to assign the first value of that array (phoneNumList) to a local variable (phoneNum).
  3. I use Multi-Attach object to attach the variable to the call (Figure 7).
  4. Finally, URS routes the call to a skill target.


Figure 3

Figure 4

Figure 5

Figure 6

Figure 7
Execution

Below are some log excerpts showing the events that unfold when this strategy was executed.  I placed a test call to DN 4000 where I had this strategy loaded.  The TServer was Genesys SIP Server. The agent environment was the X-Lite endpoint and Genesys Support Phone.

URS Log:

received from 65200(TServer_SIPS810)genesys:7070(fd=) message EventRouteRequest
        AttributeCallState      0
        AttributeCallType       2
        AttributePropagatedCallType     2
        AttributeCallID 116
        AttributeConnID 0005024010bd6071
        AttributeCallUUID       '02ACMQ3C6S9GF9CM04000VTAES00003K'
        AttributeDNIS   '4000'
        AttributeANI    '1111111111'
        AttributeThisDN '4000'
...
11:32:10.231_H_I_ [08:0c] SOAP request 2 sent to HTTP Bridge:
        URL:        http://192.168.1.75:8080/sipuui/services/UUITranscoder.UUITranscoderHttpSoap11Endpoint
        Method:     ns:decode
        NameSpace:  ns=http://sipuui
        SOAPaction: urn:decode
        Input:      ns:header:3836372d35333039;encoding=hex
        Output:     decodeResponse.return
        HTTPAuthent:1
        SOAPSecrty:
11:32:10.231_I_I_0005024010bd6071 [09:04] <<<<<<<<<<<<suspend interp(WAIT_WEBSERVICE), func:GetWebServiceInfoEx timers:00000
11:32:10.236_H_I_0005024010bd6071 [08:08] OK InfoMessage (-1) is received from server ##HTTPSERVER, refid=2, hint=soap
  key V1 [List] value: (size=21)
    key STRN [String] value: "867-5309"
11:32:10.236_I_I_0005024010bd6071 [09:05] >>>>>>>>>>>>resume interp(0), func:GetWebServiceInfoEx
    _I_I_0005024010bd6071 [09:04] ASSIGN: __WEBReturn(SCRIPT) <- LIST: V1.STRN:867-5309
    _I_I_0005024010bd6071 [09:04] ASSIGN: phoneNumList(SCRIPT) <- STRING: "1:867-5309"
    _I_I_0005024010bd6071 [09:04] ASSIGN: phoneNum(SCRIPT) <- STRING: "867-5309"
request to 65200(TServer_SIPS810) message RequestAttachUserData
        AttributeReferenceID    14
        AttributeUserData       [28] 00 01 00 00..
                'Jennys_Number' '867-5309'
        AttributeConnID 0005024010bd6071
        AttributeThisDN '4000'


HTTP Bridge Log:

03/04/14@11:32:10: [HTTP Client 85d32f4] Request sent:
POST /sipuui/services/UUITranscoder.UUITranscoderHttpSoap11Endpoint HTTP/1.1
Host: 192.168.1.75:8080
User-Agent: gSOAP/2.7
Content-Type: text/xml; charset=utf-8
Content-Length: 493
Connection: keep-alive
SOAPAction: "urn:decode"

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns="http://sipuui"><SOAP-ENV:Body SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><ns:decode><ns:header>3836372d35333039;encoding=hex</ns:header></ns:decode></SOAP-ENV:Body></SOAP-ENV:Envelope>
03/04/14@11:32:10: [HTTP Client 85d32f4] Received 418 bytes from server on socket 9:
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Content-Type: text/xml;charset=utf-8
Transfer-Encoding: chunked
Date: Tue, 04 Mar 2014 18:32:10 GMT

101
<?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><ns:decodeResponse xmlns:ns="http://sipuui"><ns:return>867-5309</ns:return></ns:decodeResponse></soapenv:Body></soapenv:Envelope>


Troubleshooting Tip:

If you're confident you've configured things properly but are still having issues with web service calls from the strategy - check your URS and HTTP Bridge logs.  If you notice the message below in your URS log and the HTTP Bridge log is clean - you're likely encountering a Genesys bug.  I had URS 8.1.2 loaded when I was getting these errors.  I upgraded to 8.1.3 and this error magically disappeared.

09:23:18.115 Int 22000 Web Service Access Error