sipcapture / homer-app

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

Correlation for FreePBX / Asterisk / SBC #507

Closed ryan99alero closed 1 month ago

ryan99alero commented 1 year ago

I'm running version 16.0.30 of FreePBX with Asterisk 20.1.0. I also have a Sangoma SBC and all are setup with hep protocol. Originally I was running same FreePBX with Asterisk version 18.

I followed the discussion on Feb 8th, 2018 "Assistance required is correlation ID" Chat on the Google SipCapture Forum group. I also followed the Wiki on GitHub about correlation and asterisk. Results never produce all legs correlated. I've always had Homer roughly working. It's just been along time sine I've had all the legs Correlation working correctly. Homer5 was the last time I had it working.

I've tried what was also under the Wiki for Asterisk.

I have input into my Trunk's: Asterisk Trunk Dial Options Ttb(modifyPjsipHeader^addheader^1)

Below is contents of my /etc/asterisk/extensions_custom.conf

[macro-dialout-trunk-predial-hook] exten => s,1,Set(__pjsipCallId=${CHANNEL(pjsip,call-id)}) exten => s,n,Set(PJSIP_HEADER(add,X-CID)=${pjsipCallId}) exten => s,n,Gosub(func-apply-sipheaders,s,1())

[modifyPjsipHeader] exten => addheader,1,Set(PJSIP_HEADER(add,X-CID)=${pjsipCallId}) exten => addheader,n,Return

[setXcid] exten => s,1,Set(__pjsipCallId=${PJSIP_HEADER(read,Call-ID)}) exten => s,n,Gosub(func-set-sipheader,s,1(X-CID,${pjsipCallId})) exten => s,n,Gosub(func-apply-sipheaders,s,1()) exten => s,n,Return()

[macro-hangupcall-custom] ; start of QoS reporting exten => s,1,Set(CDR(callid)=${SIPCALLID}) exten => s,2,Set(CDR(rtcpinfo)=${RTPAUDIOQOS}) exten => s,1,NoOp(Start QoS) exten => s,n,NoOp(Local Stream ID: ${CHANNEL(rtcp,local_ssrc)}) exten => s,n,NoOp(Remote Stream ID: ${CHANNEL(rtcp,remote_ssrc)}) exten => s,n,NoOp(Packets Sent: ${CHANNEL(rtcp,txcount)}) exten => s,n,NoOp(Packets Received: ${CHANNEL(rtcp,rxcount)}) exten => s,n,NoOp(Local RX Packet Loss Max: ${CHANNEL(rtcp,local_maxrxploss)}) exten => s,n,NoOp(Local RX Packet Loss Min: ${CHANNEL(rtcp,local_minrxploss)}) exten => s,n,NoOp(Local RX Packet Loss: ${CHANNEL(rtcp,rxploss)}) exten => s,n,NoOp(Local RX Packet Loss Norm Dev: ${CHANNEL(rtcp,local_normdevrxploss)}) exten => s,n,NoOp(Local RX Packet Loss Std Dev: ${CHANNEL(rtcp,local_stdevrxploss)}) exten => s,n,NoOp(Local TX Packet Loss: ${CHANNEL(rtcp,txploss)}) exten => s,n,NoOp(Remote RX Packet Loss Max: ${CHANNEL(rtcp,remote_maxrxploss)}) exten => s,n,NoOp(Remote RX Packet Loss Min: ${CHANNEL(rtcp,remote_minrxploss)}) exten => s,n,NoOp(Remote RX Packet Loss Norm Deviation: ${CHANNEL(rtcp,remote_normdevrxploss)}) exten => s,n,NoOp(Remote RX Packet Loss Std Deviation: ${CHANNEL(rtcp,remote_stdevrxploss)}) exten => s,n,NoOp(Round Trip Time: ${CHANNEL(rtcp,rtt)}) exten => s,n,NoOp(Round Trip Time Max: ${CHANNEL(rtcp,maxrtt)}) exten => s,n,NoOp(Round Trip Time Min: ${CHANNEL(rtcp,minrtt)}) exten => s,n,NoOp(Round Trip Time Norm Dev: ${CHANNEL(rtcp,normdevrtt)}) exten => s,n,NoOp(Round Trip Time Std Dev: ${CHANNEL(rtcp,stdevrtt)}) exten => s,n,NoOp(Local RX Jitter: ${CHANNEL(rtcp,rxjitter)}) exten => s,n,NoOp(Local TX Jitter: ${CHANNEL(rtcp,txjitter)}) exten => s,n,NoOp(Local Jitter Max: ${CHANNEL(rtcp,local_maxjitter)}) exten => s,n,NoOp(Local Jitter Min: ${CHANNEL(rtcp,local_minjitter)}) exten => s,n,NoOp(Local Jitter Norm Dev: ${CHANNEL(rtcp,local_normdevjitter)}) exten => s,n,NoOp(Local Jitter Std Dev: ${CHANNEL(rtcp,local_stdevjitter)}) exten => s,n,NoOp(Remote Jitter Max: ${CHANNEL(rtcp,remote_maxjitter)}) exten => s,n,NoOp(Remote Jitter Min: ${CHANNEL(rtcp,remote_minjitter)}) exten => s,n,NoOp(Remote Jitter Norm Dev: ${CHANNEL(rtcp,remote_normdevjitter)}) exten => s,n,NoOp(Remote Jitter Std Dev: ${CHANNEL(rtcp,remote_stdevjitter)}) exten => s,n,Set(CDR(userfield)=${CDR(userfield)} Packets Sent: ${CHANNEL(rtcp,txcount)}) exten => s,n,Set(CDR(userfield)=${CDR(userfield)} Packets Received: ${CHANNEL(rtcp,rxcount)}) exten => s,n,Set(CDR(userfield)=${CDR(userfield)} Local RX Packet Loss: ${CHANNEL(rtcp,rxploss)}) exten => s,n,Set(CDR(userfield)=${CDR(userfield)} Local TX Packet Loss: ${CHANNEL(rtcp,txploss)}) exten => s,n,Set(CDR(userfield)=${CDR(userfield)} Local RX Jitter: ${CHANNEL(rtcp,rxjitter)}) exten => s,n,Set(CDR(userfield)=${CDR(userfield)} Local TX Jitter: ${CHANNEL(rtcp,txjitter)}) exten => s,n,Set(CDR(userfield)=${CDR(userfield)} Local Jitter Max: ${CHANNEL(rtcp,local_maxjitter)}) exten => s,n,Set(CDR(userfield)=${CDR(userfield)} Local Jitter Min: ${CHANNEL(rtcp,local_minjitter)}) exten => s,n,Set(CDR(userfield)=${CDR(userfield)} Local Jitter Norm Dev: ${CHANNEL(rtcp,local_normdevjitter)}) exten => s,n,Set(CDR(userfield)=${CDR(userfield)} Local Jitter Std Dev: ${CHANNEL(rtcp,local_stdevjitter)}) exten => s,n(continue),NoOp(End of QoS)

exec "/var/www/html/fop2/admin/plugins/ivrflow/menu/dialplan.php"

My current Homer Correlation is: "FYI I also tried what was referenced in the Feb 8th, 2018 "Assistance required is correlation ID" Chat on this group [ { "source_field": "data_header.callid", "lookup_id": 100, "lookup_profile": "default", "lookup_field": "sid", "lookup_range": [ -300, 200 ] }, { "source_field": "data_header.callid", "lookup_id": 5, "lookup_profile": "default", "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 returnData=[]; for (var i = 0; i < data.length; i++) { returnData.push(data[i]+'_b2b-1'); }; returnData;" } ]

My Field Data in Homer is: As you can see at the bottom. I added the 2 sets as described on the Main Homer How to correlate guide on GitHub.

[ { "id": "sid", "type": "string", "index": "secondary", "name": "Session ID", "form_type": "input", "position": 1, "sid_type": true, "hide": false }, { "id": "data_header.method", "name": "SIP Method", "type": "string", "index": "none", "form_type": "input", "form_default": [ "INVITE", "BYE", "100", "200", "183", "CANCEL" ], "position": 2, "skip": false, "hide": false, "method_type": true }, { "id": "protocol_header.correlation_id", "name": "Correlation ID", "type": "string", "index": "none", "form_type": "input", "position": 3, "skip": false, "hide": true, "sid_type": true }, { "id": "data_header.callid", "name": "CallID", "type": "string", "index": "none", "form_type": "input", "position": 4, "skip": false, "hide": true, "sid_type": true }, { "id": "data_header.ruri_user", "name": "RURI user", "type": "string", "index": "none", "form_type": "input", "position": 5, "skip": false, "hide": true }, { "id": "data_header.from_user", "name": "SIP From user", "type": "string", "index": "none", "form_type": "input", "position": 6, "skip": false, "hide": false }, { "id": "data_header.to_user", "name": "SIP To user", "type": "string", "index": "none", "form_type": "input", "position": 7, "skip": false, "hide": false }, { "id": "data_header.user_agent", "name": "User Agent", "type": "string", "index": "none", "form_type": "input", "position": 8, "skip": false, "hide": true }, { "id": "protocol_header.srcIp", "name": "Source IP", "type": "string", "index": "none", "form_type": "input", "position": 8, "skip": false, "hide": false }, { "id": "protocol_header.srcPort", "name": "Src Port", "type": "integer", "index": "none", "form_type": "input", "position": 9, "skip": false, "hide": false }, { "id": "protocol_header.dstIp", "name": "Destination IP", "type": "string", "index": "none", "form_type": "input", "position": 10, "skip": false, "hide": false }, { "id": "protocol_header.dstPort", "name": "Dst Port", "type": "integer", "index": "none", "form_type": "input", "position": 11, "skip": false, "hide": false }, { "id": "protocol_header.timeSeconds", "name": "Timeseconds", "type": "integer", "index": "none", "form_type": "input", "position": 12, "skip": false, "hide": true }, { "id": "protocol_header.timeUseconds", "name": "Usecond time", "type": "integer", "index": "none", "form_type": "input", "position": 13, "skip": false, "hide": true }, { "id": "protocol_header.payloadType", "name": "Payload type", "type": "integer", "index": "none", "form_type": "input", "position": 14, "skip": false, "hide": true }, { "id": "protocol_header.protocolFamily", "name": "Proto Family", "type": "integer", "index": "none", "form_type": "input", "position": 15, "skip": false, "hide": true }, { "id": "protocol_header.protocol", "name": "Protocol Type", "type": "integer", "index": "none", "form_type": "input", "position": 16, "skip": false, "hide": true }, { "id": "protocol_header.captureId", "name": "Capture ID", "type": "integer", "index": "none", "form_type": "input", "position": 17, "skip": false, "hide": true }, { "id": "protocol_header.capturePass", "name": "Capture Pass", "type": "string", "index": "none", "form_type": "input", "position": 18, "skip": true, "hide": true }, { "id": "data_header.cseq", "name": "SIP Cseq", "type": "string", "index": "none", "form_type": "input", "position": 19, "skip": false, "hide": true }, { "id": "data_header.from_tag", "name": "SIP From tag", "type": "string", "index": "none", "form_type": "input", "position": 20, "skip": false, "hide": true }, { "id": "data_header.protocol", "name": "SIP Protocol", "type": "string", "index": "none", "form_type": "input", "position": 21, "skip": false, "hide": true }, { "id": "raw", "name": "SIP RAW", "type": "string", "index": "none", "form_type": "input", "position": 22, "skip": false, "hide": true }, { "id": "profile", "name": "Profile", "type": "string", "index": "none", "form_type": "select", "form_default": [ "call", "registration", "default" ], "position": 23, "skip": false, "hide": true, "profile": true }, { "id": "node", "name": "Node", "type": "string", "index": "none", "form_type": "multiselect", "form_default": [ { "value": "localnode", "name": "Local node" } ], "_form_api": "/database/node/list", "system_param": true, "mapping": "param.location.node", "position": 23, "skip": true, "hide": true }, { "id": "data_header.X-CID", "name": "X-CID", "type": "string", "index": "none", "form_type": "input", "position": 25, "skip": false, "hide": true }, { "id": "data_header.XCallID", "name": "XCallID", "type": "string", "index": "none", "form_type": "input", "position": 26, "skip": false, "hide": true } ]

Also if there is something that I can get FreePBX to hardcode that would make it work out of the box with zero config. I'm all ears. I'll submit a ticket for an enhancement request and see if I can get others to join the cause. Also if you have a purchasable package that has all this configured and ready to go. I'd purchase that as well.

github-actions[bot] commented 1 year ago

Your report is appreciated. Please star this repository to motivate its developers! :star:

adubovikov commented 1 year ago

can you confirm that you see the injected X-Cid header in your outgoing INVITE ?

adubovikov commented 1 month ago

come back once you will have more info.