[Freeswitch-users] ESL, phpmod

Anthony Minessale anthony.minessale at gmail.com
Fri Jun 18 10:08:23 PDT 2010


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 at 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 at 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 at 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 at 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 at 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 at 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 at 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 at hotmail.com <MSN%3Aanthony_minessale at hotmail.com>
GTALK/JABBER/PAYPAL:anthony.minessale at gmail.com<PAYPAL%3Aanthony.minessale at gmail.com>
IRC: irc.freenode.net #freeswitch

FreeSWITCH Developer Conference
sip:888 at conference.freeswitch.org <sip%3A888 at conference.freeswitch.org>
googletalk:conf+888 at conference.freeswitch.org<googletalk%3Aconf%2B888 at conference.freeswitch.org>
pstn:+19193869900
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20100618/509b3c75/attachment-0001.html 


More information about the FreeSWITCH-users mailing list