PureEngage On-Premises

 View Only

Sign Up

  • 1.  how to convert call UCID from hexadecimal to decimal

    Posted 04-04-2016 09:29
    Hello,

    We are using Avaya switch with TServer Genesys 8.1. We would like to know if there is a way to convert the call UCID from hexadecimal to decimal, with URS strategy and/or config options?
    Eles, we will implement a Web Service.
    Thank you in advance for your help;

    Best regards


  • 2.  RE: how to convert call UCID from hexadecimal to decimal

    Posted 04-07-2016 20:09

    The UCID is in the SIP User-to-User header and is indicated by the FA08 code in the Hex.  So first set a variable using the following:

    <var name="U2U" expr="session.connection.protocol.sip.headers['user-to-user']"/>

    The actual UCID is comprised of three different sections.  The following Javascript will parse those out and reassemble into the decimal version of the UCID:

    function parseUCID(u2u) {
         
        var parseUCIDfromU2U = u2u.split(/FA\d{2}/);
        var UCID = parseUCIDfromU2U[1];    
        var hexChars = u2u.match(/FA(\d{2})/);
        hexChars[1] /= 2;
     
        var ucid1 = UCID.substr(0,(hexChars[1]));
        var ucid2 = UCID.substr(hexChars[1],hexChars[1]);
        var ucid3 = UCID.substr((hexChars[1]*2),(hexChars[1]*2));
             
        ucid1 = parseInt(ucid1,16);
        ucid2 = parseInt(ucid2,16);
        ucid3 = parseInt(ucid3,16);
         
        ucid1 = prependZeros(ucid1,5);
        ucid2 = prependZeros(ucid2,5);
        ucid3 = prependZeros(ucid3,10);
                 
        return "" + ucid1 + ucid2 + ucid3;
    }