sipcapture / homer

HOMER - 100% Open-Source SIP, VoIP, RTC Packet Capture & Monitoring
https://sipcapture.org
GNU Affero General Public License v3.0
1.64k stars 242 forks source link

vq-rtcpxr callid regex in kamailio routing script issue #231

Closed 00Asgaroth00 closed 6 years ago

00Asgaroth00 commented 7 years ago

Hi,

While testing RTCP-XR reports I noticed that the callid regex in the kamailio routing logic was not extracting the callid from the message body, and therefor inserting the entire message body into the correlation_id column in the report_capture table.

The line that has the issue is:

$var(callid) = $(rb{re.subst,/.*CallID:([0-9A-Za-z@-_\.]{5,120}).*$/\1/s});

To correct this, the "-" character needs to be escaped in the character class block (between the square brackets), it also, incidentally, needs to be placed at the end of the character class block.

I added the option of zero or more spaces between the "CallID:" and its value, as the Pollycom phones don't have spaces between the "header" and "value" fields, where the Panasonic phones do have a space.

I modified it as follows:

$var(callid) = $(rb{re.subst,/.*CallID:\s*(([0-9A-Za-z@_\.\-]{5,120})).*$/\1/s});

As an example, before the modification above, the data for correlation_id would be as follows:

mysql> select correlation_id from report_capture;
| correlation_id|
| VQSessionReport
LocalMetrics:
TimeStamps:START=2017-05-24T17:50:25Z STOP=2017-05-24T17:51:15Z
SessionDesc:PT=8 PPS=50 SSUP=off
CallID:6de0bb66696e7064448f50da66092553
ToID:<sip:1234567890@test.com>
FromID:"Line 1" <sip:test@test.com>
LocalAddr:IP=1.1.1.1 PORT=2286 SSRC=1635422771
RemoteAddr:IP=2.2.2.2 PORT=24350 SSRC=690665368
JitterBuffer:JBA=3 JBR=5 JBN=80 JBM=120 JBX=160
PacketLoss:NLR=0.0 JDR=0.0
BurstGapLoss:BLD=0.0 BD=0 GLD=0.0 GD=50120 GMIN=16
Delay:RTD=0 ESD=106 IAJ=3
Signal:RERL=127
QualityEst:RLQ=93 RCQ=91 MOSLQ=4.1 MOSCQ=4.1
DialogID:6de0bb66696e7064448f50da66092553;to-tag=e5NSUajmDNZep;from-tag=E18870F5-8F3B41EA
 |

After the modification:

mysql> select correlation_id from report_capture;
| correlation_id|
|6c736651-48e0b1204d6efb2f8e9e0080f0808080@KX-TGP600UK|

The modification was made on the kamailio 4.x configuration file (line 271). Kamailio version in use is from the installer script for centos 7 (kamailio version 4.4.5).

lmangani commented 7 years ago

Could you submit a PR with the change for review?

00Asgaroth00 commented 7 years ago

OK, I'll try to create a PR, just watching some tutorials on how to do this :)

lmangani commented 7 years ago

Great chance to learn :+1: It's easier than it sounds and for a case such as yours, can be done entirely from the Web UI of Github.

1) Just go to the repository of interest, and click the "fork" button at the top right of the screen - this will create a copy in your repository (username/project)

2) At this point, locate the file you want to modify from the UI, and apply the required change.

3) This change will only exist in your Project fork at this stage. To "propose" it to the original repository for review and acceptance, you will create a PR or PULL REQUEST from your repository or the original.

That's it! I do not have a specific guide ready, but this link seems comprehensive enough: https://help.github.com/articles/creating-a-pull-request-from-a-fork/

Thanks!

00Asgaroth00 commented 7 years ago

Thanks for the tips, I just opened a pull request against sipcapture/homer-config, hopefully it looks okay.

lmangani commented 6 years ago

Please comment to reopen if needed. Thanks for your report!