Thursday, March 6, 2014

SIP UUI Integration with Genesys Routing

Summary

This is the third in a series of articles I've written on integrating Genesys with SIP UUI.  Part 1 discussed the development of a UUI parsing web service.  Part 2 discussed how to invoke that web service from a Genesys routing strategy developed with IRD.  This last article will bring all the concepts together with an end-to-end example of extracting and depositing data to/from the UUI header with a Genesys routing strategy.

Environmentals

I'm using a Cisco router along with Genesys SIP Server (SIPS) for the SIP traffic.  In this previous article, I discussed the Cisco IOS VoIP trust list configuration necessary to integrate a Cisco router and Genesys SIPS.

In addition to the trust list, I'm going to need to do some hacking on the router to simulate a carrier bringing SIP UUI to Genesys via an IP trunk.  To do this, I'll utilize the Session Border Controller process on the router, aka Cisco Unified Border Element (CUBE).  Specifically, I need to artificially insert the 'User-to-User' header into the SIP INVITE sent to Genesys SIPS.

SIP headers can be modified easily in CUBE using sip-profile commands.  Unfortunately, the headers available for modification don't include the one I need - 'User-to-User'.  I suppose the reason for that is UUI isn't a standard, as of yet.  However, with some simple configuration we can hijack one of the headers that is supported by CUBE to get the UUI header inserted.  Below is the configuration to do just that with the Warning header.  The command below replaces the Warning header with a UUI-formatted data item.

voice class sip-profiles 300
 request INVITE sip-header Warning add "User-to-User:656e676c697368;encoding=hex"


Additionally, I had to add this profile to the dial-peer I'll use as the Genesys route point (5000).  That configuration is below.  The 'session target' is the IP address of Genesys SIPS.


dial-peer voice 30 voip

 destination-pattern 5000

 session protocol sipv2

 session target ipv4:192.168.1.69

 voice-class sip profiles 300

 codec g711ulaw



On the Genesys side, I made modifications to the SIPS application object to cause it to intercept the SIP 'User-to-User' header and insert it into the Genesys TLib message stream.  Figures 1 and 2 below depict the modifications I made to enable this SIP to TLib mapping.

Figure 1

Figure 2

Routing Strategy

Figure 3 is the routing strategy I used for this testing.  It is highly contrived (low to no production reality) and rigged to exercise the full Genesys SIP UUI functionality in a minimum of steps.

  1. Figure 4 is the Assign object used to assign the 'User-to-User' data item to script local variable.  The 'User-to-User' item was set via SIPS extracting that header item from the INVITE (SIP to TLib).
  2. I then call the Decoder web service to convert the hex-encoded data from the header to ASCII.
  3. A script List object is used to extract the first item from the resulting array returned by the web service object and assign it to a local variable.  The original 'User-to-User' item is also detached from the call.
  4. The Attach object then attaches that variable to the call (Figure 5).
  5. The next Web Service object (Figure 6) sets up a TLib to SIP mapping.  I'm hex encoding the string 'gold' and then assigning the result to the local array variable named 'callTypeList' (Figure 7).
  6. In Figure 8, three different function calls are being made.  The first establishes a 'User-to-User' header for the outgoing SIP INVITE.  This is the actual TLib to SIP mapping function.  The second function extracts the first value from the encode web service result array to a local variable.  The third function assigns the value of that local variable to that newly established  'User-to-User' header item.
  7. Finally, I route segment the call to a target that has a skill match with the initial UUI item.  That item was a language skill selection ('english' in this example).  Figure 9

Figure 3
Figure 4

Figure 5
Figure 6
Figure 7
Figure 8
Figure 9

Execution

Below are excerpts of the various logs during the strategy execution.

Cisco Router Log: 

UUI header has been inserted into the INVITE destined for Genesys SIPS.

INVITE sip:5000@192.168.1.69:5060 SIP/2.0
Via: SIP/2.0/UDP 10.10.10.1:5060;branch=z9hG4bK1144B
Remote-Party-ID: <sip:1234567890@10.10.10.1>;party=calling;screen=no;privacy=off
From: <sip:1234567890@10.10.10.1>;tag=A011F674-1EF9
To: <sip:5000@192.168.1.69>
Date: Thu, 06 Mar 2014 21:35:38 GMT
Call-ID: 1849BDBB-A4AE11E3-9987FE55-4FA7E03F@10.10.10.1
Supported: 100rel,timer,resource-priority,replaces,sdp-anat
Min-SE:  1800
Cisco-Guid: 0378126320-2762871267-2575498837-1336401983
User-Agent: Cisco-SIPGateway/IOS-15.2.4.M1
Allow: INVITE, OPTIONS, BYE, CANCEL, ACK, PRACK, UPDATE, REFER, SUBSCRIBE, NOTIFY, INFO, REGISTER
CSeq: 101 INVITE
Max-Forwards: 70
Timestamp: 1394141739
Contact: <sip:1234567890@10.10.10.1:5060>
Expires: 180
Allow-Events: telephone-event
Content-Type: application/sdp
Content-Disposition: session;handling=required
Content-Length: 209
User-to-User:656e676c697368;encoding=hex


SIPS Log:

SIPS receives the INVITE with the UUI header intact.


14:35:39.006: SIPTR: Received [0,UDP] 1131 bytes from 10.10.10.1:58029 <<<<<

INVITE sip:5000@192.168.1.69:5060 SIP/2.0^M

Via: SIP/2.0/UDP 10.10.10.1:5060;branch=z9hG4bK1144B^M

Remote-Party-ID: <sip:1234567890@10.10.10.1>;party=calling;screen=no;privacy=off^M

From: <sip:1234567890@10.10.10.1>;tag=A011F674-1EF9^M

To: <sip:5000@192.168.1.69>^M

Date: Thu, 06 Mar 2014 21:35:38 GMT^M

Call-ID: 1849BDBB-A4AE11E3-9987FE55-4FA7E03F@10.10.10.1^M

Supported: 100rel,timer,resource-priority,replaces,sdp-anat^M
Min-SE:  1800^M
Cisco-Guid: 0378126320-2762871267-2575498837-1336401983^M
User-Agent: Cisco-SIPGateway/IOS-15.2.4.M1^M
Allow: INVITE, OPTIONS, BYE, CANCEL, ACK, PRACK, UPDATE, REFER, SUBSCRIBE, NOTIFY, INFO, REGISTER^M
CSeq: 101 INVITE^M
Max-Forwards: 70^M
Timestamp: 1394141739^M
Contact: <sip:1234567890@10.10.10.1:5060>^M
Expires: 180^M
Allow-Events: telephone-event^M
Content-Type: application/sdp^M
Content-Disposition: session;handling=required^M
Content-Length: 209^M
User-to-User:656e676c697368;encoding=hex^M


URS Log:  

URS receives UUI data in hex format (SIP to TLib mapping).

14:35:39.009_I_I_0005024010bd6075 [01:01] call (2-981e1d0) for Resources created (del 1)
    _T_I_0005024010bd6075 [14:09] add DN TServer_SIPS810 5000 <5000@sips> (CDN 57 0005024010bd6075 97eb5b8) to the call 2-981e1d0 truly:22
received from 65200(TServer_SIPS810)genesys:7070(fd=) message EventRouteRequest
        AttributeCallState      0
        AttributeCallType       2
        AttributePropagatedCallType     2
        AttributeCallID 120
        AttributeConnID 0005024010bd6075
        AttributeCallUUID       '02ACMQ3C6S9GF9CM04000VTAES00003O'
        AttributeUserData       [46] 00 01 00 00..

                'User-to-User'  '656e676c697368;encoding=hex'



URS executes web service call to decode the hex to ASCII.

14:35:39.009_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:656e676c697368;encoding=hex
        Output:     decodeResponse.return
        HTTPAuthent:1
        SOAPSecrty:
14:35:39.009_I_I_0005024010bd6075 [09:04] <<<<<<<<<<<<suspend interp(WAIT_WEBSERVICE), func:GetWebServiceInfoEx timers:00000
14:35:39.015_H_I_0005024010bd6075 [08:08] OK InfoMessage (-1) is received from server ##HTTPSERVER, refid=2, hint=soap
  key V1 [List] value: (size=20)
    key STRN [String] value: "english"





URS assigns the ASCII value of the UUI item to a local variable and deletes the existing User-to-User item from the call.


14:35:39.015_I_I_0005024010bd6075 [09:05] >>>>>>>>>>>>resume interp(0), func:GetWebServiceInfoEx
    _I_I_0005024010bd6075 [09:04] ASSIGN: __WEBReturn(SCRIPT) <- LIST: V1.STRN:english
    _I_I_0005024010bd6075 [09:04] ASSIGN: languageList(SCRIPT) <- STRING: "1:english"
    _I_I_0005024010bd6075 [09:04] ASSIGN: language(SCRIPT) <- STRING: "english"
request to 65200(TServer_SIPS810) message RequestDeletePair
        AttributeReferenceID    14
        AttributeDataKey        'User-to-User'
        AttributeConnID 0005024010bd6075
        AttributeThisDN '5000'


URS creates/attaches key-value pair to the call.


request to 65200(TServer_SIPS810) message RequestAttachUserData
        AttributeReferenceID    15
        AttributeUserData       [22] 00 01 00 00..
                'LANGUAGE'      'english'
        AttributeConnID 0005024010bd6075
        AttributeThisDN '5000'


URS makes a second web service call to UUI format the string 'gold'.


14:35:39.015_H_I_ [08:0c] SOAP request 3 sent to HTTP Bridge:
        URL:        http://192.168.1.75:8080/sipuui/services/UUITranscoder.UUITranscoderHttpSoap11Endpoint
        Method:     ns:encode
        NameSpace:  ns=http://sipuui
        SOAPaction: urn:encode
        Input:      ns:values:gold
        Output:     encodeResponse.return
        HTTPAuthent:1
        SOAPSecrty:


URS assigns the result of the web service call to a local variable (callType).


14:35:39.018_H_I_0005024010bd6075 [08:08] OK InfoMessage (-1) is received from server ##HTTPSERVER, refid=3, hint=soap
  key V1 [List] value: (size=34)
    key STRN [String] value: "676f6c64;encoding=hex"
14:35:39.018_I_I_0005024010bd6075 [09:05] >>>>>>>>>>>>resume interp(0), func:GetWebServiceInfoEx
    _I_I_0005024010bd6075 [09:04] ASSIGN: __WEBReturn(SCRIPT) <- LIST: V1.STRN:676f6c64;encoding=hex
    _I_I_0005024010bd6075 [09:04] ASSIGN: callTypeList(SCRIPT) <- STRING: "1:676f6c64;encoding=hex"
    _I_I_0005024010bd6075 [09:04] ASSIGN: callType(SCRIPT) <- STRING: "676f6c64;encoding=hex"



URS targets Agent 1001 for the call.  Agent 1001 has a skill of 'english' with level > 1.  New User-to-User item is added to TLib Extensions.


14:35:39.019_T_I_0005024010bd6075 [14:19] send to ts TServer_SIPS810 RequestRouteCall to dn 1001 on  (dnis= )
request to 65200(TServer_SIPS810) message RequestRouteCall
        AttributeReferenceID    19
        AttributeReason [14] 00 01 01 00..
                'RTR'   132
        AttributeRouteType      0 (RouteTypeUnknown)
        AttributeExtensions     [230] 00 0a 00 00..
                'SIP_HEADERS'   'User-to-User'
                'User-to-User'  '676f6c64;encoding=hex'
                'CUSTOMER_ID'   'Resources'
                'AGENT' 'Employee_ID_1001'
                'PLACE' 'Place_1001'
                'DN'    '1001'
                'ACCESS'        '1001'
                'SWITCH'        'sips'
                'NVQ'   1
                'TARGET'        '?:english > 1@statserver.GA'
        AttributeOtherDN        '1001'
        AttributeConnID 0005024010bd6075
        AttributeThisDN '5000'



SIPS Log:  INVITE is sent to Agent 1001's endpoint.  New User-to-User item added to header (TLib to SIP mapping).


14:35:39.096: Sending  [0,UDP] 1306 bytes to 192.168.1.70:8440 >>>>>
INVITE sip:1001@192.168.1.70:8440;rinstance=eb8de7f330f64bc8 SIP/2.0^M
From: sip:1234567890@10.10.10.1;tag=0090D300-6C37-1307-A596-0100007FAA77-19268^M
To: <sip:5000@192.168.1.69:5060>^M
Call-ID: 0090D2D8-6C37-1307-A596-0100007FAA77-19132@192.168.1.69^M
CSeq: 1 INVITE^M
Content-Length: 212^M
Content-Type: application/sdp^M
Via: SIP/2.0/UDP 192.168.1.69:5060;branch=z9hG4bK0090D314-6C37-1307-A596-0100007FAA77-188^M
Contact: <sip:1234567890@192.168.1.69:5060>^M
X-Genesys-CallInfo: routed^M
User-to-User: 676f6c64;encoding=hex^M
Allow: ACK, BYE, CANCEL, INFO, INVITE, MESSAGE, NOTIFY, OPTIONS, PRACK, REFER, UPDATE^M
Remote-Party-ID: <sip:1234567890@10.10.10.1>;party=calling;screen=no;privacy=off^M
Date: Thu, 06 Mar 2014 21:35:38 GMT^M
Cisco-Guid: 0378126320-2762871267-2575498837-1336401983^M
User-Agent: Cisco-SIPGateway/IOS-15.2.4.M1^M


Support Phone Log:  Call arrives with the LANGUAGE attached data.
Figure 10

Copyright ©1993-2024 Joey E Whelan, All rights reserved.