MP_Addon_Calls_Callback::call( $user_phone, string $message, string $admin_phone, int|string $post_id )

Call to admin about new Lead.


Parameters Parameters

$userPhone

(string) (Required) user phone number

$message

(string) (Required) message

$admin_phone

(string) (Required) admin phone number

$post_id

(int|string) (Required) post id


Top ↑

Source Source

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

	protected function call( $user_phone, $message, $admin_phone, $post_id ) {

		$phone = ! empty( $admin_phone ) ? $admin_phone : get_option( MortgagePlatform::$prefix . 'sms' )['number_sms_to_admin'];

		$client = new Client( $this->account_sid, $this->auth_token );

		$twiml = $this->create_twiml( $user_phone, $message, $post_id );

		file_put_contents( plugin_dir_path( __FILE__ ) . 'templates/voice_message.xml', $twiml, LOCK_EX );

		$client->calls->create(
			$phone,
			$this->twilio_number,
			array(
				'url' => plugins_url( 'templates/voice_message.xml', __FILE__ ),
			)
		);
	}

Top ↑

Changelog Changelog

Changelog
Version Description
1.0.0 Introduced.