Index: trunk/jabberit_messenger/inc/webservice.php
===================================================================
--- trunk/jabberit_messenger/inc/webservice.php	(revision 986)
+++ trunk/jabberit_messenger/inc/webservice.php	(revision 1130)
@@ -83,4 +83,73 @@
 		$this->ldapConnect();
 	}
+	
+	public final function CallVoipConnect($pVoipFrom, $pVoipTo)
+	{
+		
+		$this->ldapConnect();
+
+		if( $this->conn )
+		{
+			$filter  = "(|(&(phpgwaccounttype=u)(uid=".$pVoipFrom."))(&(phpgwaccounttype=u)(uid=".$pVoipTo.")))";
+			$justthese = array("telephoneNumber");
+			$search = ldap_search($this->conn,$this->contextLdap,$filter,$justthese);
+			$entry = ldap_get_entries($this->conn,$search);
+
+			$fromNumber = $entry[0]['telephonenumber'][0];
+			$toNumber = $entry[1]['telephonenumber'][0];
+		}
+
+		if( $fromNumber && $toNumber )
+		{
+			$fromNumber = substr($fromNumber,strlen($fromNumber) - 4, strlen($fromNumber) - 1);
+			$toNumber	= substr($toNumber,strlen($toNumber) - 4, strlen($toNumber) - 1);
+
+			$voipServer	= "10.15.151.106";
+			$voipUrl	= "/telefoniaip/servicos/voip.php";
+			$voipPort	= "80";
+	
+			if( !$voipServer || !$voipUrl || !$voipPort )
+				return false;
+			
+			$url		= "http://".$voipServer.":".$voipPort.$voipUrl."?magic=1333&acao=liga&ramal=".$fromNumber."&numero=".$toNumber;			
+			$sMethod	= 'GET ';
+			$crlf		= "\r\n";
+			$sRequest	= " HTTP/1.1" . $crlf;
+			$sRequest	.= "Host: localhost" . $crlf;
+			$sRequest	.= "Accept: */* " . $crlf;
+			$sRequest	.= "Connection: Close" . $crlf . $crlf;            
+			$sRequest	= $sMethod . $url . $sRequest;    
+			$sockHttp	= socket_create(AF_INET, SOCK_STREAM, SOL_TCP);            
+			
+			if ( !$sockHttp )
+			    return false;
+			
+			$resSocketConnect = socket_connect($sockHttp, $voipServer, $voipPort);
+			
+			if ( !$resSocketConnect )
+			    return false;
+	
+			$resSocketWrite = socket_write($sockHttp, $sRequest, strlen($sRequest));
+	
+			if ( !$resSocketWrite )
+			    return false;
+	    
+			$sResponse = '';    
+	
+			while ($sRead = socket_read($sockHttp, 512))
+			{
+			    $sResponse .= $sRead;
+			}            
+			
+			socket_close($sockHttp);            
+			
+			$pos = strpos($sResponse, $crlf . $crlf);
+			
+			return substr($sResponse, $pos + 2 * strlen($crlf));
+		}
+		
+		return "ERRO";									
+	}
+	
 	
 	public final function getNameOrganization($pJid, $pCharset)
@@ -231,4 +300,14 @@
 }
 
+// Utilizando o serviço Asteriks;
+if(trim($_REQUEST['javaVoipFrom']) != "" && trim($_REQUEST['javaVoipTo']) != "" )
+{
+	$obj = new webService();
+	$voipFrom = $_REQUEST['javaVoipFrom'];
+	$voipTo = $_REQUEST['javaVoipTo'];
+	printf("%s",$obj->CallVoipConnect($voipFrom, $voipTo));
+}
+
+// Fotos pelo applet; 
 if(trim($_REQUEST['javaPhoto']) != "" )
 {
@@ -271,4 +350,5 @@
 }
 
+// Jid pelo applet;
 if(trim($_POST['jid']) != "")
 {
@@ -280,4 +360,5 @@
 }
 
+// Fotos pelo php;
 if(trim($_REQUEST['phpPhoto']) != "")
 {
Index: trunk/jabberit_messenger/inc/login.php
===================================================================
--- trunk/jabberit_messenger/inc/login.php	(revision 1097)
+++ trunk/jabberit_messenger/inc/login.php	(revision 1130)
@@ -79,5 +79,25 @@
 			}
 		}
-		
+
+		//Enable/Disable VoIP Service -> Voip Server Config
+		$voip_enabled = false;
+		$voip_groups = array();	
+		if( $GLOBALS['phpgw_info']['server']['voip_groups'] )
+		{
+			$emailVoip = false;
+			foreach(explode(",",$GLOBALS['phpgw_info']['server']['voip_groups']) as $i => $voip_group)
+			{
+				$a_voip = explode(";",$voip_group);			
+				$voip_groups[] = $a_voip[1];
+			}
+			foreach($GLOBALS['phpgw']->accounts->membership() as $idx => $group){			
+				if(array_search($group['account_name'],$voip_groups) !== FALSE)
+				{		 
+					$voip_enabled = true;
+					$emailVoip = $GLOBALS['phpgw_info']['server']['voip_email_redirect'];
+				}
+			}
+		}
+
 		// Load Applet ( Java )
 		$javaFiles = $path . "applet.jar,";
@@ -86,5 +106,8 @@
 		// Enable Plugins Java;
 		$pluginsJava[] = "xhtml.jar";
-		$pluginsJava[] = "filetransfer.jar";		
+		$pluginsJava[] = "filetransfer.jar";
+		
+		if( $voip_enabled )
+			$pluginsJava[] = "callVoip.jar";		
 		
 		for( $i = 0; $i < count($pluginsJava); $i++ )
Index: trunk/jabberit_messenger/inc/confLDAPInternal.php
===================================================================
--- trunk/jabberit_messenger/inc/confLDAPInternal.php	(revision 1130)
+++ trunk/jabberit_messenger/inc/confLDAPInternal.php	(revision 1130)
@@ -0,0 +1,1 @@
+<?php $LDAP_INTERNAL="YTo1OntzOjEwOiJqYWJiZXJOYW1lIjtzOjEyOiJpbS5wci5nb3YuYnIiO3M6MTA6InNlcnZlckxkYXAiO3M6MTI6ImltLnByLmdvdi5iciI7czoxMToiY29udGV4dExkYXAiO3M6MTg6ImRjPXByLGRjPWdvdixkYz1iciI7czo0OiJ1c2VyIjtzOjI3OiJjbj1hZG1pbixkYz1wcixkYz1nb3YsZGM9YnIiO3M6ODoicGFzc3dvcmQiO3M6ODoiamFCQmVyIUAiO30=" ?>
Index: trunk/jabberit_messenger/templates/default/.packer.setup.js
===================================================================
--- trunk/jabberit_messenger/templates/default/.packer.setup.js	(revision 1130)
+++ trunk/jabberit_messenger/templates/default/.packer.setup.js	(revision 1130)
@@ -0,0 +1,1 @@
+eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(c/a))+String.fromCharCode(c%a+161)};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\[\xa1-\xff]+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp(e(c),'g'),k[c])}}return p}('(©(){¡ ¯=ø ¢Î(\'¢š/\');¡ Ë=ø ¢Ï(\'¢š/\');© ù(Ä){¡ ¢=Ä.É[0];¡ ¬="";±(¡ i=0;i<¢.€.«;i++){¥(¢.€[i].·==\'¢Í\'){¥(¢.€[i].£==-1){Ì(\'¢Ì ¢Œ ¢Ê !\');Ÿ}¬+=¢.€[i].£;¢.€[i].œ[0].õ=³}¥(¢.€[i].·==\'¢Ë\'){¬+=¢.€[i].£+";";¢.€[i].£=\'\'}}¯.²("t.Ž.¢Ð",©(Š){¥(Š){¡ »={\'à\':®(\'¶\'),\'Ô\':®(\'¢Ñ\'),\'¢¶\':®(\'Õ\')};¡ º=§.š(\'¢Ö\');º.Œ.×=Ë.Ó(Š,\'¢Õ.Ï\',»)}},"¢É="+¬)}© ¢¢(Ä){¡ ¢=Ä.É[0];¡ Ö="";±(¡ i=0;i<¢.€.«;i++){¥(¢.€[i].Ù==\'ö\'){¡ Å=¢.€[i].è;Å=Å.å(Å.¢Ò(\'_\')+1);¥(¢.€[i].£!=""&&Û(¢.€[i].£)!=""){§.š(\'¢§\'+Å).Ç.Æ="ë";Ö=¢.€[i].£;¢.€[i].£=\'\'}Á{§.š(\'¢§\'+Å).Ç.Æ="é";Ì(®(\'¢× ¶!\'));Ÿ ž}}}¯.²("t.Ž.¢Å",©(Š){¥(Š){¡ »={\'à\':®(\'¶\'),\'Ô\':®(\'Õ\')};¡ º=§.š(\'¢À\');º.Œ.×=Ë.Ó(Š,\'¢¿.Ï\',»)}},"Ö="+Ö)}© ¢¯(){¥(ª.«>0){¯.²("t.Ž.¢Á",©(Š){¡ Ð=[[\'¿\',\'ü\'],[\'¢±\',\'¢¡\'],[\'È\',\'ÿ\'],[\'Í\',\'ý\'],[\'¢µ\',\'þ\'],[\'ì\',\'¢­\']];Š=Š.¢Š(\';\');±(¡ i=0;i<Š.«;i++){¡ ¬=Š[i].¢Š(\':\');±(¡ j ã Ð)¥(¬[0]==Ð[j][0])§.š(Ð[j][1]).£=¬[1]}},"¢»="+ª[0])}}© ú(Ä){¡ ¢=Ä.É[0];¡ ¬="";¡ Ý=ž;±(¡ i=0;i<¢.€.«;i++){¢°(¢.€[i].Ù){Ø"ö":¥(¢.€[i].£!=""){¬+=¢.€[i].·.ê()+";"+¢ª(¢.€[i].£)+"\\n";§.š(¢.€[i].·+"á").Ç.Æ="ë"}Á ¥(¢.€[i].·.ê()!="¢Ç"){§.š(¢.€[i].·+"á").Ç.Æ="é";Ý=³}Ú;Ø"ì":¥(¢.€[i].£==""){§.š(¢.€[i].·+"á").Ç.Æ="é";Ý=³}Á{¬+=¢.€[i].·.ê()+";"+¢ª(¢.€[i].£)+"\\n";§.š(¢.€[i].·+"á").Ç.Æ="ë"}Ú}}¥(!Ý){¬=¬.å(0,(¬.«-1));¯.²("t.¢í.¢Ø","¢ê="+¬);Ÿ ³}Á{Ì(\'¢é ¢î ¢ï ¢ô ¢ó !\');Ÿ ž}}© Û(£){¡ ¢¬=¢ò.¢ð(¢ñ);¡ æ="";¡ Î=0;¥(Ü<1)Ÿ"";¡ Ü=£?£.«:0;¢ç(Î<Ü){¥(£&&£.¢æ(Î)!=¢¬){æ=£.å(Î,Ü);Ú}Î++}Ÿ æ}© ï(){¡ Â=(ª.«==1)?ª[0]:ž;¡ ¢=Â.É[0];¡ Ñ=ž;¡ ä=\'\';±(¡ i=0;i<¢.€.«;i++){¥(¢.€[i].Ù==\'¢Ù\'){Ñ=³;¥(¢.€[i].è==\'¢®\')ä=¢.€[i].è}}¥(Ñ){¥(Ñ&&ä==\'¢®\')¢¢(Â);Á ù(Â)}Á{¥(Â)ú(Â)}}© ñ(){¡ î=§.š(\'ü\');¡ ç=§.š(\'¢¡\');¡ È=§.š(\'ÿ\');¡ Í=§.š(\'ý\');¡ â=§.š(\'þ\');¡ í=§.š(\'¢­\');¡ ¹=[[\'î\',\'Ò ¢ë ¢â !\'],[\'ç\',\'Ò o ¢¹ ¢º ¢Ÿ ¢³ !\'],[\'È\',\'Ò o ¢¹ ¢º ¢Ÿ ¢· !\'],[\'Í\',\'Ò ¢Œ ¢ã ¢· !\'],[\'â\',\'\'],[\'í\',\'\']];±(¡ i ã ¹){¥(!Û(Þ(¹[i][0]).£)&&Û(¹[i][1])){Ì(¹[i][1]);Þ(¹[i][0]).¢ä();Ÿ ž}}¯.²("t.Ž.¢å",©(Š){¡ »={\'à\':®(\'¶\'),\'Ô\':®(\'¢à ¢³\'),\'¢¶\':®(\'Õ\'),\'¢Ý\':®(\'¢ì\')};¡ º=§.š(\'¢²\');º.Œ.×=Ë.Ó(Š,\'¢².Ï\',»);±(¡ i ã ¹)Þ(¹[i][0]).£=""},"¿="+î.£+"&¢±="+ç.£+"&È="+È.£+"&Í="+Í.£+"&¢µ="+â.£+"&ì="+í.£)}© ¢©(){¡ Ê=§.š(\'¢Ó\');¡ ¶="";±(¡ i=0;i<Ê.œ.«;i++){¥(Ê.œ[i].õ==³&&Ê.œ[i].£!="-1")¶=Ê.œ[i].£}¥(¶){¡ À=§.š(\'¢ž\').£;¡ Ã=§.š(\'Ã\').£;¯.²("t.Ž.¢Ü",©(Š){¥(Š){¡ »={\'à\':®(\'¶\'),\'Ô\':®(\'Õ\')};¡ º=§.š(\'¢œ\');º.Œ.×=Ë.Ó(Š,\'¢œ.Ï\',»)}},"À="+À+"&¢£="+Ã+"&û="+¶)}}© ¢¥(){¥(ª.«>0){¡ ­=ª[0];¡ ¢=ª[1].É[0];¡ £=ž;±(¡ i=0;i<­.œ.«;i++){¥(­.œ[i].õ==³&&­.œ[i].£==\'³\')£=³}±(¡ i=0;i<¢.€.«;i++){¢°(¢.€[i].Ù){Ø\'ö\':Ø\'¢È\':¢.€[i].¢Ž=ž;¥(!£)¢.€[i].¢Ž=³;Ú}}¯.²("t.Ž.¢Ã",©(Š){¥(!Š)Ì(\'¢Ô !\')},"£="+£)}}© ô(){¥(ª.«>0){¡ ÷=ª[0];¡ ò=§.š(÷);¯.²("t.Ž.ô",©(Š){Š=Þ(Š);¥(Š)ò.Œ.ß(ò)},"¢»="+÷)}}© ð(){¥(ª.«>0){¡ ­=§.š(ª[0]);¡ ¿=ª[0];¡ À=§.š(\'¢ž\').£;¡ Ã=§.š(\'Ã\').£;¯.²("t.Ž.¢á",©(Š){¥(Š)­.Œ.ß(­)},"À="+À+"&¢£="+Ã+"&û="+¿)}}© ¢€(){¥(ª.«>0){¡ ­=§.š(ª[0]);¡ ¿=ª[0];¯.²("t.Ž.¢ß",©(Š){¥(Š)­.Œ.ß(­)},"¿="+¿)}}© ó(){¥(ª.«>0){¡ ­=§.š(ª[0]);¡ ¢«=ª[0];¯.²("t.Ž.ó",©(Š){¥(Š)­.Œ.ß(­)},"¢Ú="+¢«)}}© °(){}°.µ.¢Û=¢¯;°.µ.¢Þ=ô;°.µ.¢è=¢€;°.µ.ð=ð;°.µ.¢õ=ó;°.µ.ñ=ñ;°.µ.¢Ä=¢©;°.µ.¢Æ=¢¥;°.µ.ï=ï;¢Â.°=ø °})();',95,180,'var|form|value|elements|if|data|document|getElementById|function|arguments|length|values|element|jabberitGetLang|_0|constructScript|for|go|true|db_im|prototype|Organization|id|false|ArrayConf|Table|_1|parentNode|options|return|org|group|else|doc|gidNumber|pDocument|nameElement|color|style|serverLdap|forms|elementSel|_2|alert|contextLdap|iTemp|xsl|fields|flag|Informe|parse|lang2|Delete|organization|innerHTML|case|type|break|ltrim|v_length|field_blank|eval|removeChild|lang1|__label|userLdap|in|nameForm|substring|strTemp|hostName|name|red|toUpperCase|black|password|pwdLdap|orgLdap|sendf|removeOrgGroupsLocked|setConfServerJabber|elementTableTr|removeParticipantsExternal|removeHostsJabber|selected|text|idElement|new|addLdapAttributes|getInputs|ou|organizationLdapJabberit|contextLdapJabberit|userLdapJabberit|serverLdapJabberit|hostNameJabberit|addParticipantsExternals|gidnumber|removeOrgLdapAttributes|setParticipantsExternal|split|label_|jabberit_messenger|setOrganizationsForGroups|escape|participantsExternal|w_space|passwordLdapJabberit|HiddenJabberitExternals|editHostsJabber|switch|jabberName|tableConfServersJabber|Jabber|disabled|user|lang3|Ldap|nameGroup|nome|do|item|um|tableOrganizationsEnabledGroupsJabberit|servidor|tableExternalParticipants|tableExternalParticipantsJabberit|editHostJabber|window|setUseParticipantsExternal|setOrgFgroups|setOrganization|setPartExternal|JETTI_GROUP_CHAT_SERVER_JABBERIT|button|conf|atributo|organization_ldap_jabberit|Defina|attributes_ldap_list_jabberit|JITConnector|JITXTools|setAttributesLdap|Attribute|indexOf|organizations_ldap_jabberit|Error|tableOrganizations|tableHiddenJabberit|Define|ldapInternal|hidden|participants|editHostsJ|setOuGroupsLocked|lang4|removeHostsJ|removeAttributesLdap|Servers|removeOuGroupsLocked|organizacao|contexto|focus|setHostJabber|charAt|while|removeOrg|Preencha|val|uma|Edit|fileDefine|os|campos|fromCharCode|32|String|vermelho|em|removePartExternal'.split('|'),0,{}))
