Hi Helmut,<div><br></div><div>Thanks for the patch. I'll try it.</div><div><br></div><div>Regards,</div><div>--</div><div>Samuel Macedo<br><br><div class="gmail_quote">On 18 June 2010 12:42, Helmut Kuper <span dir="ltr"><<a href="mailto:helmut.kuper@ewetel.de">helmut.kuper@ewetel.de</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hello,<br>
<br>
I found a solution which seems to works for me so far. At least I can<br>
use esl-phpmod now.<br>
<br>
Problem is, that php's socket_accept() functions returns a resource<br>
instead of a file descriptor. So esl-phpmod has to find out the<br>
corresponding file descriptor before "new ESLconnection()" is called.<br>
<br>
Here my svn diff for the FS ESL developer to get it reviewed:<br>
<br>
Index: php/esl_wrap.cpp<br>
===================================================================<br>
--- php/esl_wrap.cpp (Revision 17782)<br>
+++ php/esl_wrap.cpp (Arbeitskopie)<br>
@@ -1793,7 +1793,7 @@<br>
<br>
<br>
ZEND_NAMED_FUNCTION(_wrap_new_ESLconnection__SWIG_2) {<br>
- int arg1 ;<br>
+ int arg1, type, *p;<br>
ESLconnection *result = 0 ;<br>
zval **args[1];<br>
<br>
@@ -1806,6 +1806,12 @@<br>
/*@SWIG:/usr/local/share/swig/1.3.35/php4/utils.i,7,CONVERT_INT_IN@*/<br>
convert_to_long_ex(args[0]);<br>
arg1 = (int) Z_LVAL_PP(args[0]);<br>
+ //Find the needed numeric file descriptor<br>
+ //First get the Resource object<br>
+ p=(int*)zend_list_find(arg1, &type);<br>
+ if (!p) goto fail;<br>
+ //Second, get the file descriptor<br>
+ arg1 = *p;<br>
/*@SWIG@*/;<br>
<br>
result = (ESLconnection *)new ESLconnection(arg1);<br>
@@ -1825,9 +1831,7 @@<br>
argc = ZEND_NUM_ARGS();<br>
zend_get_parameters_array_ex(argc,argv);<br>
if (argc == 1) {<br>
- int _v;<br>
- _v = (Z_TYPE_PP(argv[0]) == IS_LONG);<br>
- if (_v) {<br>
+ if (Z_TYPE_PP(argv[0]) == IS_RESOURCE) {<br>
return<br>
_wrap_new_ESLconnection__SWIG_2(INTERNAL_FUNCTION_PARAM_PASSTHRU);<br>
}<br>
}<br>
<br>
<br>
<br>
regards<br>
Helmut<br>
<div><div></div><div class="h5"><br>
<br>
On 17.06.2010 09:55, Helmut Kuper wrote:<br>
> Hi,<br>
><br>
> a bit success now. When I use this command:<br>
><br>
> $con = new ESLconnection(intval($csock));<br>
><br>
> I got an ESLconnection object, but it is not usable. var_dump($con) shows<br>
><br>
> object(ESLconnection)#1 (1) {<br>
> ["_cPtr"]=><br>
> resource(7) of type (_p_ESLconnection)<br>
> }<br>
><br>
><br>
> which looks good to me, but strace still shows "Bad file descriptor":<br>
><br>
> setsockopt(6, SOL_TCP, TCP_NODELAY, [1], 4) = -1 EBADF (Bad file descriptor)<br>
> sendto(6, "connect\n\n", 9, 0, NULL, 0) = -1 EBADF (Bad file descriptor)<br>
><br>
> Calling $con->getINFO() results in NULL ...<br>
><br>
><br>
> regards<br>
> Helmut<br>
><br>
> _______________________________________________<br>
> FreeSWITCH-users mailing list<br>
> <a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br>
> <a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
> UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
> <a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
><br>
><br>
<br>
</div></div>--<br>
<br>
Mit freundlichen Grüßen<br>
Helmut Kuper<br>
Geschäftseinheit FD - Lösungen für Finanzdienstleister<br>
Telefax: (0441) 8000-2799<br>
mailto:<a href="mailto:helmut.kuper@ewetel.de">helmut.kuper@ewetel.de</a><br>
___________________________________<br>
EWE TEL GmbH<br>
Cloppenburger Straße 310<br>
26133 Oldenburg<br>
EWE TEL GmbH<br>
<br>
Handelsregister Amtsgericht Oldenburg HRB 3723<br>
Vorsitzender des Aufsichtsrates: Dr. Werner Brinker<br>
Geschäftsführung: Hans-Joachim Iken (Vorsitzender),<br>
Ulf Heggenberger, Dr. Norbert Schulz, Dirk Thole<br>
Homepage: <a href="http://www.ewetel.de" target="_blank">http://www.ewetel.de</a><br>
___________________________________<br>
<div><div></div><div class="h5"><br>
_______________________________________________<br>
FreeSWITCH-users mailing list<br>
<a href="mailto:FreeSWITCH-users@lists.freeswitch.org">FreeSWITCH-users@lists.freeswitch.org</a><br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-users</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-users" target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-users</a><br>
<a href="http://www.freeswitch.org" target="_blank">http://www.freeswitch.org</a><br>
</div></div></blockquote></div><br></div>