diff --git a/htdocs/asterisk/wrapper.php b/htdocs/asterisk/wrapper.php new file mode 100644 index 00000000000..2c76bf7522f --- /dev/null +++ b/htdocs/asterisk/wrapper.php @@ -0,0 +1,130 @@ + + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + */ + +/** + * \file htdocs/asterisk/wrapper.php + * \brief File that is entry point to call Dolibarr WebServices + * \version $Id$ + * \remarks To be used, an Asterisk user must be created by adding this + * in /etc/asterisk/manager.conf + * [dolibarr] + * secret = dolibarr + * deny=0.0.0.0/0.0.0.0 + * permit=127.0.0.1/255.255.255.0 + * read = system,call,log,verbose,command,agent,user + * write = system,call,log,verbose,command,agent,user + */ + +// This is to make Dolibarr working with Plesk +set_include_path($_SERVER['DOCUMENT_ROOT'].'/htdocs'); + +require_once("../master.inc.php"); +require_once(DOL_DOCUMENT_ROOT."/lib/functions.lib.php"); +require_once(DOL_DOCUMENT_ROOT."/lib/functions2.lib.php"); + + +dol_syslog("Call Dolibarr Asterisk interface"); + +// TODO Enable and test if module Asterisk is enabled + + +$conf->global->ASTERISK_HOST="127.0.0.1"; +$conf->global->ASTERISK_TYPE="SIP/"; +$conf->global->ASTERISK_INDICATIF="0"; +$conf->global->ASTERISK_PORT=5038; + +$login = $_GET['login']; +$password = $_GET['password']; +$caller = $_GET['caller']; +$called = $_GET['called']; + +# Adresse IP du serveur Asterisk +$strHost = $conf->global->ASTERISK_HOST; + +#Context ( generalement from-internal ) +$strContext = "from-internal"; + +#Spécifiez le type d'extension par laquelle vous poste est connecte. +#ex: SIP/, IAX2/, ZAP/, etc +$channel = $conf->global->ASTERISK_TYPE; + + +#Delai d'attente avant de raccrocher +$strWaitTime = "30"; + +#Priority +$strPriority = "1"; + +#Nomber of try +$strMaxRetry = "2"; + +#Indicatif de la ligne sortante +$prefix = $conf->global->ASTERISK_INDICATIF; + +#Port +$port = $conf->global->ASTERISK_PORT; + +?> + + +Asterisk redirection ... + +" ; + $oSocket = @fsockopen ($strHost, $port, $errno, $errstr, 10) ; + if (!$oSocket) + { + echo ''."\n"; + $txt="Failed to execute fsockopen($strHost, $port, \$errno, \$errstr, 10)
\n"; + echo $txt; + dol_syslog($txt,LOG_ERR); + $txt=$errstr." (".$errno.")
\n"; + echo $txt; + dol_syslog($txt,LOG_ERR); + } + else + { + echo ''."\n"; + fputs($oSocket, "Action: login\r\n" ) ; + fputs($oSocket, "Events: off\r\n" ) ; + fputs($oSocket, "Username: $login\r\n" ) ; + fputs($oSocket, "Secret: $password\r\n\r\n" ) ; + fputs($oSocket, "Action: originate\r\n" ) ; + fputs($oSocket, "Channel: ".$channel.$caller."\r\n" ) ; + fputs($oSocket, "WaitTime: $strWaitTime\r\n" ) ; + fputs($oSocket, "CallerId: $strCallerId\r\n" ) ; + fputs($oSocket, "Exten: ".$prefix.$number."\r\n" ) ; + fputs($oSocket, "Context: $strContext\r\n" ) ; + fputs($oSocket, "Priority: $strPriority\r\n\r\n" ) ; + fputs($oSocket, "Action: Logoff\r\n\r\n" ) ; + sleep(2) ; + fclose($oSocket) ; + } + endif ; +} +?> + + diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index 7490a1a9e78..9c1d3f62362 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -761,7 +761,7 @@ TemplatePDFInterventions=Modèle de documents des fiches d'interventions WatermarkOnDraftInterventionCards=Filigrane sur les brouillons des fiches d'interventions (aucun si vide) ##### Clicktodial ##### ClickToDialSetup=Configuration du module Click To Dial -ClickToDialUrlDesc=Url appelée lors dun clic sur le picto téléphone. Dans l'url, vous pouvez utiliser les balises
%%1$s qui sera remplacé par le téléphone de l'appelé
%%2$s qui sera remplacé par le téléphone de l'appelant (le votre)
%%3$s qui sera remplacé par votre login clicktodial (défini sur votre fiche utilisateur)
%%4$s qui sera remplacé par votre mot de passe clicktodial (défini sur votre fiche utilisateur). +ClickToDialUrlDesc=Url appelée lors dun clic sur le picto téléphone. Dans l'url, vous pouvez utiliser les balises
%%1$s qui sera remplacé par le téléphone de l'appelé
%%2$s qui sera remplacé par le téléphone de l'appelant (le votre, défini sur votre fiche utilisateur)
%%3$s qui sera remplacé par votre login clicktodial (défini sur votre fiche utilisateur)
%%4$s qui sera remplacé par votre mot de passe clicktodial (défini sur votre fiche utilisateur). ##### Bookmark4u ##### Bookmark4uSetup=Configuration du module Bookmark4u ##### Interventions ##### diff --git a/htdocs/webservices/server.php b/htdocs/webservices/server.php index d4f539ae49b..88a330f5db3 100644 --- a/htdocs/webservices/server.php +++ b/htdocs/webservices/server.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2006-2009 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -17,10 +17,10 @@ */ /** - \file htdocs/webservices/server.php - \brief Fichier point entree des WebServices Dolibarr - \version $Id$ -*/ + * \file htdocs/webservices/server.php + * \brief File that is entry point to call Dolibarr WebServices + * \version $Id$ + */ // This is to make Dolibarr working with Plesk set_include_path($_SERVER['DOCUMENT_ROOT'].'/htdocs'); @@ -32,6 +32,7 @@ require_once(NUSOAP_PATH.'/nusoap.php'); // Include SOAP dol_syslog("Call Dolibarr webservices interfaces"); +// TODO Enable and test if module web services is enabled // Create the soap Object $server = new soap_server(); @@ -43,7 +44,7 @@ $server->wsdl->schemaTargetNamespace=$ns; // Register methods available for clients /* $server->register('getVersions', -array(), // Tableau parametres entr�e +array(), // Tableau parametres entree array('result' => 'xsd:array'), // Tableau parametres sortie $ns); */