Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When handling VoipScript parameters, VoIP Drupal processes strings that start with the ^ symbol as expressions to be evaluated. For instance, in the following example,
// get the report
$script->addSet('forecast_result', '^_get_forecast(%zip_code)');
// say the weather report
$script->addSay('%forecast_result');
The variable forecast_result is set with the result of the function _get_forecast().
The same mechanism can be used to call specialized callback functions to process data collected during call execution:
$prompt = t("Please record your message after the beep. When done, press the pound key.");
$timeout = 5;
$end_key = '#';
$script->addRecord($prompt, $timeout, $end_key);
$script->addSay(t('About to start processing the recorded file.'));
$script->addSet('callback_result',
'^_record_callback(%call_id, %recording_url, %recording_duration)');
$args = array('@result' => '%callback_result');
$script->addSay(t('The callback returned: @result', $args));