diff --git a/include/config/config.xml b/include/config/config.xml
index 7e1bdc5e5..58d50ccf6 100755
--- a/include/config/config.xml
+++ b/include/config/config.xml
@@ -159,7 +159,7 @@
+18003514161
+18003514161
- _PHONE_
+ ***REMOVED***
male
Hello. This is crunchbutton,
5
diff --git a/include/controllers/default/crunchbutton/api/order/index.php b/include/controllers/default/crunchbutton/api/order/index.php
index ed57c24cc..0317fe4ec 100644
--- a/include/controllers/default/crunchbutton/api/order/index.php
+++ b/include/controllers/default/crunchbutton/api/order/index.php
@@ -44,7 +44,7 @@ class Controller_api_order extends Crunchbutton_Controller_Rest {
Log::debug([
'order' => $order->id_order,
'action' => '/sayorder (accepted)',
- 'host' => $_SERVER['__HTTP_HOST'],
+ 'host' => $_SERVER['__HTTP_HOST_CALLBACK'],
'type' => 'notification'
]);
@@ -95,7 +95,7 @@ class Controller_api_order extends Crunchbutton_Controller_Rest {
Log::debug([
'order' => $order->id_order,
'action' => '/sayorderonly: 2: CONFIRMED',
- 'host' => $_SERVER['__HTTP_HOST'],
+ 'host' => $_SERVER['__HTTP_HOST_CALLBACK'],
'type' => 'notification'
]);
echo '';
@@ -139,7 +139,7 @@ class Controller_api_order extends Crunchbutton_Controller_Rest {
Log::debug([
'order' => $order->id_order,
'action' => '/doconfirm: 1: CONFIRMED',
- 'host' => $_SERVER['__HTTP_HOST'],
+ 'host' => $_SERVER['__HTTP_HOST_CALLBACK'],
'type' => 'notification'
]);
echo '';
@@ -158,7 +158,7 @@ class Controller_api_order extends Crunchbutton_Controller_Rest {
Log::debug([
'order' => $order->id_order,
'action' => 'RESEND',
- 'host' => $_SERVER['__HTTP_HOST'],
+ 'host' => $_SERVER['__HTTP_HOST_CALLBACK'],
'type' => 'notification'
]);
diff --git a/include/library/Crunchbutton/App.php b/include/library/Crunchbutton/App.php
index 22b6e75a1..cdb111e74 100755
--- a/include/library/Crunchbutton/App.php
+++ b/include/library/Crunchbutton/App.php
@@ -41,6 +41,8 @@ class Crunchbutton_App extends Cana_App {
break;
}
+ $_SERVER['__HTTP_HOST_CALLBACK'] = $_SERVER['__HTTP_HOST'];
+
switch ($_SERVER['__HTTP_HOST']) {
case 'crunchbutton.localhost':
case 'wenzel.localhost':
diff --git a/include/library/Crunchbutton/Notification.php b/include/library/Crunchbutton/Notification.php
index 52d6e4c40..2861db7bb 100644
--- a/include/library/Crunchbutton/Notification.php
+++ b/include/library/Crunchbutton/Notification.php
@@ -82,7 +82,7 @@ class Crunchbutton_Notification extends Cana_Table
'order' => $order->id_order,
'action' => 'send order call',
'num' => $num,
- 'host' => $_SERVER['__HTTP_HOST'],
+ 'host' => $_SERVER['__HTTP_HOST_CALLBACK'],
'callback' => $callback,
'type' => 'notification'
]);
@@ -98,9 +98,9 @@ class Crunchbutton_Notification extends Cana_Table
$call = $twilio->account->calls->create(
c::config()->twilio->{$env}->outgoingRestaurant,
'+1'.$num,
- 'http://'.$_SERVER['__HTTP_HOST'].'/api/order/'.$order->id_order.'/say?id_notification='.$this->id_notification,
+ 'http://'.$_SERVER['__HTTP_HOST_CALLBACK'].'/api/order/'.$order->id_order.'/say?id_notification='.$this->id_notification,
[
- 'StatusCallback' => 'http://'.$_SERVER['__HTTP_HOST'].'/api/notification/'.$log->id_notification_log.'/callback'
+ 'StatusCallback' => 'http://'.$_SERVER['__HTTP_HOST_CALLBACK'].'/api/notification/'.$log->id_notification_log.'/callback'
// 'IfMachine' => 'Hangup'
]
);
diff --git a/include/library/Crunchbutton/Notification/Log.php b/include/library/Crunchbutton/Notification/Log.php
index 3fa101433..3de75e7ca 100644
--- a/include/library/Crunchbutton/Notification/Log.php
+++ b/include/library/Crunchbutton/Notification/Log.php
@@ -34,7 +34,7 @@ class Crunchbutton_Notification_Log extends Cana_Table {
'customer_phone' => $this->order()->phone,
'customer_name' => $this->order()->name,
'action' => '#'.$this->id_order.' MAX CB for '.$this->order()->restaurant()->name."\nR# ".$this->order()->restaurant()->phone()."\n C# ".$this->order()->phone(),
- 'host' => $_SERVER['__HTTP_HOST'],
+ 'host' => $_SERVER['__HTTP_HOST_CALLBACK'],
'type' => 'notification'
]);
@@ -74,7 +74,7 @@ class Crunchbutton_Notification_Log extends Cana_Table {
'customer_phone' => $this->order()->phone,
'customer_name' => $this->order()->name,
'action' => '#'.$this->id_order.' MAX CONFIRM CB for '.$this->order()->restaurant()->name."\nR# ".$this->order()->restaurant()->phone()."\nC# ".$this->order()->phone(),
- 'host' => $_SERVER['__HTTP_HOST'],
+ 'host' => $_SERVER['__HTTP_HOST_CALLBACK'],
'type' => 'notification'
]);
} else {
diff --git a/include/library/Crunchbutton/Order.php b/include/library/Crunchbutton/Order.php
index 390b13443..b46437551 100644
--- a/include/library/Crunchbutton/Order.php
+++ b/include/library/Crunchbutton/Order.php
@@ -508,7 +508,7 @@ class Crunchbutton_Order extends Cana_Table {
'order' => $this->id_order,
'confirmed' =>$this->confirmed,
'action' => 'check confirmed',
- 'host' => $_SERVER['__HTTP_HOST'],
+ 'host' => $_SERVER['__HTTP_HOST_CALLBACK'],
'type' => 'notification'
]);
@@ -518,7 +518,7 @@ class Crunchbutton_Order extends Cana_Table {
'order' => $this->id_order,
'count' => $nl->count(),
'action' => 'confirmation call already in process',
- 'host' => $_SERVER['__HTTP_HOST'],
+ 'host' => $_SERVER['__HTTP_HOST_CALLBACK'],
'type' => 'notification'
]);
return;
@@ -527,7 +527,7 @@ class Crunchbutton_Order extends Cana_Table {
'order' => $this->id_order,
'count' => $nl->count(),
'action' => 'starting new confirmation call',
- 'host' => $_SERVER['__HTTP_HOST'],
+ 'host' => $_SERVER['__HTTP_HOST_CALLBACK'],
'type' => 'notification'
]);
}
@@ -544,16 +544,16 @@ class Crunchbutton_Order extends Cana_Table {
/*
$num = '_PHONE_';
- $_SERVER['____HTTP_HOST'] = 'dev.crunchr.co';
+ $_SERVER['____HTTP_HOST_CALLBACK'] = 'dev.crunchr.co';
*/
- $callback = 'http://'.$_SERVER['__HTTP_HOST'].'/api/notification/'.$log->id_notification_log.'/confirm';
+ $callback = 'http://'.$_SERVER['__HTTP_HOST_CALLBACK'].'/api/notification/'.$log->id_notification_log.'/confirm';
Log::debug([
'order' => $this->id_order,
'action' => 'dial confirm call',
'num' => $num,
- 'host' => $_SERVER['__HTTP_HOST'],
+ 'host' => $_SERVER['__HTTP_HOST_CALLBACK'],
'callback' => $callback,
'type' => 'notification'
]);
@@ -562,7 +562,7 @@ class Crunchbutton_Order extends Cana_Table {
$call = $twilio->account->calls->create(
c::config()->twilio->{$env}->outgoingRestaurant,
'+1'.$num,
- 'http://'.$_SERVER['__HTTP_HOST'].'/api/order/'.$this->id_order.'/doconfirm',
+ 'http://'.$_SERVER['__HTTP_HOST_CALLBACK'].'/api/order/'.$this->id_order.'/doconfirm',
[
'StatusCallback' => $callback
// 'IfMachine' => 'Hangup'
@@ -613,10 +613,10 @@ class Crunchbutton_Order extends Cana_Table {
public function que() {
$order = $this;
- Cana::timeout(function() use($order) {
+ //Cana::timeout(function() use($order) {
/* @var $order Crunchbutton_Order */
$order->notify();
- });
+ // });
if (!$this->restaurant()->confirmation) {
c::timeout(function() use($order) {
diff --git a/include/library/Crunchbutton/Phaxio.php b/include/library/Crunchbutton/Phaxio.php
index 064ffc760..ba77bbe58 100644
--- a/include/library/Crunchbutton/Phaxio.php
+++ b/include/library/Crunchbutton/Phaxio.php
@@ -8,7 +8,7 @@ class Crunchbutton_Phaxio {
.'-F "to='.$params['to'].'" '
.'-F "filename=@'.$params['file'].'" ';
if ($params['id_notification_log']) {
- $cmd .= '-F "callback_url=http://'.$_SERVER['__HTTP_HOST'].'/api/notification/'.$params['id_notification_log'].'/callback" ';
+ $cmd .= '-F "callback_url=http://'.$_SERVER['__HTTP_HOST_CALLBACK'].'/api/notification/'.$params['id_notification_log'].'/callback" ';
}
$cmd .= '-F "api_key='.c::config()->phaxio->{$env}->key.'" '
.'-F "api_secret='.c::config()->phaxio->{$env}->secret.'"';