Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dolibarr
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Software_Artifact_Infrastructure_Repository
dolibarr
Commits
ed715b99
Commit
ed715b99
authored
14 years ago
by
Laurent Destailleur
Browse files
Options
Downloads
Patches
Plain Diff
More log on asterisk wrapper
parent
2db5b658
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
htdocs/asterisk/wrapper.php
+30
-15
30 additions, 15 deletions
htdocs/asterisk/wrapper.php
with
30 additions
and
15 deletions
htdocs/asterisk/wrapper.php
+
30
−
15
View file @
ed715b99
<?php
/* Copyright (C) 2009 Laurent Destailleur <eldy@users.sourceforge.net>
/* Copyright (C) 2009
-2010
Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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
...
...
@@ -30,16 +30,22 @@
* 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"
);
//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language
//if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled cause need to load personalized language
if
(
!
defined
(
'NOREQUIRESOC'
))
define
(
'NOREQUIRESOC'
,
'1'
);
if
(
!
defined
(
'NOREQUIRETRAN'
))
define
(
'NOREQUIRETRAN'
,
'1'
);
if
(
!
defined
(
'NOCSRFCHECK'
))
define
(
'NOCSRFCHECK'
,
'1'
);
if
(
!
defined
(
'NOTOKENRENEWAL'
))
define
(
'NOTOKENRENEWAL'
,
'1'
);
if
(
!
defined
(
'NOREQUIREMENU'
))
define
(
'NOREQUIREMENU'
,
'1'
);
if
(
!
defined
(
'NOREQUIREHTML'
))
define
(
'NOREQUIREHTML'
,
'1'
);
if
(
!
defined
(
'NOREQUIREAJAX'
))
define
(
'NOREQUIREAJAX'
,
'1'
);
require_once
(
"../main.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"
);
// Security check
// TODO Enable and test if module Asterisk is enabled
...
...
@@ -80,9 +86,14 @@ $prefix = $conf->global->ASTERISK_INDICATIF;
$port
=
$conf
->
global
->
ASTERISK_PORT
;
/*
* View
*/
print
'<html>'
.
"
\n
"
;
print
'<head>'
.
"
\n
"
;
print
'<title>Asterisk redirection ...</title>'
.
"
\n
"
;
print
'<title>Asterisk redirection
from Dolibarr
...</title>'
.
"
\n
"
;
print
'</head>'
.
"
\n
"
;
...
...
@@ -93,21 +104,25 @@ if (! empty($number))
if
(
$pos
===
false
)
:
$errno
=
0
;
$errstr
=
0
;
$strCallerId
=
"Dolibarr <
$number
>"
;
$strCallerId
=
"Dolibarr <
"
.
strtolower
(
$caller
)
.
"
>"
;
$oSocket
=
@
fsockopen
(
$strHost
,
$port
,
$errno
,
$errstr
,
10
)
;
if
(
!
$oSocket
)
if
(
$oSocket
)
{
echo
'<body>'
.
"
\n
"
;
print
'<body>'
.
"
\n
"
;
$txt
=
"Failed to execute fsockopen(
$strHost
,
$port
,
\$
errno,
\$
errstr, 10)<br>
\n
"
;
echo
$txt
;
print
$txt
;
dol_syslog
(
$txt
,
LOG_ERR
);
$txt
=
$errstr
.
" ("
.
$errno
.
")<br>
\n
"
;
echo
$txt
;
print
$txt
;
dol_syslog
(
$txt
,
LOG_ERR
);
print
'</body>'
.
"
\n
"
;
}
else
{
echo
'<body onload="javascript:history.go(-1);">'
.
"
\n
"
;
$txt
=
"Call Asterisk dialer for caller: "
.
$caller
.
", called: "
.
$called
.
" clicktodiallogin: "
.
$login
;
dol_syslog
(
$txt
);
print
'<body onload="javascript:history.go(-1);">'
.
"
\n
"
;
print
'<!-- '
.
$txt
.
' -->'
;
fputs
(
$oSocket
,
"Action: login
\r\n
"
)
;
fputs
(
$oSocket
,
"Events: off
\r\n
"
)
;
fputs
(
$oSocket
,
"Username:
$login
\r\n
"
)
;
...
...
@@ -122,9 +137,9 @@ if (! empty($number))
fputs
(
$oSocket
,
"Action: Logoff
\r\n\r\n
"
)
;
sleep
(
2
)
;
fclose
(
$oSocket
)
;
print
'</body>'
.
"
\n
"
;
}
endif
;
}
print
'</body>'
.
"
\n
"
;
print
'</html>'
.
"
\n
"
;
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment