0

このダイヤル プランがあり、Python を使用してダイヤル番号を処理したいと考えています。しかし、それはうまくいきませんか?

default.xml (ダイヤルプラン):

<extension name="Run Python">
  <condition field="destination_number" expression="^(?:\+|00)(\d+)$">
    <action application="set" data="effective_caller_id_number=${caller_id_number}"/>
    <action application="python" data="a" />    
 </condition>
</extension>

a.py (主ダイヤル番号ルーター):

import freeswitch
def handler(session, args):
    consoleLog("INFO", "print this please >>>>>>>>>>>>>>!>>>>>>>>>>>>>>>>>>>>!>")

呼び出しが行われたときに機能しない:

2013-09-13 22:55:49.645980 [NOTICE] mod_python.c:212 Invoking py module: a
2013-09-13 22:55:49.645980 [DEBUG] mod_python.c:281 Call python script 
2013-09-13 22:55:49.645980 [DEBUG] mod_python.c:284 Finished calling python script 
2013-09-13 22:55:49.645980 [ERR] mod_python.c:293 Error calling python script
2013-09-13 22:55:49.645980 [ERR] mod_python.c:164 Python Error by calling script "a": <type 'exceptions.NameError'>
Message: global name 'consoleLog' is not defined
Exception: None

Traceback (most recent call last)
    File: "/usr/local/freeswitch/scripts/a.py", line 3, in handler
4

3 に答える 3

2

試す

freeswitch.consoleLog("info","your debug string")
于 2014-05-31T07:15:46.930 に答える
0

使用することもできます

session.execute("log", ">>>>>>>>>>>>>>>>>>");
于 2016-09-21T15:00:08.083 に答える
0

Python は何が問題なのかを教えてくれます: のようなものはありませんconsoleLogfreeswitchこれはモジュールで定義されているものですか?もしそうなら、あなたがしたいfreeswitch.consoleLog

于 2013-09-13T21:17:35.040 に答える