Ok guys for the interested of you, i have make it happen!!
So here is the setup i have done!
download all file into a directories of you choice, i have used /usr/local/remotehints/ on the main server
edit the file hints.php and modify those line:
PHP:
//Server 1
$hint_xfr[1]['sipstuff']['302'] = 1; //Chanegs to hint 302 from context "sipstuff" will be passed to Server 2 as rhint_sipstuff_302
to:
PHP:
//Server 1
$hint_xfr[1]['ext-local']['1000'] = 1; //Change hint 1000 from context "ext-local" will be passed to Server 2 as rhint_ext-local_1000
$hint_xfr[1]['ext-local']['1100'] = 1;
$hint_xfr[1]['ext-local']['1101'] = 1;
You have to add 1 line per extension you want to monitor on a remote system phone. These are the main server extension.
And for the remote server here is the modification to do:
PHP:
//Server 2
$hint_xfr[2]['default']['316'] = 1; //Changes to hint 316 in context "defaut"... blah blah server 1 as rhint_default_302
Change this line to:
PHP:
//Server 2
$hint_xfr[2]['ext-local']['2000'] = 1; //Changes to hint 2000 in context "ext-local"will be passed to Server 1 as rhint_default_2000
Once again, you have to add 1 line per phone you want to monitor on the main server.
Save this file and open the ast_relay.php file
and make it look like that!
PHP:
//Server 1
$server[1]['addr'] = "127.0.0.1";
$server[1]['port'] = 5038;
$server[1]['user'] = "hints";
$server[1]['pass'] = "hints";
//Server 2
$server[2]['addr'] = "remote IP";
$server[2]['port'] = 5038;
$server[2]['user'] = "hints";
$server[2]['pass'] = "hints";
By the way you have to setup a user in each manager_custom file i have used hints/hints as username and password, you can make it what you want!
Here is what my entries in the manager_custom.conf look like:
Code:
[hints]
secret = hints
deny=0.0.0.0/0.0.0.0
permit=0.0.0.0/0.0.0.0
read = system,call,log,verbose,command,agent,user
write = system,call,log,verbose,command,agent,user
And now, for each remote extension you want to monitor, you have to create a custom hint context on the remote server, So if like me Server 1 as extension 1000,1100,1101.
And server 2 as extension 2000. here is what we will add to server 1 extension_custom.conf
Code:
[ext-local-custom]
exten => 2000,hint,Custom:rhint_ext-local_2000
And here is what the extension_custom.conf on the remote server will look like:
Code:
[ext-local-custom]
exten => 1000,hint,Custom:rhint_ext-local_1000
exten => 1100,hint,Custom:rhint_ext-local_1100
exten => 1101.hint,Custom:rhint_ext-local_1101
And by the way, you will have to add the DEVSTATE function to your asterisk system if it is not already done.
To know if you have it or not, go into your @ CLI and type:
Code:
core show function DEVSTATE
You should get something like that:
Code:
-= Info about function 'DEVSTATE' =-
[Syntax]
DEVSTATE(device)
[Synopsis]
Get or Set a device state
[Description]
The DEVSTATE function can be used to retrieve the device state from any
device state provider. For example:
NoOp(SIP/mypeer has state ${DEVSTATE(SIP/mypeer)})
NoOp(Conference number 1234 has state ${DEVSTATE(MeetMe:1234)})
The DEVSTATE function can also be used to set custom device state from
the dialplan. The "Custom:" prefix must be used. For example:
Set(DEVSTATE(Custom:lamp1)=BUSY)
Set(DEVSTATE(Custom:lamp2)=NOT_INUSE)
You can subscribe to the status of a custom device state using a hint in
the dialplan:
exten => 1234,hint,Custom:lamp1
The possible values for both uses of this function are:
UNKNOWN | NOT_INUSE | INUSE | BUSY | INVALID | UNAVAILABLE | RINGING
RINGINUSE | ONHOLD
if not you will need to install it.
To install the DEVSTATE function, here is the step i have get:
Get the zipped file attached to this post and unzip it to the /usr/src/asterisk/funcs/ directory.
Code:
cd /usr/src/asterisk
make distclean
make clean
./configure
make menuselect
** Go see in the option 6 if there is a * next to:func_devstate if not press space bar on it!.**
After you press ESC 1 time a "s" to save your change.
add this line to your /etc/amportal.conf
Restart your @ amportal restart and go into the CLI to make shure the function is now avaible:
Code:
core show function DEVSTATE
It is working really well here! Hope it will help some people here!! it would be really nice if it was possible to have this as a module to FreePBX if some guru are interested!!