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
___________________________________