VoipStreamReceiver

Package: inet.applications.voipstream

simple module VoipStreamReceiver

VoipStreamReceiver listens on a UDP port and expects to receive VoIP packets on it. The received voice is then saved into a result audio file that can be compared with the original for further evaluation. VoIP packets are numbered, and out-of-order packets are discarded (the corresponding voice interval will be recorded as silence into the file). VoIP packets that miss their deadlines will similarly be discarded. It is assumed that the audio is played back with a delay (by default 20ms), which allows some jitter for the incoming packets. The resulting audio file is closed when the simulation completes (i.e., in the OMNeT++ finish() function). Only one voice session (“call”) may be underway at a time.

inet.applications.voipstream.VoipStreamReceiverVoipStreamReceiversimple

Inheritance diagram

Extends

Name

Type

Description

SimpleModule

simple module

Base module for all INET simple modules.

Parameters

Name

Type

Default value

Description

displayStringTextFormat

string

“”

Determines the text that is written on top of the submodule, supports displaying pars, watches, and module-specific information

localPort

int

playoutDelay

double

20ms

resultFile

string

Properties

Name

Value

Description

class

VoipStreamReceiver

display

i=block/arrival

Gates

Name

Direction

Size

Description

socketIn

input

socketOut

output

Signals

Name

Type

Unit

Description

connState

long

1=open, -1=close

delay

simtime_t

Total time lag of voice transmission

lostPackets

long

lostSamples

long

packetDropped

inet::Packet

packetHasVoice

long

1=yes, 0=no

packetReceived

inet::Packet

Expected type=VoipStreamPacket

Statistics

Name

Title

Source

Record

Unit

Interpolation Mode

Description

delay

delay

vector,histogram

s

none

dropPk

packets dropped

packetDropped

count,”sum(packetBytes)”,”vector(packetBytes)”

none

lostPackets

lost packets

vector,stats

none

lostSamples

lost samples

vector,stats

none

numActiveSessions

number of active sessions

warmup(sum(connState))

max,timeavg,vector

sample-hold

numSessions

total number of sessions

sum(connState+1)/2

last

packetHasVoice

voice or silence packet

mean,vector

none

packetReceived

packets received

packetReceived

count,”sum(packetBytes)”,”vector(packetBytes)”

none

Source code

//
// VoipStreamReceiver listens on a UDP port and expects to receive VoIP packets on
// it. The received voice is then saved into a result audio file that can be
// compared with the original for further evaluation. VoIP packets are
// numbered, and out-of-order packets are discarded (the corresponding voice
// interval will be recorded as silence into the file). VoIP packets that miss
// their deadlines will similarly be discarded. It is assumed that the audio is
// played back with a delay (by default 20ms), which allows some jitter for the
// incoming packets. The resulting audio file is closed when the simulation
// completes (i.e., in the OMNeT++ finish() function). Only one voice session
// ("call") may be underway at a time.
//
simple VoipStreamReceiver extends SimpleModule like IApp
{
    parameters:
        @class(VoipStreamReceiver);
        int localPort;
        double playoutDelay @unit(s) = default(20ms);
        string resultFile;
        @signal[packetReceived](type=inet::Packet); // Expected type=VoipStreamPacket
        @signal[packetDropped](type=inet::Packet);
        @signal[lostSamples](type=long);
        @signal[lostPackets](type=long);
        @signal[packetHasVoice](type=long);  // 1=yes, 0=no
        @signal[connState](type=long);  // 1=open, -1=close
        @signal[delay](type=simtime_t);  // Total time lag of voice transmission
        @statistic[packetReceived](title="packets received"; source=packetReceived; record=count,"sum(packetBytes)","vector(packetBytes)"; interpolationmode=none);
        @statistic[dropPk](title="packets dropped"; source=packetDropped; record=count,"sum(packetBytes)","vector(packetBytes)"; interpolationmode=none);
        @statistic[lostSamples](title="lost samples"; interpolationmode=none; record=vector,stats);
        @statistic[lostPackets](title="lost packets"; interpolationmode=none; record=vector,stats);
        @statistic[packetHasVoice](title="voice or silence packet"; record=mean,vector; interpolationmode=none);
        @statistic[delay](title="delay"; unit=s; record=vector,histogram; interpolationmode=none);
        @statistic[numActiveSessions](title="number of active sessions"; source=warmup(sum(connState)); record=max,timeavg,vector; interpolationmode=sample-hold; autoWarmupFilter=false);
        @statistic[numSessions](title="total number of sessions"; source="sum(connState+1)/2"; record=last);
        @display("i=block/arrival");
    gates:
        input socketIn @labels(UdpCommand/up);
        output socketOut @labels(UdpCommand/down);
}

File: src/inet/applications/voipstream/VoipStreamReceiver.ned