hello im trying to write a dynamic dialplan module with mod_python. i did the dialplan binding of my module in python configuration file. and im using xml_fetch in my module. everything is ok up to that. But i cannot find how i can access channel variables from my module? (absolutely no docs for this) can someone help how can i dump all channel variables to a file from my module? -- View this message in context: http://freeswitch-users.2379917.n2.nabble.com/mod-python-tp6088430p6088430.h... Sent from the freeswitch-users mailing list archive at Nabble.com.
There's documentation at http://wiki.freeswitch.org/wiki/Mod_python If you're running a script as an app from the dialplan you get a session object and can do session.getVariable("varname"). For the dialplan binding, you don't have a session object so there's no way to get the variables that way. I assume a session has been created by then, but it's simply not passed through the binding API. What do you get for param1 & param in "def xml_fetch(param1, param2)" - perhaps they contain a UUID that you can use? -Steve On 4 March 2011 13:14, hkalyoncu <hkalyoncu@gmail.com> wrote:
hello
im trying to write a dynamic dialplan module with mod_python. i did the dialplan binding of my module in python configuration file. and im using xml_fetch in my module. everything is ok up to that.
But i cannot find how i can access channel variables from my module? (absolutely no docs for this) can someone help how can i dump all channel variables to a file from my module?
-- View this message in context: http://freeswitch-users.2379917.n2.nabble.com/mod-python-tp6088430p6088430.h... Sent from the freeswitch-users mailing list archive at Nabble.com.
_______________________________________________ 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
thanks for your reply that documentation you pointed contains not much info for my case. im not running a script from inside dialplan. as i wrote before im trying to serve dynamic dialplans with mod_python it seems that param1 has a type of some object but i have absolutely no idea what it contains. there is no documentation explaining those params. could anyone help? may the writer of the module give some hints? -- View this message in context: http://freeswitch-users.2379917.n2.nabble.com/mod-python-tp6088430p6092296.h... Sent from the freeswitch-users mailing list archive at Nabble.com.
ok i made some progress. i can get the serialized string of all variables with Event.serialize(params) method But when i try to access directly each channel variables like params["Caller-Caller-ID-Name"] it returns error. is there any way to access each channel variable? -- View this message in context: http://freeswitch-users.2379917.n2.nabble.com/mod-python-tp6088430p6097179.h... Sent from the freeswitch-users mailing list archive at Nabble.com.
On Mon, Mar 7, 2011 at 4:52 AM, hkalyoncu <hkalyoncu@gmail.com> wrote:
ok i made some progress.
i can get the serialized string of all variables with
Event.serialize(params) method
But when i try to access directly each channel variables like
params["Caller-Caller-ID-Name"]
it returns error.
is there any way to access each channel variable?
Try the variable names listed here: http://wiki.freeswitch.org/wiki/Channel_Variables#Info_Application_Variable_...
so for that var try params["caller_id_name'] Let us know. -MC
thanks for your kind reply but im afraid its not working either. anyway i have to do it with serialize method. not a nice solution but at least working :). here is my solution for anybody who needs it : s = Event.serialize(params) s2 = s.replace("\'", "")[:-2] d = dict(item.split(":") for item in s2.split("\n")) caller = d["Caller-Caller-ID-Number"] callee = d["Caller-Destination-Number"] -- View this message in context: http://freeswitch-users.2379917.n2.nabble.com/mod-python-tp6088430p6112761.h... Sent from the freeswitch-users mailing list archive at Nabble.com.
u dont have to serialize! all u have to do is this: caller = Event.getHeader(params, 'Caller-Caller-ID-Number') callee = Event.getHeader(params, 'Caller-Destination-Number') -- View this message in context: http://freeswitch-users.2379917.n2.nabble.com/mod-python-tp6088430p6126290.h... Sent from the freeswitch-users mailing list archive at Nabble.com.
participants (3)
-
hkalyoncu
-
Michael Collins
-
Steven Ayre