MP_Addon_Calls_Callback::press_key_one( string $post_id,  $user_phone, string $message )

Press key 1.


Parameters Parameters

$post_id

(string) (Required) post id.

$userPhone

(string) (Required) user phone.

$message

(string) (Required) text message.


Top ↑

Source Source

File: calculator-calls-add-on/inc/MP_Addon_Calls_Callback.php

	protected function press_key_one( $post_id, $user_phone, $message ) {

		$response    = new VoiceResponse();
		$name        = __( 'The lead name ', 'CalculatorsCallsAddon' ) . get_post_meta( $post_id, MortgagePlatform::$prefix . 'lead_first_name', true ) . ' ' . get_post_meta( $post_id, MortgagePlatform::$prefix . 'lead_second_name', true );
		$yearofbirth = __( 'The lead year of birth ', 'CalculatorsCallsAddon' ) . get_post_meta( $post_id, MortgagePlatform::$prefix . 'lead_yearofbirth', true );
		$user_calc   = array_reverse( get_post_meta( $post_id, MortgagePlatform::$prefix . 'lead_searches' ) )[0];
		$loan_amount = __( 'The lead loan amount ', 'CalculatorsCallsAddon' ) . $user_calc['loanAmount'];

		$body = $name . $loan_amount . $yearofbirth;
		$response->say( $body );

		$response->pause( array( 'length' => 3 ) );
		$gather = $response->gather(
			array(
				'input'     => 'dtmf',
				'timeout'   => 20,
				'numDigits' => '1',
				'action'    => admin_url( 'admin-ajax.php' ) . '?action=twilio_call&phone=' . $user_phone . '&postid=' . $post_id,
				'method'    => 'POST',
			)
		);
		$gather->say( $message );

	}

Top ↑

Changelog Changelog

Changelog
Version Description
1.0.0 Introduced.