Changeset 5228
- Timestamp:
- 11/07/07 19:27:16 (1 year ago)
- Files:
-
- modules/branches/2.4 (modified) (1 prop)
- modules/branches/2.4/core/functions.inc.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
modules/branches/2.4
- Property svnmerge-integrated changed from /modules/branches/2.3:1-5212,5225 to /modules/branches/2.3:1-5212,5225,5227
modules/branches/2.4/core/functions.inc.php
r5226 r5228 784 784 } 785 785 } 786 //if (empty($dial) && strtolower($tech) == "zap")787 // $dial = "ZAP/".($_REQUEST['channel'] != '' ? $_REQUEST['channel'] : $_REQUEST['devinfo_channel']);788 //if (empty($dial))789 // $dial = strtoupper($tech)."/".$id;790 786 791 787 //check to see if we are requesting a new user … … 823 819 $astman->database_put("DEVICE",$id."/type",$devicetype); 824 820 $astman->database_put("DEVICE",$id."/default_user",$user); 825 if(!empty($emergency_cid)) 821 if(!empty($emergency_cid)) { 826 822 $astman->database_put("DEVICE",$id."/emergency_cid","\"".$emergency_cid."\""); 827 if($user != "none") { 823 } 824 825 if ($user != "none") { 828 826 $existingdevices = $astman->database_get("AMPUSER",$user."/device"); 829 827 if (empty($existingdevices)) { 830 828 $astman->database_put("AMPUSER",$user."/device",$id); 831 829 } else { 832 $existingdevices .= "&"; 833 //only append device value if this id doesn't exist in it already 834 if(strpos($existingdevices,$id."&") === false) // if not containing $id 835 $astman->database_put("AMPUSER",$user."/device",$existingdevices.$id); 836 } 837 } 830 $existingdevices_array = explode('&',$existingdevices); 831 if (!in_array($id, $existingdevices_array)) { 832 $existingdevices_array[]=$id; 833 $existingdevices = implode('&',$existingdevices_array); 834 $astman->database_put("AMPUSER",$user."/device",$existingdevices); 835 } 836 } 837 } 838 838 839 } else { 839 840 fatal("Cannot connect to Asterisk Manager with ".$amp_conf["AMPMGRUSER"]."/".$amp_conf["AMPMGRPASS"]); … … 885 886 // Remove the device record from the user's device list 886 887 $userdevices = $astman->database_get("AMPUSER",$deviceuser."/device"); 887 /*$userdevices = str_replace($account."&", "", $userdevices."&"); 888 889 // If there was more than one device, remove the extra "&" at the end. 890 if (substr($userdevices, -1, 1) == "&") { 891 $userdevices = substr($userdevices, 0, -1); 892 }*/ 888 889 // We need to remove just this user and leave the rest alone 893 890 $userdevicesarr = explode("&", $userdevices); 894 array_splice($userdevicesarr, array_search($account, $userdevicesarr), 1); 891 $userdevicesarr_hash = array_flip($userdevicesarr); 892 unset($userdevicesarr_hash[$account]); 893 $userdevicesarr = array_flip($userdevicesarr_hash); 895 894 $userdevices = implode("&", $userdevicesarr); 896 895 … … 2137 2136 2138 2137 2138 //TODO: This needs to be yanked, should be in the upgrade script somewhere not here 2139 // 2139 2140 if (count($results) == 0) { 2140 2141 // see if they're still using the old dialprefix method
