EvoluxBR / greenswitch

Battle proven FreeSWITCH Event Socket Protocol client implementation with Gevent
Other
126 stars 50 forks source link

args #50

Closed CraftedCat closed 4 years ago

CraftedCat commented 4 years ago

How to send some args to socket? i used mod_commands, and use originate &(socket) via API

italorossi commented 4 years ago

You can use channel variables for that:

or originate {my_arg=my_value}user/1000 &socket(...)

You'll have access to my_arg at your python code.

CraftedCat commented 4 years ago

via sys.argv not accessable...

italorossi commented 4 years ago

Not in sys module, look at the channel variables.

CraftedCat commented 4 years ago

i set channel vars api originate {userid=userid, ignore_early_media=true... how to print userid? in esl socket?

CraftedCat commented 4 years ago

help, please :(

italorossi commented 4 years ago

print(self.sessiondata.get('variable userid'))

CraftedCat commented 4 years ago

File "out_esl.py", line 50, in safe_run print(self.sessiondata.get('variable userid')) AttributeError: 'MyApplication' object has no attribute 'session_data'

italorossi commented 4 years ago

Can you share your code? A gist would be sufficient.

CraftedCat commented 4 years ago

right code: print(self.session.session_data.get('variable_userid')) Thank you