Type: PhoneCall

Back to types index

This is an object of type \danog\MadelineProto\VoIP.

It will only be available if the php-libtgvoip extension is installed, see the main docs for an easy installation script.

You MUST know OOP to use this class.

Constants:

VoIPController states (these constants are incrementing integers, thus can be compared like numbers):

VoIPController errors:

Network types (these constants are incrementing integers, thus can be compared like numbers):

Data saving modes (these constants are incrementing integers, thus can be compared like numbers):

Proxy settings (these constants are incrementing integers, thus can be compared like numbers):

Audio states (these constants are incrementing integers, thus can be compared like numbers):

Call states (these constants are incrementing integers, thus can be compared like numbers):

Methods:

Accepts two optional parameters:

$reason - can be a PhoneCallDiscardReason object (defaults to a phoneCallDiscardReasonDisconnect object).

$rating - Can be an array that must contain a rating, and a comment (["rating" => 5, "comment" => "MadelineProto is very easy to use!"]). Defaults to an empty array.

MadelineProto works using raw signed PCM audio, internally split in packets with sampleNumber samples.

The audio configuration is an array structured in the following way:

[
    "bitsPerSample" => int. // Bits in each PCM sample
    "sampleRate" => int, // PCM sample rate
    "channels" => int, // Number of PCM audio channels
    "sampleNumber" => int, // The audio data is internally split in packets, each having this number of samples
    "samplePeriod" => double, // PCM sample period in seconds, useful if you want to generate audio data manually
    "writePeriod" => double, // PCM write period in seconds (samplePeriod*sampleNumber), useful if you want to generate audio data manually
    "samplesSize" => int, // The audio data is internally split in packets, each having this number of bytes (sampleNumber*bitsPerSample/8)
    "level" => int // idk
];

MadelineProto works using raw signed PCM audio, internally split in packets with sampleNumber samples.

The audio configuration is an array structured in the following way:

[
    "bitsPerSample" => int. // Bits in each PCM sample
    "sampleRate" => int, // PCM sample rate
    "channels" => int, // Number of PCM audio channels
    "sampleNumber" => int, // The audio data is internally split in packets, each having this number of samples
    "samplePeriod" => double, // PCM sample period in seconds, useful if you want to generate audio data manually
    "writePeriod" => double, // PCM write period in seconds (samplePeriod*sampleNumber), useful if you want to generate audio data manually
    "samplesSize" => int, // The audio data is internally split in packets, each having this number of bytes (sampleNumber*bitsPerSample/8)
];

Properties:

Easy as pie:

$call->storage["pony"] = "fluttershy";
var_dump($call->storage["pony"]); // fluttershy

Note: when modifying this property, never overwrite the previous values. Always either modify the values of the array separately like showed above, or use array_merge.

You can only modify the data saving mode, the network type, the logging file path and the stats dump file path:

Example:

$call->configuration["log_file_path"] = "logs".$call->getOtherID().".log"; // Default is /dev/null
$call->configuration["stats_dump_file_path"] = "stats".$call->getOtherID().".log"; // Default is /dev/null
$call->configuration["network_type"] = \danog\MadelineProto\VoIP::NET_TYPE_WIFI; // Default is NET_TYPE_ETHERNET
$call->configuration["data_saving"] = \danog\MadelineProto\VoIP::DATA_SAVING_MOBILE; // Default is DATA_SAVING_NEVER
$call->parseConfig(); // Always call this after changing settings

Note: when modifying this property, never overwrite the previous values. Always either modify the values of the array separately like showed above, or use array_merge.

After modifying it, you must always parse the new configuration with a call to parseConfig.