Package: inet.applications.voipstream
VoipStreamSender
simple moduleVoipStreamSender accepts an audio file and a destination IP address/port as input, and will transmit the file's contents as voice traffic over UDP n times (by default once). For transmission, the audio is resampled at the specified frequency and depth, and encoded with the specified codec at the specified bit rate, and chopped into packets that each carry specified number of milliseconds of voice. Those values come from module parameters. Packets that are all silence (all samples are below a given threshold in absolute value) are transmitted as special "silence" packets. The module does not simulate any particular VoIP protocol (e.g. RTP), but instead accepts a "header size" parameter that can be set accordingly.
Inheritance diagram
The following diagram shows inheritance relationships for this type. Unresolved types are missing from the diagram.
Parameters
Name | Type | Default value | Description |
---|---|---|---|
localPort | int | ||
destPort | int | ||
destAddress | string | ||
startTime | double | 0s | |
voipHeaderSize | int | ||
voipSilenceThreshold | int | ||
sampleRate | int | 8000Hz | |
codec | string | "g726" |
used by ffmpeg::avcodec_find_encoder_by_name() |
compressedBitRate | int | 40kbps | |
packetTimeLength | double | 20ms | |
soundFile | string |
file name of input audio file |
|
repeatCount | int | 1 | |
traceFileName | string | "" |
file name to save output stream (wav), OFF when empty |
timeToLive | int | -1 |
if not -1, set the TTL (IPv4) or Hop Limit (IPv6) field of sent packets to this value |
dscp | int | -1 |
if not -1, set the DSCP field (on IPv4/IPv6) of sent packets to this value |
tos | int | -1 |
if not -1, set the Type Of Service (IPv4) / Traffic Class (IPv6) field of sent packets to this value |
Properties
Name | Value | Description |
---|---|---|
display | i=block/departure |
Gates
Name | Direction | Size | Description |
---|---|---|---|
socketIn | input | ||
socketOut | output |
Signals
Name | Type | Unit |
---|---|---|
packetSent | inet::Packet |
Statistics
Name | Title | Source | Record | Unit | Interpolation Mode |
---|---|---|---|---|---|
packetSent | packets sent | packetSent | count, sum(packetBytes), vector(packetBytes) | none |
Scheduled messages (observed)
msg | kind | ctrl | tags | msgname | context |
---|---|---|---|---|---|
Packet | 0 | SILENCE | |||
Packet | 0 | VOICE | |||
omnetpp::cMessage | 0 | sendVoIP |
Direct method calls (observed)
call to | function | info |
---|---|---|
MessageDispatcher | inet::MessageDispatcher::arrived | arrived |
Outgoing messages (observed)
gate | msg | kind | ctrl | destModule | tags |
---|---|---|---|---|---|
socketOut | Packet | 0 (UdpCommandCode::UDP_C_DATA) | Udp | DispatchProtocolReq, L3AddressReq, L4PortReq, SocketReq | |
socketOut | Request | 1 (UdpCommandCode::UDP_C_BIND) | UdpBindCommand | Udp | DispatchProtocolReq, SocketReq |
Packet operations (observed)
chunkType | packetAction |
---|---|
BytesChunk | insertAtFront |
VoipStreamPacket | insertAtFront |
Shared Tagging operations (observed)
tagType | tagAction |
---|---|
DispatchProtocolReq | addTagIfAbsent |
L3AddressReq | addTagIfAbsent |
L4PortReq | addTagIfAbsent |
SocketReq | addTagIfAbsent |
Tagging operations (observed)
tagType | tagAction |
---|---|
inet::Ipv4InterfaceData | findTag |
Source code
// // VoipStreamSender accepts an audio file and a destination IP address/port as // input, and will transmit the file's contents as voice traffic over UDP n // times (by default once). For transmission, the audio is resampled at the // specified frequency and depth, and encoded with the specified codec at the // specified bit rate, and chopped into packets that each carry specified // number of milliseconds of voice. Those values come from module parameters. // Packets that are all silence (all samples are below a given threshold in // absolute value) are transmitted as special "silence" packets. The module // does not simulate any particular VoIP protocol (e.g. RTP), but instead // accepts a "header size" parameter that can be set accordingly. // simple VoipStreamSender like IApp { parameters: int localPort; int destPort; string destAddress; double startTime @unit(s) = default(0s); int voipHeaderSize @unit(B); int voipSilenceThreshold; int sampleRate @unit(Hz) = default(8000Hz); string codec = default("g726"); // used by ffmpeg::avcodec_find_encoder_by_name() int compressedBitRate @unit(bps) = default(40kbps); double packetTimeLength @unit(s) = default(20ms); string soundFile; // file name of input audio file int repeatCount = default(1); string traceFileName = default(""); // file name to save output stream (wav), OFF when empty int timeToLive = default(-1); // if not -1, set the TTL (IPv4) or Hop Limit (IPv6) field of sent packets to this value int dscp = default(-1); // if not -1, set the DSCP field (on IPv4/IPv6) of sent packets to this value int tos = default(-1); // if not -1, set the Type Of Service (IPv4) / Traffic Class (IPv6) field of sent packets to this value @signal[packetSent](type=inet::Packet); // TODO first chunk is VoipStreamPacket @statistic[packetSent](title="packets sent"; source=packetSent; record=count,"sum(packetBytes)","vector(packetBytes)"; interpolationmode=none); @display("i=block/departure"); gates: input socketIn @labels(UdpControlInfo/up); output socketOut @labels(UdpControlInfo/down); }File: src/inet/applications/voipstream/VoipStreamSender.ned