Browse files

Normalized phone numbers.

  • Loading branch information...
1 parent a5133b8 commit 38dece7b2d50afbcff59f9f6e23cf707eeb40583 @chadsmith committed Jun 24, 2010
Showing with 10 additions and 47 deletions.
  1. +10 −47 applets/track/twiml.php
View
57 applets/track/twiml.php
@@ -5,58 +5,21 @@
$next = AppletInstance::getDropZoneUrl('next');
if(AppletInstance::getFlowType() == 'voice'){
- $url = str_replace(
- array(
- '%caller%',
- '%number%'
- ),
- array(
- $_REQUEST['Caller'],
- $_REQUEST['Called']
- ),
- $url
- );
- $title = str_replace(
- array(
- '%caller%',
- '%number%'
- ),
- array(
- $_REQUEST['Caller'],
- $_REQUEST['Called']
- ),
- $title
- );
+ $caller = normalize_phone_to_E164($_REQUEST['Caller']);
+ $called = normalize_phone_to_E164($_REQUEST['Called']);
+ $url = str_replace(array('%caller%', '%number%'), array($caller, $called), $url);
+ $title = str_replace(array('%caller%', '%number%'), array($caller, $called), $title);
}
else{
- $url = str_replace(
- array(
- '%caller%',
- '%number%'
- ),
- array(
- $_REQUEST['From'],
- $_REQUEST['To']
- ),
- $url
- );
- $title = str_replace(
- array(
- '%caller%',
- '%number%'
- ),
- array(
- $_REQUEST['From'],
- $_REQUEST['To']
- ),
- $title
- );
+ $from = normalize_phone_to_E164($_REQUEST['From']);
+ $to = normalize_phone_to_E164($_REQUEST['To']);
+ $url = str_replace(array('%caller%', '%number%'), array($from, $to), $url);
+ $title = str_replace(array('%caller%','%number%'), array($from, $to), $title);
}
-
include_once('Galvanize.php');
-@$GA=new Galvanize($account);
-@$GA->trackPageView($url,$title);
+@$GA = new Galvanize($account);
+@$GA->trackPageView($url, $title);
$response = new Response();
if(!empty($next))

0 comments on commit 38dece7

Please sign in to comment.