Fix a regression for click to call regarding auto-answer

This commit is contained in:
Mark Crane
2013-05-22 19:08:58 +00:00
parent 0cb2879bc4
commit 24b30d9bbc
2 changed files with 67 additions and 5 deletions

View File

@@ -24,33 +24,63 @@
Mark J Crane <markjcrane@fusionpbx.com>
James Rose <james.o.rose@gmail.com>
*/
$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';
?>

View File

@@ -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 <br>";
//echo "Thunderbird fix, dest now = $src_cid_number <br>";
$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<br><br>";
$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 "<br>SWITCH-CMD: $switch_cmd<br>";
@@ -288,6 +295,31 @@ if (is_array($_REQUEST) && !empty($_REQUEST['src']) && !empty($_REQUEST['dest'])
echo " </td>\n";
echo "</tr>\n";
echo" <tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " $text['label-auto-answer']:\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
echo " <select class='formfld' name='auto_answer'>\n";
echo " <option value=''></option>\n";
if ($auto_answer == "true") {
echo " <option value='true' selected='selected'>".$text['label-true']."</option>\n";
}
else {
echo " <option value='true'>".$text['label-true']."</option>\n";
}
if ($auto_answer == "false") {
echo " <option value='false' selected='selected'>".$text['label-false']."</option>\n";
}
else {
echo " <option value='false'>".$text['label-false']."</option>\n";
}
echo " </select>\n";
echo "<br />\n";
echo $text['desc-auto-answer']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap>\n";
echo " ".$text['label-record'].":\n";