Hi,
This works for me with PHP and outbound socket.
Dialplan: *** sends connection to IP A.B.C.D port 8084
<extension name="test">
<condition field="destination_number" expression="^\*\*\*$">
<action application="socket" data="A.B.C.D:8084"/>
</condition>
</extension>
xinetd picks up the connection and sends to the script. xinetd config is:
service unlisted
{
user = whoever
disable = no
type = UNLISTED
socket_type = stream
protocol = tcp
wait = no
server = /home/test/test.php
port = 8084
server_args = HOST
}
The php script picks it up from there
#!/usr/bin/php
<?php
require_once('ESL.php');
$esl = new ESLconnection(0);
$ans= $esl->execute('answer');
$subscribe = $esl->sendRecv('myevents');
$subscribe = $esl->sendRecv('linger'); # Without this the channel closes before we receive the events
$res = $esl->execute('sleep', '1000');
$context = $esl->getInfo()->getHeader('Caller-Context');
$curr_user = $esl->getInfo()->getHeader('variable_sip_from_user');
$curr_host = $esl->getInfo()->getHeader('variable_sip_from_host');
///etc etc.