Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make HEP network setting configurable #191

Closed
hamidrhashmi opened this issue May 8, 2024 · 1 comment
Closed

Make HEP network setting configurable #191

hamidrhashmi opened this issue May 8, 2024 · 1 comment

Comments

@hamidrhashmi
Copy link

I am trying to send freeswitch CDRs as HEP Log to Homer. But I am unable to set HEP SRC IP and SRC Port with respect to IPs in the CDRs so That I can see Log Correclty in the flow.

Pastash Configuration

input {
      file {
        path => "/home/hrhashmi/FREESWITCH/var/log/freeswitch/cdr-csv/Master.csv"
      }
    }
 filter {
   csv {
    headers => ['caller_id_name', 'caller_id_number', 'source_ip', 'source_port', 'destination_number', 'context', 'start_stamp', 'answer_stamp', 'end_stamp', 'duration', 'billsec', 'hangup_cause', 'uuid', 'bleg_uuid', 'accountcode','codec','bleg_codec']
 }
  compute_field {
    field => correlation_id
    value => "#{uuid}"
  }
  compute_field {
    field => s_ip
    value => "#{source_ip}"
  }
  compute_field {
    field => s_port
    value => "#{source_port}"
  }
}
    output {
      hep {
        host => debian10.hbvoice.local
        port => 9063
        hep_id => 2022
        hep_type => 100
        hep_cid => '#{correlation_id}'
        hep_protocol => 17
        src_ip => '#{s_ip}'
        src_port => '#{s_port}'
        dst_ip => 192.168.0.167
      }
      stdout{}
    }

Pasttash Logs (it does not print hep packet.)


[Wed, 08 May 2024 11:37:05 GMT] DEBUG Event received for /home/hrhashmi/FREESWITCH/var/log/freeswitch/cdr-csv/Master.csv : change Master.csv
[Wed, 08 May 2024 11:37:05 GMT] DEBUG File /home/hrhashmi/FREESWITCH/var/log/freeswitch/cdr-csv/Master.csv changed
[Wed, 08 May 2024 11:37:05 GMT] DEBUG Launch reading on 20 , current_index 2832072
[Wed, 08 May 2024 11:37:05 GMT] DEBUG Read from 20 : 212 bytes
[Wed, 08 May 2024 11:37:05 GMT] DEBUG CSV Data! Row {
  caller_id_name: 'Hamid R. Hashmi',
  caller_id_number: '+923009682285',
  source_ip: '192.168.0.110',
  source_port: '64874',
  destination_number: '+97123456789',
  context: 'public',
  start_stamp: '2024-05-08 16:37:01',
  answer_stamp: '',
  end_stamp: '2024-05-08 16:37:05',
  duration: '4',
  billsec: '0',
  hangup_cause: 'ORIGINATOR_CANCEL',
  uuid: '0d51a83875da4ea38dcbc1328191ddbe',
  bleg_uuid: '',
  accountcode: '',
  codec: 'PCMA',
  bleg_codec: 'PCMA'
}
[STDOUT] {
  "caller_id_name": "Hamid R. Hashmi",
  "caller_id_number": "+923009682285",
  "source_ip": "192.168.0.110",
  "source_port": "64874",
  "destination_number": "+97123456789",
  "context": "public",
  "start_stamp": "2024-05-08 16:37:01",
  "answer_stamp": "",
  "end_stamp": "2024-05-08 16:37:05",
  "duration": "4",
  "billsec": "0",
  "hangup_cause": "ORIGINATOR_CANCEL",
  "uuid": "0d51a83875da4ea38dcbc1328191ddbe",
  "bleg_uuid": "",
  "accountcode": "",
  "codec": "PCMA",
  "bleg_codec": "PCMA",
  "correlation_id": "0d51a83875da4ea38dcbc1328191ddbe",
  "s_ip": "192.168.0.110",
  "s_port": "64874"
}

I can see a comment here which says that the Network part is to be Done.

@lmangani
Copy link
Member

lmangani commented May 8, 2024

s_ip and s_port will have no effect. The correct fields to force IPs in the HEP output are srcIp, srcPort, dstIp, dstPort

		// Build HEP3 w/ null network parameters
		hep_proto.srcIp = data.srcIp || this.src_ip;
		hep_proto.dstIp = data.dstIp || this.dst_ip;
		hep_proto.srcPort = data.srcPort || this.src_port;
		hep_proto.dstPort = data.dstPort || this.dst_port;

Full logic in the source code

@lmangani lmangani closed this as completed May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants