From 24b30d9bbcaa6e671b50703f9c98435a61154299 Mon Sep 17 00:00:00 2001 From: Mark Crane Date: Wed, 22 May 2013 19:08:58 +0000 Subject: [PATCH] Fix a regression for click to call regarding auto-answer --- app/click_to_call/app_languages.php | 32 ++++++++++++++++++++++- app/click_to_call/click_to_call.php | 40 ++++++++++++++++++++++++++--- 2 files changed, 67 insertions(+), 5 deletions(-) diff --git a/app/click_to_call/app_languages.php b/app/click_to_call/app_languages.php index 90856c17dd..c26d0e8b0a 100644 --- a/app/click_to_call/app_languages.php +++ b/app/click_to_call/app_languages.php @@ -24,33 +24,63 @@ Mark J Crane James Rose */ - $text['label-click2call']['en-us'] = 'Click to Call'; + $text['desc-click2call']['en-us'] = 'Provide the following information to make a call from the source number to the destination number.'; + $text['label-src-caller-id-nam']['en-us'] = 'Source Caller ID Name'; + $text['desc-src-caller-id-nam']['en-us'] = 'Enter the Caller ID name to send to your phone.'; + $text['label-src-caller-id-num']['en-us'] = 'Source Caller ID Number'; + $text['desc-src-caller-id-num']['en-us'] = 'Enter the Caller ID number to send to your phone (you probably want this to be the same as the destination number).'; + $text['label-dest-caller-id-nam']['en-us'] = 'Destination Caller ID Name'; + $text['desc-dest-caller-id-nam']['en-us'] = 'Enter the Caller ID name to send to the destination number.'; + $text['label-dest-caller-id-num']['en-us'] = 'Destination Caller ID Number'; + $text['desc-dest-caller-id-num']['en-us'] = 'Enter the Caller ID number to send to the destination number (you probably want this to be your phone number).'; + + + $text['label-src-num']['en-us'] = 'Source Number'; + $text['desc-src-num']['en-us'] = 'Enter your phone number. This can be an extension on the system, or another number (eg: mobile phone).'; + $text['label-dest-num']['en-us'] = 'Destination Number'; + $text['desc-dest-num']['en-us'] = "Enter the number to call. This can be an extension on the system, another number, or a sip uri. Sip URI's are of the form 5551234567@voip.example.com:5080 (5080 for freeswitch, or 5060 for other systems)."; + + $text['label-auto-answer']['en-us'] = 'Auto Answer'; + + $text['desc-auto-answer']['en-us'] = 'Select whether to enable auto answer.'; + $text['label-record']['en-us'] = 'Record'; + $text['label-true']['en-us'] = 'true'; + $text['label-false']['en-us'] = 'false'; + $text['desc-record']['en-us'] = 'Select whether to record the call.'; + $text['label-ringback']['en-us'] = 'Ring Back'; + $text['desc-ringback']['en-us'] = 'Defines what the you will hear while destination is being called. The choices are music (music on hold) ring (ring tone.)'; + $text['opt-usring']['en-us'] = 'us-ring'; + $text['opt-frring']['en-us'] = 'fr-ring'; + $text['opt-ukring']['en-us'] = 'uk-ring'; + $text['opt-rsring']['en-us'] = 'rs-ring'; + $text['opt-moh']['en-us'] = 'music'; + $text['button-call']['en-us'] = 'Call'; ?> \ No newline at end of file diff --git a/app/click_to_call/click_to_call.php b/app/click_to_call/click_to_call.php index 0872d60644..bcb9657eff 100644 --- a/app/click_to_call/click_to_call.php +++ b/app/click_to_call/click_to_call.php @@ -65,7 +65,14 @@ if (is_array($_REQUEST) && !empty($_REQUEST['src']) && !empty($_REQUEST['dest']) $src_cid_number = check_str($_REQUEST['src_cid_number']); $dest_cid_name = check_str($_REQUEST['dest_cid_name']); $dest_cid_number = check_str($_REQUEST['dest_cid_number']); + $auto_answer = check_str($_REQUEST['auto_answer']); //true,false $rec = check_str($_REQUEST['rec']); //true,false + if ($auto_answer == "true") { + $sip_auto_answer = "sip_auto_answer=true,"; + } + else { + $sip_auto_answer = ''; + } if (strlen($cid_number) == 0) { $cid_number = $src;} if (strlen($_SESSION['context']) > 0) { $context = $_SESSION['context']; @@ -74,10 +81,10 @@ if (is_array($_REQUEST) && !empty($_REQUEST['src']) && !empty($_REQUEST['dest']) $context = 'default'; } - //woraround for TBDialout on Thunderbird + //workaround for TBDialout on Thunderbird //seems it can only handle the first %NUM% if ($dest == "%NUM%"){ - //echo "Thnuderbird fix, dest now = $src_cid_number
"; + //echo "Thunderbird fix, dest now = $src_cid_number
"; $dest = $src_cid_number; } @@ -105,7 +112,7 @@ if (is_array($_REQUEST) && !empty($_REQUEST['src']) && !empty($_REQUEST['dest']) //source should see the destination caller id if (strlen($src) < 7) { - $source = "{origination_caller_id_name='$src_cid_name',origination_caller_id_number=$src_cid_number,instant_ringback=true,ringback=$ringback_value,presence_id=$src@".$_SESSION['domains'][$domain_uuid]['domain_name'].",call_direction=outbound}sofia/internal/$src%".$_SESSION['domains'][$domain_uuid]['domain_name']; + $source = "{".$sip_auto_answer."origination_caller_id_name='$src_cid_name',origination_caller_id_number=$src_cid_number,instant_ringback=true,ringback=$ringback_value,presence_id=$src@".$_SESSION['domains'][$domain_uuid]['domain_name'].",call_direction=outbound}sofia/internal/$src%".$_SESSION['domains'][$domain_uuid]['domain_name']; } else { $bridge_array = outbound_route_to_bridge ($_SESSION['domain_uuid'], $src); @@ -146,7 +153,7 @@ if (is_array($_REQUEST) && !empty($_REQUEST['src']) && !empty($_REQUEST['dest']) $destination = "{origination_caller_id_name='$dest_cid_name',origination_caller_id_number=$dest_cid_number}".$bridge_array[0]; if (permission_exists('click_to_call_call')) { if (strpbrk($dest, '@') != FALSE) { - //call a sip uri + //call a sip uri //echo "Found an @ 4, do nothing for now

"; $switch_cmd = "api originate $source &bridge({origination_caller_id_name='$src_cid_name',origination_caller_id_number=$src_cid_number,call_direction=outbound}sofia/external/$dest)"; //echo "
SWITCH-CMD: $switch_cmd
"; @@ -288,6 +295,31 @@ if (is_array($_REQUEST) && !empty($_REQUEST['src']) && !empty($_REQUEST['dest']) echo " \n"; echo "\n"; + echo" \n"; + echo "\n"; + echo " $text['label-auto-answer']:\n"; + echo "\n"; + echo "\n"; + echo " \n"; + echo "
\n"; + echo $text['desc-auto-answer']."\n"; + echo "\n"; + echo "\n"; + echo "\n"; echo "\n"; echo " ".$text['label-record'].":\n";