Hello, I try to setup a php daemon which uses ESL. I run the sample php scripts successfully (inbound). Now I want to have it outbound to my php daemon socket. The forked child process which has to interact with incoming tcp connection from FS is started successfully. So in this state I have the client socket which I have to pass now somehow to ESLconnection I guess. FS ruby wiki gives this as an example: @con = ESL::ESLconnection.new(client_socket.fileno) In php I try this: $con = new ESLconnection($csock); As a result I got this error: PHP Fatal error: No matching function for overloaded 'new_ESLconnection' in /usr/share/pear/ESL.php on line 117 Any ideas? regards Helmut
Hello, when I type cast the socket var to integer and then do strace my php script I got this when new ESL connection is created: setsockopt(6, SOL_TCP, TCP_NODELAY, [1], 4) = -1 EBADF (Bad file descriptor) sendto(6, "connect\n\n", 9, 0, NULL, 0) = -1 EBADF (Bad file descriptor) There is no fatal error but the fd is somehow bad ... So it seems to me the parameter for "new ESLconnection" must be a number - but which? I tested both, sockets created with socket_create as well as with fsockopen. On 12.06.2010 02:12, Helmut Kuper wrote:
Hello,
I try to setup a php daemon which uses ESL.
I run the sample php scripts successfully (inbound). Now I want to have it outbound to my php daemon socket.
The forked child process which has to interact with incoming tcp connection from FS is started successfully. So in this state I have the client socket which I have to pass now somehow to ESLconnection I guess.
FS ruby wiki gives this as an example:
@con = ESL::ESLconnection.new(client_socket.fileno)
In php I try this:
$con = new ESLconnection($csock);
As a result I got this error:
PHP Fatal error: No matching function for overloaded 'new_ESLconnection' in /usr/share/pear/ESL.php on line 117
Any ideas?
regards Helmut
Make sure the ESL is properly built and that the PHP mod is built and installed. If you did a "make current" recently the you'll need to rebuild your ESL stuff. -MC On Fri, Jun 11, 2010 at 5:12 PM, Helmut Kuper <helmut.kuper@ewetel.de>wrote:
Hello,
I try to setup a php daemon which uses ESL.
I run the sample php scripts successfully (inbound). Now I want to have it outbound to my php daemon socket.
The forked child process which has to interact with incoming tcp connection from FS is started successfully. So in this state I have the client socket which I have to pass now somehow to ESLconnection I guess.
FS ruby wiki gives this as an example:
@con = ESL::ESLconnection.new(client_socket.fileno)
In php I try this:
$con = new ESLconnection($csock);
As a result I got this error:
PHP Fatal error: No matching function for overloaded 'new_ESLconnection' in /usr/share/pear/ESL.php on line 117
Any ideas?
regards Helmut
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
Hi Michael, ESL is built and installed, phpmod is built and installed. inbound works, test scripts works It is just the problem of passing an existing socket to new ESLconnection. A socket resource is denied, an integer is accepted but is rejected with "bad file descriptor" Am 12.06.2010 07:06, schrieb Michael Collins:
Make sure the ESL is properly built and that the PHP mod is built and installed. If you did a "make current" recently the you'll need to rebuild your ESL stuff. -MC
On Fri, Jun 11, 2010 at 5:12 PM, Helmut Kuper <helmut.kuper@ewetel.de <mailto:helmut.kuper@ewetel.de>> wrote:
Hello,
I try to setup a php daemon which uses ESL.
I run the sample php scripts successfully (inbound). Now I want to have it outbound to my php daemon socket.
The forked child process which has to interact with incoming tcp connection from FS is started successfully. So in this state I have the client socket which I have to pass now somehow to ESLconnection I guess.
FS ruby wiki gives this as an example:
@con = ESL::ESLconnection.new(client_socket.fileno)
In php I try this:
$con = new ESLconnection($csock);
As a result I got this error:
PHP Fatal error: No matching function for overloaded 'new_ESLconnection' in /usr/share/pear/ESL.php on line 117
Any ideas?
regards Helmut
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org <mailto:FreeSWITCH-users@lists.freeswitch.org> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
Hi Helmut, I got the same error: "No matching function for overloaded 'new_ESLconnection' in /usr/share/php/ESL.php" Have you solved the problem? Thanks, -- Samuel Macedo On 12 June 2010 14:59, Helmut Kuper <helmut.kuper@ewetel.de> wrote:
Hi Michael,
ESL is built and installed, phpmod is built and installed.
inbound works, test scripts works
It is just the problem of passing an existing socket to new ESLconnection. A socket resource is denied, an integer is accepted but is rejected with "bad file descriptor"
Am 12.06.2010 07:06, schrieb Michael Collins:
Make sure the ESL is properly built and that the PHP mod is built and installed. If you did a "make current" recently the you'll need to rebuild your ESL stuff. -MC
On Fri, Jun 11, 2010 at 5:12 PM, Helmut Kuper <helmut.kuper@ewetel.de>wrote:
Hello,
I try to setup a php daemon which uses ESL.
I run the sample php scripts successfully (inbound). Now I want to have it outbound to my php daemon socket.
The forked child process which has to interact with incoming tcp connection from FS is started successfully. So in this state I have the client socket which I have to pass now somehow to ESLconnection I guess.
FS ruby wiki gives this as an example:
@con = ESL::ESLconnection.new(client_socket.fileno)
In php I try this:
$con = new ESLconnection($csock);
As a result I got this error:
PHP Fatal error: No matching function for overloaded 'new_ESLconnection' in /usr/share/pear/ESL.php on line 117
Any ideas?
regards Helmut
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
_______________________________________________ FreeSWITCH-users mailing listFreeSWITCH-users@lists.freeswitch.orghttp://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-usershttp://www.frees...
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
Hi Samuel, unfortunately I haven't, yet. I found that the "new_ESLconnection function doesn't like a php resource as parameter like a socket, but rather a file descriptor like a numeric pointer. Unfortunately I have no idea how to convert a socket to such a file descriptor in php. Maybe there is a function in the socket object but I don't think so. So far as we didn't solve this problem here, I using my own php functions to read and write from/to incomming connections from freeswitch like this: function fs_send($csock, $cmd) { if (strlen($cmd) < 1) { acd_log(LOG_ERR, "Empty command\n"); return false; } $clen=strlen($cmd); if ($bytes_written = socket_write($csock, "$cmd\n\n", $clen) === false) { acd_log(LOG_ERR, "Can't send cmd! Wrote $bytes_written bytes\n"); socket_write($csock, "\n\n"); return false; } return true; } function fs_recv($csock, &$rbuf) { $i=0; $buf=""; do { acd_log(LOG_DEBUG, "Reading from socket '$csock'.\n"); if (($tbuf = socket_read($csock, 10000)) === false) { acd_log(LOG_ERR, "Can't read from client socket! (".socket_last_error($csock)."/".socket_strerror(socket_last_error($csock)).")\n"); return false; } acd_log(LOG_DEBUG, "Read ".strlen($tbuf)." bytes from socket '$csock'.\n"); $buf .= $tbuf; $i++; } while (substr($buf, -2) != "\n\n" and $i <10); foreach (explode("\n", $buf) as $t) { list($key, $val) = explode(": ", $t); $rbuf[strtolower($key)]=$val; } return true; } acd_log() is just my own logging functions. you can replace it with echo() or so. You can build on this functions more abstract functions like fs_connect(), fs_sendRecv(), ... The command format is as described on FS wiki (http://wiki.freeswitch.org/wiki/Event_socket_outbound) That works quite good, but using the phpmod for esl would be more easy.. regards Helmut On 17.06.2010 03:50, Samuel Macedo wrote:
Hi Helmut,
I got the same error: "No matching function for overloaded 'new_ESLconnection' in /usr/share/php/ESL.php"
Have you solved the problem?
Thanks, -- Samuel Macedo
On 12 June 2010 14:59, Helmut Kuper <helmut.kuper@ewetel.de> wrote:
Hi Michael,
ESL is built and installed, phpmod is built and installed.
inbound works, test scripts works
It is just the problem of passing an existing socket to new ESLconnection. A socket resource is denied, an integer is accepted but is rejected with "bad file descriptor"
Am 12.06.2010 07:06, schrieb Michael Collins:
Make sure the ESL is properly built and that the PHP mod is built and installed. If you did a "make current" recently the you'll need to rebuild your ESL stuff. -MC
On Fri, Jun 11, 2010 at 5:12 PM, Helmut Kuper <helmut.kuper@ewetel.de>wrote:
Hello,
I try to setup a php daemon which uses ESL.
I run the sample php scripts successfully (inbound). Now I want to have it outbound to my php daemon socket.
The forked child process which has to interact with incoming tcp connection from FS is started successfully. So in this state I have the client socket which I have to pass now somehow to ESLconnection I guess.
FS ruby wiki gives this as an example:
@con = ESL::ESLconnection.new(client_socket.fileno)
In php I try this:
$con = new ESLconnection($csock);
As a result I got this error:
PHP Fatal error: No matching function for overloaded 'new_ESLconnection' in /usr/share/pear/ESL.php on line 117
Any ideas?
regards Helmut
Hi, a bit success now. When I use this command: $con = new ESLconnection(intval($csock)); I got an ESLconnection object, but it is not usable. var_dump($con) shows object(ESLconnection)#1 (1) { ["_cPtr"]=> resource(7) of type (_p_ESLconnection) } which looks good to me, but strace still shows "Bad file descriptor": setsockopt(6, SOL_TCP, TCP_NODELAY, [1], 4) = -1 EBADF (Bad file descriptor) sendto(6, "connect\n\n", 9, 0, NULL, 0) = -1 EBADF (Bad file descriptor) Calling $con->getINFO() results in NULL ... regards Helmut
Hello, I found a solution which seems to works for me so far. At least I can use esl-phpmod now. Problem is, that php's socket_accept() functions returns a resource instead of a file descriptor. So esl-phpmod has to find out the corresponding file descriptor before "new ESLconnection()" is called. Here my svn diff for the FS ESL developer to get it reviewed: Index: php/esl_wrap.cpp =================================================================== --- php/esl_wrap.cpp (Revision 17782) +++ php/esl_wrap.cpp (Arbeitskopie) @@ -1793,7 +1793,7 @@ ZEND_NAMED_FUNCTION(_wrap_new_ESLconnection__SWIG_2) { - int arg1 ; + int arg1, type, *p; ESLconnection *result = 0 ; zval **args[1]; @@ -1806,6 +1806,12 @@ /*@SWIG:/usr/local/share/swig/1.3.35/php4/utils.i,7,CONVERT_INT_IN@*/ convert_to_long_ex(args[0]); arg1 = (int) Z_LVAL_PP(args[0]); + //Find the needed numeric file descriptor + //First get the Resource object + p=(int*)zend_list_find(arg1, &type); + if (!p) goto fail; + //Second, get the file descriptor + arg1 = *p; /*@SWIG@*/; result = (ESLconnection *)new ESLconnection(arg1); @@ -1825,9 +1831,7 @@ argc = ZEND_NUM_ARGS(); zend_get_parameters_array_ex(argc,argv); if (argc == 1) { - int _v; - _v = (Z_TYPE_PP(argv[0]) == IS_LONG); - if (_v) { + if (Z_TYPE_PP(argv[0]) == IS_RESOURCE) { return _wrap_new_ESLconnection__SWIG_2(INTERNAL_FUNCTION_PARAM_PASSTHRU); } } regards Helmut On 17.06.2010 09:55, Helmut Kuper wrote:
Hi,
a bit success now. When I use this command:
$con = new ESLconnection(intval($csock));
I got an ESLconnection object, but it is not usable. var_dump($con) shows
object(ESLconnection)#1 (1) { ["_cPtr"]=> resource(7) of type (_p_ESLconnection) }
which looks good to me, but strace still shows "Bad file descriptor":
setsockopt(6, SOL_TCP, TCP_NODELAY, [1], 4) = -1 EBADF (Bad file descriptor) sendto(6, "connect\n\n", 9, 0, NULL, 0) = -1 EBADF (Bad file descriptor)
Calling $con->getINFO() results in NULL ...
regards Helmut
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- Mit freundlichen Grüßen Helmut Kuper Geschäftseinheit FD - Lösungen für Finanzdienstleister Telefax: (0441) 8000-2799 mailto:helmut.kuper@ewetel.de ___________________________________ EWE TEL GmbH Cloppenburger Straße 310 26133 Oldenburg EWE TEL GmbH Handelsregister Amtsgericht Oldenburg HRB 3723 Vorsitzender des Aufsichtsrates: Dr. Werner Brinker Geschäftsführung: Hans-Joachim Iken (Vorsitzender), Ulf Heggenberger, Dr. Norbert Schulz, Dirk Thole Homepage: http://www.ewetel.de ___________________________________
Hi Helmut, Thanks for the patch. I'll try it. Regards, -- Samuel Macedo On 18 June 2010 12:42, Helmut Kuper <helmut.kuper@ewetel.de> wrote:
Hello,
I found a solution which seems to works for me so far. At least I can use esl-phpmod now.
Problem is, that php's socket_accept() functions returns a resource instead of a file descriptor. So esl-phpmod has to find out the corresponding file descriptor before "new ESLconnection()" is called.
Here my svn diff for the FS ESL developer to get it reviewed:
Index: php/esl_wrap.cpp =================================================================== --- php/esl_wrap.cpp (Revision 17782) +++ php/esl_wrap.cpp (Arbeitskopie) @@ -1793,7 +1793,7 @@
ZEND_NAMED_FUNCTION(_wrap_new_ESLconnection__SWIG_2) { - int arg1 ; + int arg1, type, *p; ESLconnection *result = 0 ; zval **args[1];
@@ -1806,6 +1806,12 @@ /*@SWIG:/usr/local/share/swig/1.3.35/php4/utils.i,7,CONVERT_INT_IN@*/ convert_to_long_ex(args[0]); arg1 = (int) Z_LVAL_PP(args[0]); + //Find the needed numeric file descriptor + //First get the Resource object + p=(int*)zend_list_find(arg1, &type); + if (!p) goto fail; + //Second, get the file descriptor + arg1 = *p; /*@SWIG@*/;
result = (ESLconnection *)new ESLconnection(arg1); @@ -1825,9 +1831,7 @@ argc = ZEND_NUM_ARGS(); zend_get_parameters_array_ex(argc,argv); if (argc == 1) { - int _v; - _v = (Z_TYPE_PP(argv[0]) == IS_LONG); - if (_v) { + if (Z_TYPE_PP(argv[0]) == IS_RESOURCE) { return _wrap_new_ESLconnection__SWIG_2(INTERNAL_FUNCTION_PARAM_PASSTHRU); } }
regards Helmut
On 17.06.2010 09:55, Helmut Kuper wrote:
Hi,
a bit success now. When I use this command:
$con = new ESLconnection(intval($csock));
I got an ESLconnection object, but it is not usable. var_dump($con) shows
object(ESLconnection)#1 (1) { ["_cPtr"]=> resource(7) of type (_p_ESLconnection) }
which looks good to me, but strace still shows "Bad file descriptor":
setsockopt(6, SOL_TCP, TCP_NODELAY, [1], 4) = -1 EBADF (Bad file descriptor) sendto(6, "connect\n\n", 9, 0, NULL, 0) = -1 EBADF (Bad file descriptor)
Calling $con->getINFO() results in NULL ...
regards Helmut
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
--
Mit freundlichen Grüßen Helmut Kuper Geschäftseinheit FD - Lösungen für Finanzdienstleister Telefax: (0441) 8000-2799 mailto:helmut.kuper@ewetel.de ___________________________________ EWE TEL GmbH Cloppenburger Straße 310 26133 Oldenburg EWE TEL GmbH
Handelsregister Amtsgericht Oldenburg HRB 3723 Vorsitzender des Aufsichtsrates: Dr. Werner Brinker Geschäftsführung: Hans-Joachim Iken (Vorsitzender), Ulf Heggenberger, Dr. Norbert Schulz, Dirk Thole Homepage: http://www.ewetel.de ___________________________________
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
Helmut, I've applied the patch and it's working well. Thanks for your help. Regards, -- Samuel Macedo On 18 June 2010 13:07, Samuel Macedo <macedoslm@gmail.com> wrote:
Hi Helmut,
Thanks for the patch. I'll try it.
Regards, -- Samuel Macedo
On 18 June 2010 12:42, Helmut Kuper <helmut.kuper@ewetel.de> wrote:
Hello,
I found a solution which seems to works for me so far. At least I can use esl-phpmod now.
Problem is, that php's socket_accept() functions returns a resource instead of a file descriptor. So esl-phpmod has to find out the corresponding file descriptor before "new ESLconnection()" is called.
Here my svn diff for the FS ESL developer to get it reviewed:
Index: php/esl_wrap.cpp =================================================================== --- php/esl_wrap.cpp (Revision 17782) +++ php/esl_wrap.cpp (Arbeitskopie) @@ -1793,7 +1793,7 @@
ZEND_NAMED_FUNCTION(_wrap_new_ESLconnection__SWIG_2) { - int arg1 ; + int arg1, type, *p; ESLconnection *result = 0 ; zval **args[1];
@@ -1806,6 +1806,12 @@ /*@SWIG:/usr/local/share/swig/1.3.35/php4/utils.i,7,CONVERT_INT_IN@*/ convert_to_long_ex(args[0]); arg1 = (int) Z_LVAL_PP(args[0]); + //Find the needed numeric file descriptor + //First get the Resource object + p=(int*)zend_list_find(arg1, &type); + if (!p) goto fail; + //Second, get the file descriptor + arg1 = *p; /*@SWIG@*/;
result = (ESLconnection *)new ESLconnection(arg1); @@ -1825,9 +1831,7 @@ argc = ZEND_NUM_ARGS(); zend_get_parameters_array_ex(argc,argv); if (argc == 1) { - int _v; - _v = (Z_TYPE_PP(argv[0]) == IS_LONG); - if (_v) { + if (Z_TYPE_PP(argv[0]) == IS_RESOURCE) { return _wrap_new_ESLconnection__SWIG_2(INTERNAL_FUNCTION_PARAM_PASSTHRU); } }
regards Helmut
On 17.06.2010 09:55, Helmut Kuper wrote:
Hi,
a bit success now. When I use this command:
$con = new ESLconnection(intval($csock));
I got an ESLconnection object, but it is not usable. var_dump($con) shows
object(ESLconnection)#1 (1) { ["_cPtr"]=> resource(7) of type (_p_ESLconnection) }
which looks good to me, but strace still shows "Bad file descriptor":
setsockopt(6, SOL_TCP, TCP_NODELAY, [1], 4) = -1 EBADF (Bad file descriptor) sendto(6, "connect\n\n", 9, 0, NULL, 0) = -1 EBADF (Bad file descriptor)
Calling $con->getINFO() results in NULL ...
regards Helmut
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE: http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
--
Mit freundlichen Grüßen Helmut Kuper Geschäftseinheit FD - Lösungen für Finanzdienstleister Telefax: (0441) 8000-2799 mailto:helmut.kuper@ewetel.de ___________________________________ EWE TEL GmbH Cloppenburger Straße 310 26133 Oldenburg EWE TEL GmbH
Handelsregister Amtsgericht Oldenburg HRB 3723 Vorsitzender des Aufsichtsrates: Dr. Werner Brinker Geschäftsführung: Hans-Joachim Iken (Vorsitzender), Ulf Heggenberger, Dr. Norbert Schulz, Dirk Thole Homepage: http://www.ewetel.de ___________________________________
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
That's unacceptable. you cannot patch a generated swig file. you need to learn what function in php gives you the raw file descriptor number from your socket and pass that to the constructor as required. The whole time your problem is that you don't know how to do this in PHP so you should stop looking in the code and just find the php method of a socket object to product the real file descriptor. On Fri, Jun 18, 2010 at 11:36 AM, Samuel Macedo <macedoslm@gmail.com> wrote:
Helmut,
I've applied the patch and it's working well. Thanks for your help.
Regards, -- Samuel Macedo
On 18 June 2010 13:07, Samuel Macedo <macedoslm@gmail.com> wrote:
Hi Helmut,
Thanks for the patch. I'll try it.
Regards, -- Samuel Macedo
On 18 June 2010 12:42, Helmut Kuper <helmut.kuper@ewetel.de> wrote:
Hello,
I found a solution which seems to works for me so far. At least I can use esl-phpmod now.
Problem is, that php's socket_accept() functions returns a resource instead of a file descriptor. So esl-phpmod has to find out the corresponding file descriptor before "new ESLconnection()" is called.
Here my svn diff for the FS ESL developer to get it reviewed:
Index: php/esl_wrap.cpp =================================================================== --- php/esl_wrap.cpp (Revision 17782) +++ php/esl_wrap.cpp (Arbeitskopie) @@ -1793,7 +1793,7 @@
ZEND_NAMED_FUNCTION(_wrap_new_ESLconnection__SWIG_2) { - int arg1 ; + int arg1, type, *p; ESLconnection *result = 0 ; zval **args[1];
@@ -1806,6 +1806,12 @@ /*@SWIG:/usr/local/share/swig/1.3.35/php4/utils.i,7,CONVERT_INT_IN@*/ convert_to_long_ex(args[0]); arg1 = (int) Z_LVAL_PP(args[0]); + //Find the needed numeric file descriptor + //First get the Resource object + p=(int*)zend_list_find(arg1, &type); + if (!p) goto fail; + //Second, get the file descriptor + arg1 = *p; /*@SWIG@*/;
result = (ESLconnection *)new ESLconnection(arg1); @@ -1825,9 +1831,7 @@ argc = ZEND_NUM_ARGS(); zend_get_parameters_array_ex(argc,argv); if (argc == 1) { - int _v; - _v = (Z_TYPE_PP(argv[0]) == IS_LONG); - if (_v) { + if (Z_TYPE_PP(argv[0]) == IS_RESOURCE) { return _wrap_new_ESLconnection__SWIG_2(INTERNAL_FUNCTION_PARAM_PASSTHRU); } }
regards Helmut
On 17.06.2010 09:55, Helmut Kuper wrote:
Hi,
a bit success now. When I use this command:
$con = new ESLconnection(intval($csock));
I got an ESLconnection object, but it is not usable. var_dump($con) shows
object(ESLconnection)#1 (1) { ["_cPtr"]=> resource(7) of type (_p_ESLconnection) }
which looks good to me, but strace still shows "Bad file descriptor":
setsockopt(6, SOL_TCP, TCP_NODELAY, [1], 4) = -1 EBADF (Bad file descriptor) sendto(6, "connect\n\n", 9, 0, NULL, 0) = -1 EBADF (Bad file descriptor)
Calling $con->getINFO() results in NULL ...
regards Helmut
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE: http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
--
Mit freundlichen Grüßen Helmut Kuper Geschäftseinheit FD - Lösungen für Finanzdienstleister Telefax: (0441) 8000-2799 mailto:helmut.kuper@ewetel.de ___________________________________ EWE TEL GmbH Cloppenburger Straße 310 26133 Oldenburg EWE TEL GmbH
Handelsregister Amtsgericht Oldenburg HRB 3723 Vorsitzender des Aufsichtsrates: Dr. Werner Brinker Geschäftsführung: Hans-Joachim Iken (Vorsitzender), Ulf Heggenberger, Dr. Norbert Schulz, Dirk Thole Homepage: http://www.ewetel.de ___________________________________
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- Anthony Minessale II FreeSWITCH http://www.freeswitch.org/ ClueCon http://www.cluecon.com/ Twitter: http://twitter.com/FreeSWITCH_wire AIM: anthm MSN:anthony_minessale@hotmail.com <MSN%3Aanthony_minessale@hotmail.com> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com<PAYPAL%3Aanthony.minessale@gmail.com> IRC: irc.freenode.net #freeswitch FreeSWITCH Developer Conference sip:888@conference.freeswitch.org <sip%3A888@conference.freeswitch.org> googletalk:conf+888@conference.freeswitch.org<googletalk%3Aconf%2B888@conference.freeswitch.org> pstn:+19193869900
Hi Anthony, yes, understand. Well, I've searched a few hours for a way to get it, but I found no - at least not in my centos standard php installation and not in Google. I found some hints (or requests) about dio_rawfd() there, but it seems such a function doesn't exists. If you or any other here have an idea where to look except adapting the code I would like to know it. You are right saying patching autogenerated code is a bad idea. But this is the only way I found so far. Maybe regards helmut Am 18.06.2010 19:08, schrieb Anthony Minessale:
That's unacceptable. you cannot patch a generated swig file.
you need to learn what function in php gives you the raw file descriptor number from your socket and pass that to the constructor as required.
The whole time your problem is that you don't know how to do this in PHP so you should stop looking in the code and just find the php method of a socket object to product the real file descriptor.
if php does not let you get the raw file descriptor from a socket, I will actually make an extra effort to make fun of them for being silly to take such an important thing away from a programmer. I am going to stick to the hope that they are not that foolish. maybe you can make your own binary php module to do it =p On Fri, Jun 18, 2010 at 1:55 PM, Helmut Kuper <helmut.kuper@ewetel.de>wrote:
Hi Anthony,
yes, understand. Well, I've searched a few hours for a way to get it, but I found no - at least not in my centos standard php installation and not in Google. I found some hints (or requests) about dio_rawfd() there, but it seems such a function doesn't exists.
If you or any other here have an idea where to look except adapting the code I would like to know it. You are right saying patching autogenerated code is a bad idea. But this is the only way I found so far. Maybe
regards helmut
Am 18.06.2010 19:08, schrieb Anthony Minessale:
That's unacceptable. you cannot patch a generated swig file.
you need to learn what function in php gives you the raw file descriptor number from your socket and pass that to the constructor as required.
The whole time your problem is that you don't know how to do this in PHP so you should stop looking in the code and just find the php method of a socket object to product the real file descriptor.
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- Anthony Minessale II FreeSWITCH http://www.freeswitch.org/ ClueCon http://www.cluecon.com/ Twitter: http://twitter.com/FreeSWITCH_wire AIM: anthm MSN:anthony_minessale@hotmail.com <MSN%3Aanthony_minessale@hotmail.com> GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com<PAYPAL%3Aanthony.minessale@gmail.com> IRC: irc.freenode.net #freeswitch FreeSWITCH Developer Conference sip:888@conference.freeswitch.org <sip%3A888@conference.freeswitch.org> googletalk:conf+888@conference.freeswitch.org<googletalk%3Aconf%2B888@conference.freeswitch.org> pstn:+19193869900
Hello, I found a solution which seems to works for me so far. At least I can use esl-phpmod now. Problem is, that php's socket_accept() functions returns a resource instead of a file descriptor. So esl-phpmod has to find out the corresponding file descriptor before "new ESLconnection()" is called. Here my svn diff for the FS ESL developer to get it reviewed: Index: php/esl_wrap.cpp =================================================================== --- php/esl_wrap.cpp (Revision 17782) +++ php/esl_wrap.cpp (Arbeitskopie) @@ -1793,7 +1793,7 @@ ZEND_NAMED_FUNCTION(_wrap_new_ESLconnection__SWIG_2) { - int arg1 ; + int arg1, type, *p; ESLconnection *result = 0 ; zval **args[1]; @@ -1806,6 +1806,12 @@ /*@SWIG:/usr/local/share/swig/1.3.35/php4/utils.i,7,CONVERT_INT_IN@*/ convert_to_long_ex(args[0]); arg1 = (int) Z_LVAL_PP(args[0]); + //Find the needed numeric file descriptor + //First get the Resource object + p=(int*)zend_list_find(arg1, &type); + if (!p) goto fail; + //Second, get the file descriptor + arg1 = *p; /*@SWIG@*/; result = (ESLconnection *)new ESLconnection(arg1); @@ -1825,9 +1831,7 @@ argc = ZEND_NUM_ARGS(); zend_get_parameters_array_ex(argc,argv); if (argc == 1) { - int _v; - _v = (Z_TYPE_PP(argv[0]) == IS_LONG); - if (_v) { + if (Z_TYPE_PP(argv[0]) == IS_RESOURCE) { return _wrap_new_ESLconnection__SWIG_2(INTERNAL_FUNCTION_PARAM_PASSTHRU); } } regards Helmut On 17.06.2010 09:55, Helmut Kuper wrote:
Hi,
a bit success now. When I use this command:
$con = new ESLconnection(intval($csock));
I got an ESLconnection object, but it is not usable. var_dump($con) shows
object(ESLconnection)#1 (1) { ["_cPtr"]=> resource(7) of type (_p_ESLconnection) }
which looks good to me, but strace still shows "Bad file descriptor":
setsockopt(6, SOL_TCP, TCP_NODELAY, [1], 4) = -1 EBADF (Bad file descriptor) sendto(6, "connect\n\n", 9, 0, NULL, 0) = -1 EBADF (Bad file descriptor)
Calling $con->getINFO() results in NULL ...
regards Helmut
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
participants (4)
-
Anthony Minessale
-
Helmut Kuper
-
Michael Collins
-
Samuel Macedo