Hi stefan,

that´s cool, but it do not solve my problem. I want to start a function on the 
pythonserver with php. To start something on a phpserver with php and to start 
something on a pythonserver with python i managed already, but i´am unable or 
to stupid to put this things together.

paul

-----Ursprüngliche Nachricht-----
Von: Stefan Sayer [mailto:[EMAIL PROTECTED] 
Gesendet: Freitag, 30. Mai 2008 00:47
An: Schroeder, Paul
Cc: [EMAIL PROTECTED]
Betreff: Re: [Semsdev] xml-rpc



o Schroeder, Paul [05/29/08 19:03]:
> Hello,
> 
> i want to activate a pythonfunction via xml-rpc from a phpsite, how can i do 
> this?
you can either modify xmlrpc2di module to expose functions from ivr scripts, or 
you can simply use python xmlrpc server and start it as extra thread when the 
script is compiled using ivr.createThread, like this

from SimpleXMLRPCServer import *

class MyServer(SimpleXMLRPCServer):
   ...
   def _dispatch(self, method, params):
                 try:
                         func = getattr(self, 'export_' + method)
                 except AttributeError:
                         raise Exception('method "%s" is not supported' 
% method)
                 else:
                         return func(*params) ###### exported functions:
    def export_ping(self):
                 return [1]

server = MyServer((listen_addr, listen_port)) class run_obj:
        def run(self):
                debug("running server...")
                 server.serve_forever()

t = run_obj()
ivr.createThread(t)

the funny thing is that you can call properties from the server when your call 
is running, e.g.:

class IvrDialog(IvrDialogBase):
       ...
     def onSessionStart(self, hdrs):
                 ...
                 server.some_func(self.dialog.callid)

hth
Stefan
> 
> paul
> _______________________________________________
> Semsdev mailing list
> [email protected]
> http://lists.iptel.org/mailman/listinfo/semsdev

--
Stefan Sayer
VoIP Services

[EMAIL PROTECTED]
www.iptego.com

iptego GmbH
Am Borsigturm 40
13507 Berlin
Germany

Amtsgericht Charlottenburg, HRB 101010
Geschaeftsfuehrer: Alexander Hoffmann
_______________________________________________
Semsdev mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/semsdev

Reply via email to