sipcapture / homer-app

HOMER 7.x Front-End and API Server
http://sipcapture.io
GNU Affero General Public License v3.0
207 stars 85 forks source link

B-Leg Call-Id is md5 hash of A-Leg Call-ID - How to Map? #352

Closed flantel closed 4 years ago

flantel commented 4 years ago

Hi

Our B2BUA sets the B-Leg call-id to the md5 sum of the A-Leg. What is the easiest way to set up this mapping? Sorry, completely unfamiliar with how this works!

lmangani commented 4 years ago

Hello @flantel

The input_function_js field allows you to pipe the original through a custom function.

Let's take this huge md5 function as example:

var md5 = function(d){var r = M(V(Y(X(d),8*d.length)));return r.toLowerCase()};function M(d){for(var _,m="0123456789ABCDEF",f="",r=0;r<d.length;r++)_=d.charCodeAt(r),f+=m.charAt(_>>>4&15)+m.charAt(15&_);return f}function X(d){for(var _=Array(d.length>>2),m=0;m<_.length;m++)_[m]=0;for(m=0;m<8*d.length;m+=8)_[m>>5]|=(255&d.charCodeAt(m/8))<<m%32;return _}function V(d){for(var _="",m=0;m<32*d.length;m+=8)_+=String.fromCharCode(d[m>>5]>>>m%32&255);return _}function Y(d,_){d[_>>5]|=128<<_%32,d[14+(_+64>>>9<<4)]=_;for(var m=1732584193,f=-271733879,r=-1732584194,i=271733878,n=0;n<d.length;n+=16){var h=m,t=f,g=r,e=i;f=md5_ii(f=md5_ii(f=md5_ii(f=md5_ii(f=md5_hh(f=md5_hh(f=md5_hh(f=md5_hh(f=md5_gg(f=md5_gg(f=md5_gg(f=md5_gg(f=md5_ff(f=md5_ff(f=md5_ff(f=md5_ff(f,r=md5_ff(r,i=md5_ff(i,m=md5_ff(m,f,r,i,d[n+0],7,-680876936),f,r,d[n+1],12,-389564586),m,f,d[n+2],17,606105819),i,m,d[n+3],22,-1044525330),r=md5_ff(r,i=md5_ff(i,m=md5_ff(m,f,r,i,d[n+4],7,-176418897),f,r,d[n+5],12,1200080426),m,f,d[n+6],17,-1473231341),i,m,d[n+7],22,-45705983),r=md5_ff(r,i=md5_ff(i,m=md5_ff(m,f,r,i,d[n+8],7,1770035416),f,r,d[n+9],12,-1958414417),m,f,d[n+10],17,-42063),i,m,d[n+11],22,-1990404162),r=md5_ff(r,i=md5_ff(i,m=md5_ff(m,f,r,i,d[n+12],7,1804603682),f,r,d[n+13],12,-40341101),m,f,d[n+14],17,-1502002290),i,m,d[n+15],22,1236535329),r=md5_gg(r,i=md5_gg(i,m=md5_gg(m,f,r,i,d[n+1],5,-165796510),f,r,d[n+6],9,-1069501632),m,f,d[n+11],14,643717713),i,m,d[n+0],20,-373897302),r=md5_gg(r,i=md5_gg(i,m=md5_gg(m,f,r,i,d[n+5],5,-701558691),f,r,d[n+10],9,38016083),m,f,d[n+15],14,-660478335),i,m,d[n+4],20,-405537848),r=md5_gg(r,i=md5_gg(i,m=md5_gg(m,f,r,i,d[n+9],5,568446438),f,r,d[n+14],9,-1019803690),m,f,d[n+3],14,-187363961),i,m,d[n+8],20,1163531501),r=md5_gg(r,i=md5_gg(i,m=md5_gg(m,f,r,i,d[n+13],5,-1444681467),f,r,d[n+2],9,-51403784),m,f,d[n+7],14,1735328473),i,m,d[n+12],20,-1926607734),r=md5_hh(r,i=md5_hh(i,m=md5_hh(m,f,r,i,d[n+5],4,-378558),f,r,d[n+8],11,-2022574463),m,f,d[n+11],16,1839030562),i,m,d[n+14],23,-35309556),r=md5_hh(r,i=md5_hh(i,m=md5_hh(m,f,r,i,d[n+1],4,-1530992060),f,r,d[n+4],11,1272893353),m,f,d[n+7],16,-155497632),i,m,d[n+10],23,-1094730640),r=md5_hh(r,i=md5_hh(i,m=md5_hh(m,f,r,i,d[n+13],4,681279174),f,r,d[n+0],11,-358537222),m,f,d[n+3],16,-722521979),i,m,d[n+6],23,76029189),r=md5_hh(r,i=md5_hh(i,m=md5_hh(m,f,r,i,d[n+9],4,-640364487),f,r,d[n+12],11,-421815835),m,f,d[n+15],16,530742520),i,m,d[n+2],23,-995338651),r=md5_ii(r,i=md5_ii(i,m=md5_ii(m,f,r,i,d[n+0],6,-198630844),f,r,d[n+7],10,1126891415),m,f,d[n+14],15,-1416354905),i,m,d[n+5],21,-57434055),r=md5_ii(r,i=md5_ii(i,m=md5_ii(m,f,r,i,d[n+12],6,1700485571),f,r,d[n+3],10,-1894986606),m,f,d[n+10],15,-1051523),i,m,d[n+1],21,-2054922799),r=md5_ii(r,i=md5_ii(i,m=md5_ii(m,f,r,i,d[n+8],6,1873313359),f,r,d[n+15],10,-30611744),m,f,d[n+6],15,-1560198380),i,m,d[n+13],21,1309151649),r=md5_ii(r,i=md5_ii(i,m=md5_ii(m,f,r,i,d[n+4],6,-145523070),f,r,d[n+11],10,-1120210379),m,f,d[n+2],15,718787259),i,m,d[n+9],21,-343485551),m=safe_add(m,h),f=safe_add(f,t),r=safe_add(r,g),i=safe_add(i,e)}return Array(m,f,r,i)}function md5_cmn(d,_,m,f,r,i){return safe_add(bit_rol(safe_add(safe_add(_,d),safe_add(f,i)),r),m)}function md5_ff(d,_,m,f,r,i,n){return md5_cmn(_&m|~_&f,d,_,r,i,n)}function md5_gg(d,_,m,f,r,i,n){return md5_cmn(_&f|m&~f,d,_,r,i,n)}function md5_hh(d,_,m,f,r,i,n){return md5_cmn(_^m^f,d,_,r,i,n)}function md5_ii(d,_,m,f,r,i,n){return md5_cmn(m^(_|~f),d,_,r,i,n)}function safe_add(d,_){var m=(65535&d)+(65535&_);return(d>>16)+(_>>16)+(m>>16)<<16|65535&m}function bit_rol(d,_){return d<<_|d>>>32-_}

function tinymd5(str, length) {
    length = length || 16;
    str = window.btoa(md5(str)).replace(/[aiueoAIUEO\+\/]/g, '').substring(0, length);
    if(str.length < length) {
        str += Array(length - str.length).join('=');
    }
    return str;
}

We can take this (or any) function and use it to process data in our field array. Here's an untested example to find SIP Calls (lookup_id: 1) with profile "call" and extracting the Session Call-ID piping through the new md5 function tinymd5(data[i],16):

{
        "source_field": "data_header.callid",
        "lookup_id": 1,
        "lookup_profile": "call",
        "lookup_field": "data_header->>'callid'",
        "lookup_range": [
            -300,
            200
        ],
        "input_function_js": "var md5=function(d){return M(V(Y(X(d),8*d.length))).toLowerCase()};function M(d){for(var _,m="0123456789ABCDEF",f="",n=0;n<d.length;n++)_=d.charCodeAt(n),f+=m.charAt(_>>>4&15)+m.charAt(15&_);return f}function X(d){for(var _=Array(d.length>>2),m=0;m<_.length;m++)_[m]=0;for(m=0;m<8*d.length;m+=8)_[m>>5]|=(255&d.charCodeAt(m/8))<<m%32;return _}function V(d){for(var _="",m=0;m<32*d.length;m+=8)_+=String.fromCharCode(d[m>>5]>>>m%32&255);return _}function Y(d,_){d[_>>5]|=128<<_%32,d[14+(_+64>>>9<<4)]=_;for(var m=1732584193,f=-271733879,n=-1732584194,r=271733878,i=0;i<d.length;i+=16){var h=m,g=f,t=n,e=r;f=md5_ii(f=md5_ii(f=md5_ii(f=md5_ii(f=md5_hh(f=md5_hh(f=md5_hh(f=md5_hh(f=md5_gg(f=md5_gg(f=md5_gg(f=md5_gg(f=md5_ff(f=md5_ff(f=md5_ff(f=md5_ff(f,n=md5_ff(n,r=md5_ff(r,m=md5_ff(m,f,n,r,d[i+0],7,-680876936),f,n,d[i+1],12,-389564586),m,f,d[i+2],17,606105819),r,m,d[i+3],22,-1044525330),n=md5_ff(n,r=md5_ff(r,m=md5_ff(m,f,n,r,d[i+4],7,-176418897),f,n,d[i+5],12,1200080426),m,f,d[i+6],17,-1473231341),r,m,d[i+7],22,-45705983),n=md5_ff(n,r=md5_ff(r,m=md5_ff(m,f,n,r,d[i+8],7,1770035416),f,n,d[i+9],12,-1958414417),m,f,d[i+10],17,-42063),r,m,d[i+11],22,-1990404162),n=md5_ff(n,r=md5_ff(r,m=md5_ff(m,f,n,r,d[i+12],7,1804603682),f,n,d[i+13],12,-40341101),m,f,d[i+14],17,-1502002290),r,m,d[i+15],22,1236535329),n=md5_gg(n,r=md5_gg(r,m=md5_gg(m,f,n,r,d[i+1],5,-165796510),f,n,d[i+6],9,-1069501632),m,f,d[i+11],14,643717713),r,m,d[i+0],20,-373897302),n=md5_gg(n,r=md5_gg(r,m=md5_gg(m,f,n,r,d[i+5],5,-701558691),f,n,d[i+10],9,38016083),m,f,d[i+15],14,-660478335),r,m,d[i+4],20,-405537848),n=md5_gg(n,r=md5_gg(r,m=md5_gg(m,f,n,r,d[i+9],5,568446438),f,n,d[i+14],9,-1019803690),m,f,d[i+3],14,-187363961),r,m,d[i+8],20,1163531501),n=md5_gg(n,r=md5_gg(r,m=md5_gg(m,f,n,r,d[i+13],5,-1444681467),f,n,d[i+2],9,-51403784),m,f,d[i+7],14,1735328473),r,m,d[i+12],20,-1926607734),n=md5_hh(n,r=md5_hh(r,m=md5_hh(m,f,n,r,d[i+5],4,-378558),f,n,d[i+8],11,-2022574463),m,f,d[i+11],16,1839030562),r,m,d[i+14],23,-35309556),n=md5_hh(n,r=md5_hh(r,m=md5_hh(m,f,n,r,d[i+1],4,-1530992060),f,n,d[i+4],11,1272893353),m,f,d[i+7],16,-155497632),r,m,d[i+10],23,-1094730640),n=md5_hh(n,r=md5_hh(r,m=md5_hh(m,f,n,r,d[i+13],4,681279174),f,n,d[i+0],11,-358537222),m,f,d[i+3],16,-722521979),r,m,d[i+6],23,76029189),n=md5_hh(n,r=md5_hh(r,m=md5_hh(m,f,n,r,d[i+9],4,-640364487),f,n,d[i+12],11,-421815835),m,f,d[i+15],16,530742520),r,m,d[i+2],23,-995338651),n=md5_ii(n,r=md5_ii(r,m=md5_ii(m,f,n,r,d[i+0],6,-198630844),f,n,d[i+7],10,1126891415),m,f,d[i+14],15,-1416354905),r,m,d[i+5],21,-57434055),n=md5_ii(n,r=md5_ii(r,m=md5_ii(m,f,n,r,d[i+12],6,1700485571),f,n,d[i+3],10,-1894986606),m,f,d[i+10],15,-1051523),r,m,d[i+1],21,-2054922799),n=md5_ii(n,r=md5_ii(r,m=md5_ii(m,f,n,r,d[i+8],6,1873313359),f,n,d[i+15],10,-30611744),m,f,d[i+6],15,-1560198380),r,m,d[i+13],21,1309151649),n=md5_ii(n,r=md5_ii(r,m=md5_ii(m,f,n,r,d[i+4],6,-145523070),f,n,d[i+11],10,-1120210379),m,f,d[i+2],15,718787259),r,m,d[i+9],21,-343485551),m=safe_add(m,h),f=safe_add(f,g),n=safe_add(n,t),r=safe_add(r,e)}return Array(m,f,n,r)}function md5_cmn(d,_,m,f,n,r){return safe_add(bit_rol(safe_add(safe_add(_,d),safe_add(f,r)),n),m)}function md5_ff(d,_,m,f,n,r,i){return md5_cmn(_&m|~_&f,d,_,n,r,i)}function md5_gg(d,_,m,f,n,r,i){return md5_cmn(_&f|m&~f,d,_,n,r,i)}function md5_hh(d,_,m,f,n,r,i){return md5_cmn(_^m^f,d,_,n,r,i)}function md5_ii(d,_,m,f,n,r,i){return md5_cmn(m^(_|~f),d,_,n,r,i)}function safe_add(d,_){var m=(65535&d)+(65535&_);return(d>>16)+(_>>16)+(m>>16)<<16|65535&m}function bit_rol(d,_){return d<<_|d>>>32-_}function tinymd5(d,_){return _=_||16,(d=window.btoa(md5(d)).replace(/[aiueoAIUEO\+\/]/g,"").substring(0,_)).length<_&&(d+=Array(_-d.length).join("=")),d}; var returnData=[]; for (var i = 0; i < data.length; i++) { returnData.push( 
 tinymd5(data[i],16) ); }; returnData;"
    }

Again this is untested and just to outline the process of adding a complex function, so I'll help here if needed but make sure you paste real examples and console debugs. To check if this works, you can select a session and check the POST parameters to the query.

flantel commented 4 years ago

Thanks @lmangani - do I add this to the existing call lookup id 1 or add it as an additional?

I also cannot find information on how to check the POST parameters - is this available via the webb-app UI? Many thanks.

flantel commented 4 years ago

Hi,

Here are the details of the call: A-leg Call-ID: 673187ceafc579fab78cc84cb1077a3f@0.0.0.0 B-leg Call-ID: ba0b8b9fe0ed43ffeb9a60343d5fa330 (md5sum of A-leg cid)

The POST shows webapp is only searching for the A-Leg cid:

{"param":{"transaction":{"call":true,"registration":false,"rest":false},"limit":200,"search":{"1_call":{"id":45925540,"callid":["673187ceafc579fab78cc84cb1077a3f@0.0.0.0"],"uuid":[]}},"location":{},"timezone":{"value":-180,"name":"Local"}},"timestamp":{"from":1591138501172,"to":1591139001172}}

webapp degug log:

homer-webapp      | {"level":"info","module":"gorm","msg":"SELECT * FROM \"mapping_schema\"  WHERE (hepid = $1 and profile = $2)","time":"2020-06-03T10:13:27Z
","type":"sql"}
homer-webapp      | {"level":"info","module":"gorm","msg":"SELECT * FROM \"alias\"  WHERE (status = true)","time":"2020-06-03T10:13:27Z","type":"sql"}
homer-webapp      | {"level":"info","module":"gorm","msg":"SELECT * FROM \"global_settings\"  ","time":"2020-06-03T10:13:27Z","type":"sql"}
homer-webapp      | {"level":"info","module":"gorm","msg":"SELECT * FROM \"hep_proto_1_call\"  WHERE (sid in ($1) and create_date between $2 and $3)","time":"
2020-06-03T10:13:27Z","type":"sql"}
homer-webapp      | {"level":"debug","msg":"GetTransactionData: Len: 135","time":"2020-06-03T10:13:27Z"}
homer-webapp      | {"level":"info","module":"gorm","msg":"SELECT * FROM \"hep_proto_5_default\"  WHERE (sid in ($1) and create_date between $2 and $3)","time
":"2020-06-03T10:13:27Z","type":"sql"}
homer-webapp      | {"level":"info","module":"gorm","msg":"SELECT * FROM \"hep_proto_35_default\"  WHERE (sid in ($1) and create_date between $2 and $3)","tim
e":"2020-06-03T10:13:27Z","type":"sql"}
homer-webapp      | {"level":"info","msg":"Claims","time":"2020-06-03T10:13:27Z"}
homer-webapp      | {"level":"info","msg":"\u0026{barryf true false { 1591245748  0  0 }}","time":"2020-06-03T10:13:27Z"}
homer-webapp      | {"level":"info","module":"gorm","msg":"SELECT * FROM \"global_settings\"  ","time":"2020-06-03T10:13:27Z","type":"sql"}
homer-webapp      | {"level":"info","msg":"Claims","time":"2020-06-03T10:13:30Z"}
homer-webapp      | {"level":"info","msg":"\u0026{barryf true false { 1591245748  0  0 }}","time":"2020-06-03T10:13:30Z"}
homer-webapp      | {"level":"info","module":"gorm","msg":"SELECT * FROM \"agent_location_session\"  WHERE (expire_date \u003e NOW() AND type LIKE '%cdr%')","
time":"2020-06-03T10:13:30Z","type":"sql"}
homer-webapp      | {"level":"info","module":"gorm","msg":"SELECT count(*) FROM \"agent_location_session\"  WHERE (expire_date \u003e NOW() AND type LIKE '%cd
r%')","time":"2020-06-03T10:13:30Z","type":"sql"}

My Correlation Mapping for SIP call profile is:

[
    {
        "source_field": "data_header.callid",
        "lookup_id": 100,
        "lookup_profile": "call",
        "lookup_field": "sid",
        "lookup_range": [
            -300,
            200
        ]
    },
    {
        "source_field": "data_header.callid",
        "lookup_id": 5,
        "lookup_profile": "call",
        "lookup_field": "sid",
        "lookup_range": [
            -300,
            200
        ]
    },
    {
        "source_field": "protocol_header.correlation_id",
        "lookup_id": 1,
        "lookup_profile": "call",
        "lookup_field": "sid",
        "lookup_range": [
            -300,
            200
        ]
    },
    {
        "source_field": "data_header.callid",
        "lookup_id": 1,
        "lookup_profile": "call",
        "lookup_field": "data_header->>'callid'",
        "lookup_range": [
            -300,
            200
        ],
        "input_function_js": "var md5=function(d){return M(V(Y(X(d),8*d.length))).toLowerCase()};function M(d){for(var _,m="0123456789ABCDEF",f="",n=0;n<d.length;n++)_=d.charCodeAt(n),f+=m.charAt(_>>>4&15)+m.charAt(15&_);return f}function X(d){for(var _=Array(d.length>>2),m=0;m<_.length;m++)_[m]=0;for(m=0;m<8*d.length;m+=8)_[m>>5]|=(255&d.charCodeAt(m/8))<<m%32;return _}function V(d){for(var _="",m=0;m<32*d.length;m+=8)_+=String.fromCharCode(d[m>>5]>>>m%32&255);return _}function Y(d,_){d[_>>5]|=128<<_%32,d[14+(_+64>>>9<<4)]=_;for(var m=1732584193,f=-271733879,n=-1732584194,r=271733878,i=0;i<d.length;i+=16){var h=m,g=f,t=n,e=r;f=md5_ii(f=md5_ii(f=md5_ii(f=md5_ii(f=md5_hh(f=md5_hh(f=md5_hh(f=md5_hh(f=md5_gg(f=md5_gg(f=md5_gg(f=md5_gg(f=md5_ff(f=md5_ff(f=md5_ff(f=md5_ff(f,n=md5_ff(n,r=md5_ff(r,m=md5_ff(m,f,n,r,d[i+0],7,-680876936),f,n,d[i+1],12,-389564586),m,f,d[i+2],17,606105819),r,m,d[i+3],22,-1044525330),n=md5_ff(n,r=md5_ff(r,m=md5_ff(m,f,n,r,d[i+4],7,-176418897),f,n,d[i+5],12,1200080426),m,f,d[i+6],17,-1473231341),r,m,d[i+7],22,-45705983),n=md5_ff(n,r=md5_ff(r,m=md5_ff(m,f,n,r,d[i+8],7,1770035416),f,n,d[i+9],12,-1958414417),m,f,d[i+10],17,-42063),r,m,d[i+11],22,-1990404162),n=md5_ff(n,r=md5_ff(r,m=md5_ff(m,f,n,r,d[i+12],7,1804603682),f,n,d[i+13],12,-40341101),m,f,d[i+14],17,-1502002290),r,m,d[i+15],22,1236535329),n=md5_gg(n,r=md5_gg(r,m=md5_gg(m,f,n,r,d[i+1],5,-165796510),f,n,d[i+6],9,-1069501632),m,f,d[i+11],14,643717713),r,m,d[i+0],20,-373897302),n=md5_gg(n,r=md5_gg(r,m=md5_gg(m,f,n,r,d[i+5],5,-701558691),f,n,d[i+10],9,38016083),m,f,d[i+15],14,-660478335),r,m,d[i+4],20,-405537848),n=md5_gg(n,r=md5_gg(r,m=md5_gg(m,f,n,r,d[i+9],5,568446438),f,n,d[i+14],9,-1019803690),m,f,d[i+3],14,-187363961),r,m,d[i+8],20,1163531501),n=md5_gg(n,r=md5_gg(r,m=md5_gg(m,f,n,r,d[i+13],5,-1444681467),f,n,d[i+2],9,-51403784),m,f,d[i+7],14,1735328473),r,m,d[i+12],20,-1926607734),n=md5_hh(n,r=md5_hh(r,m=md5_hh(m,f,n,r,d[i+5],4,-378558),f,n,d[i+8],11,-2022574463),m,f,d[i+11],16,1839030562),r,m,d[i+14],23,-35309556),n=md5_hh(n,r=md5_hh(r,m=md5_hh(m,f,n,r,d[i+1],4,-1530992060),f,n,d[i+4],11,1272893353),m,f,d[i+7],16,-155497632),r,m,d[i+10],23,-1094730640),n=md5_hh(n,r=md5_hh(r,m=md5_hh(m,f,n,r,d[i+13],4,681279174),f,n,d[i+0],11,-358537222),m,f,d[i+3],16,-722521979),r,m,d[i+6],23,76029189),n=md5_hh(n,r=md5_hh(r,m=md5_hh(m,f,n,r,d[i+9],4,-640364487),f,n,d[i+12],11,-421815835),m,f,d[i+15],16,530742520),r,m,d[i+2],23,-995338651),n=md5_ii(n,r=md5_ii(r,m=md5_ii(m,f,n,r,d[i+0],6,-198630844),f,n,d[i+7],10,1126891415),m,f,d[i+14],15,-1416354905),r,m,d[i+5],21,-57434055),n=md5_ii(n,r=md5_ii(r,m=md5_ii(m,f,n,r,d[i+12],6,1700485571),f,n,d[i+3],10,-1894986606),m,f,d[i+10],15,-1051523),r,m,d[i+1],21,-2054922799),n=md5_ii(n,r=md5_ii(r,m=md5_ii(m,f,n,r,d[i+8],6,1873313359),f,n,d[i+15],10,-30611744),m,f,d[i+6],15,-1560198380),r,m,d[i+13],21,1309151649),n=md5_ii(n,r=md5_ii(r,m=md5_ii(m,f,n,r,d[i+4],6,-145523070),f,n,d[i+11],10,-1120210379),m,f,d[i+2],15,718787259),r,m,d[i+9],21,-343485551),m=safe_add(m,h),f=safe_add(f,g),n=safe_add(n,t),r=safe_add(r,e)}return Array(m,f,n,r)}function md5_cmn(d,_,m,f,n,r){return safe_add(bit_rol(safe_add(safe_add(_,d),safe_add(f,r)),n),m)}function md5_ff(d,_,m,f,n,r,i){return md5_cmn(_&m|~_&f,d,_,n,r,i)}function md5_gg(d,_,m,f,n,r,i){return md5_cmn(_&f|m&~f,d,_,n,r,i)}function md5_hh(d,_,m,f,n,r,i){return md5_cmn(_^m^f,d,_,n,r,i)}function md5_ii(d,_,m,f,n,r,i){return md5_cmn(m^(_|~f),d,_,n,r,i)}function safe_add(d,_){var m=(65535&d)+(65535&_);return(d>>16)+(_>>16)+(m>>16)<<16|65535&m}function bit_rol(d,_){return d<<_|d>>>32-_}function tinymd5(d,_){return _=_||16,(d=window.btoa(md5(d)).replace(/[aiueoAIUEO\+\/]/g,"").substring(0,_)).length<_&&(d+=Array(_-d.length).join("=")),d}; var returnData=[]; for (var i = 0; i < data.length; i++) { returnData.push( 
 tinymd5(data[i],16) ); }; returnData;"
    }
]

If I change the input_function_js to hardcode the B-leg cid like so:

"input_function_js": "var returnData=[]; for (var i = 0; i < data.length; i++) {returnData.push('ba0b8b9fe0ed43ffeb9a60343d5fa330');}; returnData;"

..then the A and B leg of the call are returned. Therefore I guess it is something in the MD5 functions. What manipulation of the js code do I need to do to make it suitable for defining it in input_function_js?

Many thanks

flantel commented 4 years ago

Having no luck here at all. Would it be possible to use a mapping which used the Postgres md5(callid) function as well as searching callid?

lmangani commented 4 years ago

@flantel you can use anything that can be ported to javascript and have as many functions as your logic requires in mapping

flantel commented 4 years ago

@lmangani Thanks. I have js code in there and I tested it separately and it does return the correct value. Howeviner, I can see no evidence that it gets run by homer-app at all. The POST when clicking on a session-id only contains the single, original call-id, and I do not see anywhere client-side that the js code is getting loaded or run in my browser.

I presume the mapping correlations and input_function_js are run against the Search Box input in the browser - is that correct? Where can I look for signs that the input_fuction_js is actually getting run? Many thanks. Would love to move off Voipmonitor and this is the big holdup.

flantel commented 4 years ago

Some questions:

  1. Is there any way at all to debug the input_function_js? I can see that it is getting returned in the mapping_schema query, but no logs show any output as to whether it was applied or what the returnData value was.
  2. When does the input_function_js get called? Is it when I use the search box or is it when I click on the call-id or session-id in the results?
  3. Is input_function_js run on the server or client?
  4. Should I have multiple data_header.callid stanzas in the mapping for lookup_id 1 and profile call, or only the one with input_function_js?

I am running the docker master webapp.

Thanks

adubovikov commented 4 years ago
  1. activate debug level and it should display output.
  2. if you click on a callid/session-id
  3. on the server
  4. the function will do modification of callids that will be send to database as a query param (IN ('callid1', 'callid2','callid3')

On Wed, 10 Jun 2020 at 18:44, Barry Flanagan notifications@github.com wrote:

Some questions:

  1. Is there any way at all to debug the input_function_js? I can see that it is getting returned in the mapping_schema query, but no logs show any output as to whether it was applied or what the returnData value was.
  2. When does the input_function_js get called? Is it when I use the search box or is it when I click on the call-id or session-id in the results?
  3. Is input_function_js run on the server or client?
  4. Should I have multiple data_header.callid stanzas in the mapping for lookup_id 1 and profile call, or only the one with input_function_js?

I am running the docker master webapp.

Thanks

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/sipcapture/homer-app/issues/352#issuecomment-642129457, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABCN2JIYQW3CHU6TV4DCZPLRV6Z7HANCNFSM4NKL7DWA .

flantel commented 4 years ago

Thanks @adubovikov In webapp I have system_settings.loglevel set to debug (tried trace as well), but I see no output regarding input_function_js. I can see that the query only contains the original call-id, but nothing to suggest the js was run, nor any error or other useful output.

adubovikov commented 4 years ago

let me check if i can add more debug information inside

On Wed, 10 Jun 2020 at 21:10, Barry Flanagan notifications@github.com wrote:

Thanks @adubovikov https://github.com/adubovikov In webapp I have system_settings.loglevel set to debug (tried trace as well), but I see no output regarding input_function_js. I can see that the query only contains the original call-id, but nothing to suggest the js was run, nor any error or other useful output.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/sipcapture/homer-app/issues/352#issuecomment-642202428, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABCN2JLDBO2SYVIXJWNRJ7TRV7LC7ANCNFSM4NKL7DWA .

adubovikov commented 4 years ago

https://github.com/sipcapture/homer-app/commit/299905538acd18cb3531b75bc9c9b6e2b9185535

but this is only in the git repository. Wait for a next nightly build or release

On Wed, 10 Jun 2020 at 21:11, Alexandr Dubovikov < alexandr.dubovikov@gmail.com> wrote:

let me check if i can add more debug information inside

On Wed, 10 Jun 2020 at 21:10, Barry Flanagan notifications@github.com wrote:

Thanks @adubovikov https://github.com/adubovikov In webapp I have system_settings.loglevel set to debug (tried trace as well), but I see no output regarding input_function_js. I can see that the query only contains the original call-id, but nothing to suggest the js was run, nor any error or other useful output.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/sipcapture/homer-app/issues/352#issuecomment-642202428, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABCN2JLDBO2SYVIXJWNRJ7TRV7LC7ANCNFSM4NKL7DWA .

flantel commented 4 years ago

Thanks very much!

flantel commented 4 years ago

@adubovikov Your help is much appreciated. Unfortunately I am unable to get any degug info regarding search at all. I built a new webapp container from latest source, including your patch, and have both http server and system set to debug, but I see no degug output apart from the db pings. I even edited search.go to change the logrus.Debug to logrus.Info but still it does not show any output.

webapp_config.json in the container includes:

  "system_settings": {
    "_comment": "loglevel can be: fatal, error, warn, info, debug, trace",
    "hostname": "3863f9c105f2",
    "loglevel": "debug",
    "logname": "homer-app.log",
    "logpath": "/usr/local/homer",
    "logstdout": false,
    "uuid": "8a5905af-2f2b-45d1-bb56-e4c770448f5e"

  "http_settings": {                              
    "debug": true,
    "gzip": true,
    "host": "0.0.0.0",
    "port": 80,
    "root": "/usr/local/homer/dist"
  },
systemcrash commented 4 years ago

Theoretical question for @flantel - what happens to the ID when calls are forked (each forked call should in theory get its own Call-ID)?

Also - did you kill the container and up -d --build the new one?

PS you must compile the .go files (i.e. the whole project) for changes to have effect.

flantel commented 4 years ago

@systemcrash The Call-ID header is changed by the b2b so the B-leg Call-ID is the md5 hash of the A-Leg Call-ID

I built a new container from a git clone, and completely rm'ed the existing webapp and then restarted with the new image. I can see in the image that the new code is in place.

negbie commented 4 years ago

@flantel you could check out lua script to handle correlation. https://github.com/sipcapture/homer/wiki/HOMER-LUA-Scripting#scriptbase64

flantel commented 4 years ago

@negbie Yes, I looked at it, but it seems the mapping should work fine for what I am after. If I don't get it running soon using input_function_js then I suppose I will have to bite the bullet and learn a little Lua :-)

systemcrash commented 4 years ago

I don't think this should affect what is going on, but when I run:

tinymd5("673187ceafc579fab78cc84cb1077a3f@0.0.0.0") I get YmwYjhWZlMGVkNDN

but when I run md5("673187ceafc579fab78cc84cb1077a3f@0.0.0.0") I get ba0b8b9fe0ed43ffeb9a60343d5fa330

when I define


var md5 = function(d){var r = M(V(Y(X(d),8*d.length)));return r.toLowerCase()};function M(d){for(var _,m="0123456789ABCDEF",f="",r=0;r<d.length;r++)_=d.charCodeAt(r),f+=m.charAt(_>>>4&15)+m.charAt(15&_);return f}function X(d){for(var _=Array(d.length>>2),m=0;m<_.length;m++)_[m]=0;for(m=0;m<8*d.length;m+=8)_[m>>5]|=(255&d.charCodeAt(m/8))<<m%32;return _}function V(d){for(var _="",m=0;m<32*d.length;m+=8)_+=String.fromCharCode(d[m>>5]>>>m%32&255);return _}function Y(d,_){d[_>>5]|=128<<_%32,d[14+(_+64>>>9<<4)]=_;for(var m=1732584193,f=-271733879,r=-1732584194,i=271733878,n=0;n<d.length;n+=16){var h=m,t=f,g=r,e=i;f=md5_ii(f=md5_ii(f=md5_ii(f=md5_ii(f=md5_hh(f=md5_hh(f=md5_hh(f=md5_hh(f=md5_gg(f=md5_gg(f=md5_gg(f=md5_gg(f=md5_ff(f=md5_ff(f=md5_ff(f=md5_ff(f,r=md5_ff(r,i=md5_ff(i,m=md5_ff(m,f,r,i,d[n+0],7,-680876936),f,r,d[n+1],12,-389564586),m,f,d[n+2],17,606105819),i,m,d[n+3],22,-1044525330),r=md5_ff(r,i=md5_ff(i,m=md5_ff(m,f,r,i,d[n+4],7,-176418897),f,r,d[n+5],12,1200080426),m,f,d[n+6],17,-1473231341),i,m,d[n+7],22,-45705983),r=md5_ff(r,i=md5_ff(i,m=md5_ff(m,f,r,i,d[n+8],7,1770035416),f,r,d[n+9],12,-1958414417),m,f,d[n+10],17,-42063),i,m,d[n+11],22,-1990404162),r=md5_ff(r,i=md5_ff(i,m=md5_ff(m,f,r,i,d[n+12],7,1804603682),f,r,d[n+13],12,-40341101),m,f,d[n+14],17,-1502002290),i,m,d[n+15],22,1236535329),r=md5_gg(r,i=md5_gg(i,m=md5_gg(m,f,r,i,d[n+1],5,-165796510),f,r,d[n+6],9,-1069501632),m,f,d[n+11],14,643717713),i,m,d[n+0],20,-373897302),r=md5_gg(r,i=md5_gg(i,m=md5_gg(m,f,r,i,d[n+5],5,-701558691),f,r,d[n+10],9,38016083),m,f,d[n+15],14,-660478335),i,m,d[n+4],20,-405537848),r=md5_gg(r,i=md5_gg(i,m=md5_gg(m,f,r,i,d[n+9],5,568446438),f,r,d[n+14],9,-1019803690),m,f,d[n+3],14,-187363961),i,m,d[n+8],20,1163531501),r=md5_gg(r,i=md5_gg(i,m=md5_gg(m,f,r,i,d[n+13],5,-1444681467),f,r,d[n+2],9,-51403784),m,f,d[n+7],14,1735328473),i,m,d[n+12],20,-1926607734),r=md5_hh(r,i=md5_hh(i,m=md5_hh(m,f,r,i,d[n+5],4,-378558),f,r,d[n+8],11,-2022574463),m,f,d[n+11],16,1839030562),i,m,d[n+14],23,-35309556),r=md5_hh(r,i=md5_hh(i,m=md5_hh(m,f,r,i,d[n+1],4,-1530992060),f,r,d[n+4],11,1272893353),m,f,d[n+7],16,-155497632),i,m,d[n+10],23,-1094730640),r=md5_hh(r,i=md5_hh(i,m=md5_hh(m,f,r,i,d[n+13],4,681279174),f,r,d[n+0],11,-358537222),m,f,d[n+3],16,-722521979),i,m,d[n+6],23,76029189),r=md5_hh(r,i=md5_hh(i,m=md5_hh(m,f,r,i,d[n+9],4,-640364487),f,r,d[n+12],11,-421815835),m,f,d[n+15],16,530742520),i,m,d[n+2],23,-995338651),r=md5_ii(r,i=md5_ii(i,m=md5_ii(m,f,r,i,d[n+0],6,-198630844),f,r,d[n+7],10,1126891415),m,f,d[n+14],15,-1416354905),i,m,d[n+5],21,-57434055),r=md5_ii(r,i=md5_ii(i,m=md5_ii(m,f,r,i,d[n+12],6,1700485571),f,r,d[n+3],10,-1894986606),m,f,d[n+10],15,-1051523),i,m,d[n+1],21,-2054922799),r=md5_ii(r,i=md5_ii(i,m=md5_ii(m,f,r,i,d[n+8],6,1873313359),f,r,d[n+15],10,-30611744),m,f,d[n+6],15,-1560198380),i,m,d[n+13],21,1309151649),r=md5_ii(r,i=md5_ii(i,m=md5_ii(m,f,r,i,d[n+4],6,-145523070),f,r,d[n+11],10,-1120210379),m,f,d[n+2],15,718787259),i,m,d[n+9],21,-343485551),m=safe_add(m,h),f=safe_add(f,t),r=safe_add(r,g),i=safe_add(i,e)}return Array(m,f,r,i)}function md5_cmn(d,_,m,f,r,i){return safe_add(bit_rol(safe_add(safe_add(_,d),safe_add(f,i)),r),m)}function md5_ff(d,_,m,f,r,i,n){return md5_cmn(_&m|~_&f,d,_,r,i,n)}function md5_gg(d,_,m,f,r,i,n){return md5_cmn(_&f|m&~f,d,_,r,i,n)}function md5_hh(d,_,m,f,r,i,n){return md5_cmn(_^m^f,d,_,r,i,n)}function md5_ii(d,_,m,f,r,i,n){return md5_cmn(m^(_|~f),d,_,r,i,n)}function safe_add(d,_){var m=(65535&d)+(65535&_);return(d>>16)+(_>>16)+(m>>16)<<16|65535&m}function bit_rol(d,_){return d<<_|d>>>32-_}

Seems to me that

...
        ],
        "input_function_js": "var md5=function(d){return M(V(Y(X(d),8*d.length))).toLowerCase()};function M(d){for(var _,m="0123456789ABCDEF",f="",n=0;n<d.length;n++)_=d.charCodeAt(n),f+=m.charAt(_>>>4&15)+m.charAt(15&_);return f}function X(d){for(var _=Array(d.length>>2),m=0;m<_.length;m++)_[m]=0;for(m=0;m<8*d.length;m+=8)_[m>>5]|=(255&d.charCodeAt(m/8))<<m%32;return _}function V(d){for(var _="",m=0;m<32*d.length;m+=8)_+=String.fromCharCode(d[m>>5]>>>m%32&255);return _}function Y(d,_){d[_>>5]|=128<<_%32,d[14+(_+64>>>9<<4)]=_;for(var m=1732584193,f=-271733879,n=-1732584194,r=271733878,i=0;i<d.length;i+=16){var h=m,g=f,t=n,e=r;f=md5_ii(f=md5_ii(f=md5_ii(f=md5_ii(f=md5_hh(f=md5_hh(f=md5_hh(f=md5_hh(f=md5_gg(f=md5_gg(f=md5_gg(f=md5_gg(f=md5_ff(f=md5_ff(f=md5_ff(f=md5_ff(f,n=md5_ff(n,r=md5_ff(r,m=md5_ff(m,f,n,r,d[i+0],7,-680876936),f,n,d[i+1],12,-389564586),m,f,d[i+2],17,606105819),r,m,d[i+3],22,-1044525330),n=md5_ff(n,r=md5_ff(r,m=md5_ff(m,f,n,r,d[i+4],7,-176418897),f,n,d[i+5],12,1200080426),m,f,d[i+6],17,-1473231341),r,m,d[i+7],22,-45705983),n=md5_ff(n,r=md5_ff(r,m=md5_ff(m,f,n,r,d[i+8],7,1770035416),f,n,d[i+9],12,-1958414417),m,f,d[i+10],17,-42063),r,m,d[i+11],22,-1990404162),n=md5_ff(n,r=md5_ff(r,m=md5_ff(m,f,n,r,d[i+12],7,1804603682),f,n,d[i+13],12,-40341101),m,f,d[i+14],17,-1502002290),r,m,d[i+15],22,1236535329),n=md5_gg(n,r=md5_gg(r,m=md5_gg(m,f,n,r,d[i+1],5,-165796510),f,n,d[i+6],9,-1069501632),m,f,d[i+11],14,643717713),r,m,d[i+0],20,-373897302),n=md5_gg(n,r=md5_gg(r,m=md5_gg(m,f,n,r,d[i+5],5,-701558691),f,n,d[i+10],9,38016083),m,f,d[i+15],14,-660478335),r,m,d[i+4],20,-405537848),n=md5_gg(n,r=md5_gg(r,m=md5_gg(m,f,n,r,d[i+9],5,568446438),f,n,d[i+14],9,-1019803690),m,f,d[i+3],14,-187363961),r,m,d[i+8],20,1163531501),n=md5_gg(n,r=md5_gg(r,m=md5_gg(m,f,n,r,d[i+13],5,-1444681467),f,n,d[i+2],9,-51403784),m,f,d[i+7],14,1735328473),r,m,d[i+12],20,-1926607734),n=md5_hh(n,r=md5_hh(r,m=md5_hh(m,f,n,r,d[i+5],4,-378558),f,n,d[i+8],11,-2022574463),m,f,d[i+11],16,1839030562),r,m,d[i+14],23,-35309556),n=md5_hh(n,r=md5_hh(r,m=md5_hh(m,f,n,r,d[i+1],4,-1530992060),f,n,d[i+4],11,1272893353),m,f,d[i+7],16,-155497632),r,m,d[i+10],23,-1094730640),n=md5_hh(n,r=md5_hh(r,m=md5_hh(m,f,n,r,d[i+13],4,681279174),f,n,d[i+0],11,-358537222),m,f,d[i+3],16,-722521979),r,m,d[i+6],23,76029189),n=md5_hh(n,r=md5_hh(r,m=md5_hh(m,f,n,r,d[i+9],4,-640364487),f,n,d[i+12],11,-421815835),m,f,d[i+15],16,530742520),r,m,d[i+2],23,-995338651),n=md5_ii(n,r=md5_ii(r,m=md5_ii(m,f,n,r,d[i+0],6,-198630844),f,n,d[i+7],10,1126891415),m,f,d[i+14],15,-1416354905),r,m,d[i+5],21,-57434055),n=md5_ii(n,r=md5_ii(r,m=md5_ii(m,f,n,r,d[i+12],6,1700485571),f,n,d[i+3],10,-1894986606),m,f,d[i+10],15,-1051523),r,m,d[i+1],21,-2054922799),n=md5_ii(n,r=md5_ii(r,m=md5_ii(m,f,n,r,d[i+8],6,1873313359),f,n,d[i+15],10,-30611744),m,f,d[i+6],15,-1560198380),r,m,d[i+13],21,1309151649),n=md5_ii(n,r=md5_ii(r,m=md5_ii(m,f,n,r,d[i+4],6,-145523070),f,n,d[i+11],10,-1120210379),m,f,d[i+2],15,718787259),r,m,d[i+9],21,-343485551),m=safe_add(m,h),f=safe_add(f,g),n=safe_add(n,t),r=safe_add(r,e)}return Array(m,f,n,r)}function md5_cmn(d,_,m,f,n,r){return safe_add(bit_rol(safe_add(safe_add(_,d),safe_add(f,r)),n),m)}function md5_ff(d,_,m,f,n,r,i){return md5_cmn(_&m|~_&f,d,_,n,r,i)}function md5_gg(d,_,m,f,n,r,i){return md5_cmn(_&f|m&~f,d,_,n,r,i)}function md5_hh(d,_,m,f,n,r,i){return md5_cmn(_^m^f,d,_,n,r,i)}function md5_ii(d,_,m,f,n,r,i){return md5_cmn(m^(_|~f),d,_,n,r,i)}function safe_add(d,_){var m=(65535&d)+(65535&_);return(d>>16)+(_>>16)+(m>>16)<<16|65535&m}function bit_rol(d,_){return d<<_|d>>>32-_}function tinymd5(d,_){return _=_||16,(d=window.btoa(md5(d)).replace(/[aiueoAIUEO\+\/]/g,"").substring(0,_)).length<_&&(d+=Array(_-d.length).join("=")),d}; var returnData=[]; for (var i = 0; i < data.length; i++) { returnData.push( 
 tinymd5(data[i],16) ); }; returnData;"
    }

should be

        ],
        "input_function_js": "var md5=function(d){return M(V(Y(X(d),8*d.length))).toLowerCase()};function M(d){for(var _,m="0123456789ABCDEF",f="",n=0;n<d.length;n++)_=d.charCodeAt(n),f+=m.charAt(_>>>4&15)+m.charAt(15&_);return f}function X(d){for(var _=Array(d.length>>2),m=0;m<_.length;m++)_[m]=0;for(m=0;m<8*d.length;m+=8)_[m>>5]|=(255&d.charCodeAt(m/8))<<m%32;return _}function V(d){for(var _="",m=0;m<32*d.length;m+=8)_+=String.fromCharCode(d[m>>5]>>>m%32&255);return _}function Y(d,_){d[_>>5]|=128<<_%32,d[14+(_+64>>>9<<4)]=_;for(var m=1732584193,f=-271733879,n=-1732584194,r=271733878,i=0;i<d.length;i+=16){var h=m,g=f,t=n,e=r;f=md5_ii(f=md5_ii(f=md5_ii(f=md5_ii(f=md5_hh(f=md5_hh(f=md5_hh(f=md5_hh(f=md5_gg(f=md5_gg(f=md5_gg(f=md5_gg(f=md5_ff(f=md5_ff(f=md5_ff(f=md5_ff(f,n=md5_ff(n,r=md5_ff(r,m=md5_ff(m,f,n,r,d[i+0],7,-680876936),f,n,d[i+1],12,-389564586),m,f,d[i+2],17,606105819),r,m,d[i+3],22,-1044525330),n=md5_ff(n,r=md5_ff(r,m=md5_ff(m,f,n,r,d[i+4],7,-176418897),f,n,d[i+5],12,1200080426),m,f,d[i+6],17,-1473231341),r,m,d[i+7],22,-45705983),n=md5_ff(n,r=md5_ff(r,m=md5_ff(m,f,n,r,d[i+8],7,1770035416),f,n,d[i+9],12,-1958414417),m,f,d[i+10],17,-42063),r,m,d[i+11],22,-1990404162),n=md5_ff(n,r=md5_ff(r,m=md5_ff(m,f,n,r,d[i+12],7,1804603682),f,n,d[i+13],12,-40341101),m,f,d[i+14],17,-1502002290),r,m,d[i+15],22,1236535329),n=md5_gg(n,r=md5_gg(r,m=md5_gg(m,f,n,r,d[i+1],5,-165796510),f,n,d[i+6],9,-1069501632),m,f,d[i+11],14,643717713),r,m,d[i+0],20,-373897302),n=md5_gg(n,r=md5_gg(r,m=md5_gg(m,f,n,r,d[i+5],5,-701558691),f,n,d[i+10],9,38016083),m,f,d[i+15],14,-660478335),r,m,d[i+4],20,-405537848),n=md5_gg(n,r=md5_gg(r,m=md5_gg(m,f,n,r,d[i+9],5,568446438),f,n,d[i+14],9,-1019803690),m,f,d[i+3],14,-187363961),r,m,d[i+8],20,1163531501),n=md5_gg(n,r=md5_gg(r,m=md5_gg(m,f,n,r,d[i+13],5,-1444681467),f,n,d[i+2],9,-51403784),m,f,d[i+7],14,1735328473),r,m,d[i+12],20,-1926607734),n=md5_hh(n,r=md5_hh(r,m=md5_hh(m,f,n,r,d[i+5],4,-378558),f,n,d[i+8],11,-2022574463),m,f,d[i+11],16,1839030562),r,m,d[i+14],23,-35309556),n=md5_hh(n,r=md5_hh(r,m=md5_hh(m,f,n,r,d[i+1],4,-1530992060),f,n,d[i+4],11,1272893353),m,f,d[i+7],16,-155497632),r,m,d[i+10],23,-1094730640),n=md5_hh(n,r=md5_hh(r,m=md5_hh(m,f,n,r,d[i+13],4,681279174),f,n,d[i+0],11,-358537222),m,f,d[i+3],16,-722521979),r,m,d[i+6],23,76029189),n=md5_hh(n,r=md5_hh(r,m=md5_hh(m,f,n,r,d[i+9],4,-640364487),f,n,d[i+12],11,-421815835),m,f,d[i+15],16,530742520),r,m,d[i+2],23,-995338651),n=md5_ii(n,r=md5_ii(r,m=md5_ii(m,f,n,r,d[i+0],6,-198630844),f,n,d[i+7],10,1126891415),m,f,d[i+14],15,-1416354905),r,m,d[i+5],21,-57434055),n=md5_ii(n,r=md5_ii(r,m=md5_ii(m,f,n,r,d[i+12],6,1700485571),f,n,d[i+3],10,-1894986606),m,f,d[i+10],15,-1051523),r,m,d[i+1],21,-2054922799),n=md5_ii(n,r=md5_ii(r,m=md5_ii(m,f,n,r,d[i+8],6,1873313359),f,n,d[i+15],10,-30611744),m,f,d[i+6],15,-1560198380),r,m,d[i+13],21,1309151649),n=md5_ii(n,r=md5_ii(r,m=md5_ii(m,f,n,r,d[i+4],6,-145523070),f,n,d[i+11],10,-1120210379),m,f,d[i+2],15,718787259),r,m,d[i+9],21,-343485551),m=safe_add(m,h),f=safe_add(f,g),n=safe_add(n,t),r=safe_add(r,e)}return Array(m,f,n,r)}function md5_cmn(d,_,m,f,n,r){return safe_add(bit_rol(safe_add(safe_add(_,d),safe_add(f,r)),n),m)}function md5_ff(d,_,m,f,n,r,i){return md5_cmn(_&m|~_&f,d,_,n,r,i)}function md5_gg(d,_,m,f,n,r,i){return md5_cmn(_&f|m&~f,d,_,n,r,i)}function md5_hh(d,_,m,f,n,r,i){return md5_cmn(_^m^f,d,_,n,r,i)}function md5_ii(d,_,m,f,n,r,i){return md5_cmn(m^(_|~f),d,_,n,r,i)}function safe_add(d,_){var m=(65535&d)+(65535&_);return(d>>16)+(_>>16)+(m>>16)<<16|65535&m}function bit_rol(d,_){return d<<_|d>>>32-_}function tinymd5(d,_){return _=_||16,(d=window.btoa(md5(d)).replace(/[aiueoAIUEO\+\/]/g,"").substring(0,_)).length<_&&(d+=Array(_-d.length).join("=")),d}; var returnData=[]; for (var i = 0; i < data.length; i++) { returnData.push( 
 md5(data[i]) ); }; returnData;"
    }

(could also trim out the tinymd5 function)

Hope I didn't miss some important reason why the tinymd5 function must run.

flantel commented 4 years ago

Thanks @systemcrash - I have tried multiple different md5 functions and still I see no evidence that it ever gets run. When I click on a session-id, the flow pop-up should, I think, show any call-id's being searched for (at least that is what happened when I hard-coded returnData to return a static string). This is not happening and only the original call-id is listed.

flantel commented 4 years ago

Still having no luck here. Is there any way at all I can confirm that the input_function_js is actually getting run? I can see no evidence ni any log that it is getting triggered at all. I would engage someone professionally to get this working. Thanks

adubovikov commented 4 years ago

Can you watch on Monday/Thursday our presentation on ComCon 2020? There we will explain how to use input and output scripts to make and manipulate data inside of correlation mapping?

On Fri, 10 Jul 2020, 16:37 Barry Flanagan notifications@github.com wrote:

Still having no luck here. Is there any way at all I can confirm that the input_function_js is actually getting run? I can see no evidence ni any log that it is getting triggered at all. I would engage someone professionally to get this working. Thanks

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/sipcapture/homer-app/issues/352#issuecomment-656709577, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABCN2JOFMQ5XAXEECFLAPJDR24RRJANCNFSM4NKL7DWA .

flantel commented 4 years ago

Thanks @adubovikov - I watched your presentation and then tried the method of creating the script under Advanced and then setting "input_script": "my_script" into the Mapping.

Very happy to have it working at long last!

adubovikov commented 4 years ago

Super! I am glad to read it! Enjoy and don't forget to star the project 😊

Regards, Alexandr

On Fri, 17 Jul 2020, 12:36 Barry Flanagan notifications@github.com wrote:

Thanks @adubovikov https://github.com/adubovikov - I watched your presentation and then tried the method of creating the script under Advanced and then setting "input_script": "my_script" into the Mapping.

Very happy to have it working at long last!

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/sipcapture/homer-app/issues/352#issuecomment-660029405, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABCN2JITSYZJFVB4U5MV7NDR4ASRTANCNFSM4NKL7DWA .

systemcrash commented 4 years ago

Anyone else curious might find that here

Google and other engines could not figure out ComCon 2020 -> CommCon 2020...

adubovikov commented 4 years ago

Thanks for pointing that out!

On Tue, 21 Jul 2020, 00:44 Paul Dee notifications@github.com wrote:

Anyone else curious might find that here https://www.youtube.com/watch?v=4dBKoLSy6Ro

Google and other engines could not figure out ComCon 2020 -> CommCon 2020...

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/sipcapture/homer-app/issues/352#issuecomment-661399049, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABCN2JK6WWI7RDW3GLHD5ALR4TCDPANCNFSM4NKL7DWA .