User:Birgit bachler/Freeswitch: Difference between revisions
No edit summary |
|||
Line 31: | Line 31: | ||
== Python Dialplan API == | == Python Dialplan API == | ||
getting digits maybe via dialplan? | So foo channel variable is set to the output of the my_script python script: | ||
....getting digits for extenstion maybe via dialplan? | |||
<pre> | |||
<action application="set" | |||
data="foo=${python(my_script)}"/> | data="foo=${python(my_script)}"/> | ||
</pre> | |||
<pre> | |||
<extension name="run_python_script"> | |||
<condition field="destination_number" expression="\d+"> | |||
<action application="play_and_get_digits" data="1 1 3 3000 # file.wav my_digits [12]" /> | |||
<action application="set" data="extension=${python(my_digits)} /> | |||
</condition> | |||
</extension> | |||
</pre> |
Revision as of 15:26, 28 April 2011
Py PlayAndGetDigits
playAndGetDigits(int min_digits, int max_digits, int max_tries, int timeout, char *terminators, char *audio_files, char *bad_input_audio_files, char *digits_regex)
tempfile = "/path/to/song.mp3" in_rslt = self.session.playAndGetDigits(1, 1, 1, 1000, "*#", tempfile, "", "") actual_result = in_rslt[1] if not actual_result: actual_result = int(actual_result)
Python Dialplan API
So foo channel variable is set to the output of the my_script python script: ....getting digits for extenstion maybe via dialplan?
<action application="set" data="foo=${python(my_script)}"/>
<extension name="run_python_script"> <condition field="destination_number" expression="\d+"> <action application="play_and_get_digits" data="1 1 3 3000 # file.wav my_digits [12]" /> <action application="set" data="extension=${python(my_digits)} /> </condition> </extension>