嘿,我遇到了freeswitch和python esl的问题。
在命令" piun"我调用我的脚本(script.py),如下所示:
import ESL
con = ESL.ESLconnection('127.0.0.1', '8021', 'ClueCon')
if con.connected:
con.api("originate", "{ignore_early_media=true}sofia/internal/411@$1 1000")
411是我的分机号码:
<include>
<extension name="welcome_ivr" continue="true">
<condition field="destination_number" expression="^411$">
<action application="answer" />
<action application="python" data="script2"/>
</condition>
</extension>
</include>
并且script2看起来像这样:
def handler(session, args):
session.answer()
logging.basicConfig(filename='/tmp/test.log',level=logging.INFO)
logging.info('LOG SOMETHING FOR TEST')
session.hangup()
这是输出freeswitch生成:
2014-12-15 11:51:37.120264 [DEBUG] switch_ivr_originate.c:2079 Parsing global variables
2014-12-15 11:51:37.120264 [DEBUG] switch_event.c:1688 Parsing variable [ignore_early_media]=[true]
2014-12-15 11:51:37.120264 [NOTICE] switch_channel.c:1055 New Channel sofia/internal/411@$1 [5b6994c1-8b36-49db-a04d-1281c018fa22]
2014-12-15 11:51:37.120264 [DEBUG] mod_sofia.c:4615 (sofia/internal/411@$1) State Change CS_NEW -> CS_INIT
2014-12-15 11:51:37.120264 [DEBUG] switch_core_session.c:1388 Send signal sofia/internal/411@$1 [BREAK]
2014-12-15 11:51:37.120264 [DEBUG] switch_core_state_machine.c:472 (sofia/internal/411@$1) Running State Change CS_INIT
2014-12-15 11:51:37.120264 [DEBUG] switch_core_state_machine.c:512 (sofia/internal/411@$1) State INIT
2014-12-15 11:51:37.120264 [DEBUG] mod_sofia.c:87 sofia/internal/411@$1 SOFIA INIT
2014-12-15 11:51:37.120264 [DEBUG] sofia_glue.c:1232 sofia/internal/411@$1 sending invite version: 1.5.15b git b9c25ea 2014-12-01 21:10:06Z 32bit
Local SDP:
v=0
o=FreeSWITCH 1418612965 1418612966 IN IP4 192.168.185.131
s=FreeSWITCH
c=IN IP4 192.168.185.131
t=0 0
m=audio 27732 RTP/AVP 102 9 0 8 3 101 13
a=rtpmap:102 opus/48000/2
a=fmtp:102 useinbandfec=1; usedtx=1; maxaveragebitrate=30000; maxplaybackrate=48000; ptime=20; minptime=20; maxptime=20; samplerate=48000
a=rtpmap:9 G722/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:3 GSM/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=sendrecv
2014-12-15 11:51:37.120264 [DEBUG] switch_core_state_machine.c:40 sofia/internal/411@$1 Standard INIT
2014-12-15 11:51:37.120264 [DEBUG] switch_core_state_machine.c:48 (sofia/internal/411@$1) State Change CS_INIT -> CS_ROUTING
2014-12-15 11:51:37.120264 [DEBUG] switch_core_session.c:1388 Send signal sofia/internal/411@$1 [BREAK]
2014-12-15 11:51:37.120264 [DEBUG] switch_core_state_machine.c:512 (sofia/internal/411@$1) State INIT going to sleep
2014-12-15 11:51:37.120264 [DEBUG] switch_core_session.c:1053 Send signal sofia/internal/411@$1 [BREAK]
2014-12-15 11:51:37.120264 [DEBUG] switch_core_state_machine.c:472 (sofia/internal/411@$1) Running State Change CS_ROUTING
2014-12-15 11:51:37.120264 [DEBUG] sofia.c:6614 Channel sofia/internal/411@$1 entering state [calling][0]
2014-12-15 11:51:37.120264 [DEBUG] switch_core_state_machine.c:528 (sofia/internal/411@$1) State ROUTING
2014-12-15 11:51:37.120264 [DEBUG] mod_sofia.c:123 sofia/internal/411@$1 SOFIA ROUTING
2014-12-15 11:51:37.120264 [DEBUG] switch_ivr_originate.c:67 (sofia/internal/411@$1) State Change CS_ROUTING -> CS_CONSUME_MEDIA
2014-12-15 11:51:37.120264 [DEBUG] switch_core_session.c:1388 Send signal sofia/internal/411@$1 [BREAK]
2014-12-15 11:51:37.120264 [DEBUG] switch_core_state_machine.c:528 (sofia/internal/411@$1) State ROUTING going to sleep
2014-12-15 11:51:37.120264 [DEBUG] switch_core_state_machine.c:472 (sofia/internal/411@$1) Running State Change CS_CONSUME_MEDIA
2014-12-15 11:51:37.120264 [DEBUG] switch_core_state_machine.c:547 (sofia/internal/411@$1) State CONSUME_MEDIA
2014-12-15 11:51:37.120264 [DEBUG] switch_core_state_machine.c:547 (sofia/internal/411@$1) State CONSUME_MEDIA going to sleep
2014-12-15 11:51:37.140087 [DEBUG] switch_core_session.c:1053 Send signal sofia/internal/411@$1 [BREAK]
2014-12-15 11:51:37.140087 [DEBUG] switch_core_session.c:1053 Send signal sofia/internal/411@$1 [BREAK]
2014-12-15 11:51:37.140087 [DEBUG] switch_core_session.c:1053 Send signal sofia/internal/411@$1 [BREAK]
2014-12-15 11:51:37.140087 [DEBUG] sofia.c:6614 Channel sofia/internal/411@$1 entering state [terminated][503]
2014-12-15 11:51:37.140087 [NOTICE] sofia.c:7530 Hangup sofia/internal/411@$1 [CS_CONSUME_MEDIA] [NORMAL_TEMPORARY_FAILURE]
2014-12-15 11:51:37.140087 [DEBUG] switch_channel.c:3222 Send signal sofia/internal/411@$1 [KILL]
2014-12-15 11:51:37.140087 [DEBUG] switch_core_session.c:1388 Send signal sofia/internal/411@$1 [BREAK]
2014-12-15 11:51:37.140087 [DEBUG] switch_core_state_machine.c:472 (sofia/internal/411@$1) Running State Change CS_HANGUP
2014-12-15 11:51:37.140087 [DEBUG] switch_core_state_machine.c:735 (sofia/internal/411@$1) Callstate Change DOWN -> HANGUP
2014-12-15 11:51:37.140087 [DEBUG] switch_core_state_machine.c:737 (sofia/internal/411@$1) State HANGUP
2014-12-15 11:51:37.140087 [DEBUG] mod_sofia.c:413 Channel sofia/internal/411@$1 hanging up, cause: NORMAL_TEMPORARY_FAILURE
2014-12-15 11:51:37.140087 [DEBUG] switch_core_state_machine.c:60 sofia/internal/411@$1 Standard HANGUP, cause: NORMAL_TEMPORARY_FAILURE
2014-12-15 11:51:37.140087 [DEBUG] switch_core_state_machine.c:737 (sofia/internal/411@$1) State HANGUP going to sleep
2014-12-15 11:51:37.140087 [DEBUG] switch_core_state_machine.c:504 (sofia/internal/411@$1) State Change CS_HANGUP -> CS_REPORTING
2014-12-15 11:51:37.140087 [DEBUG] switch_core_session.c:1388 Send signal sofia/internal/411@$1 [BREAK]
2014-12-15 11:51:37.140087 [DEBUG] switch_core_state_machine.c:472 (sofia/internal/411@$1) Running State Change CS_REPORTING
2014-12-15 11:51:37.140087 [DEBUG] switch_core_state_machine.c:823 (sofia/internal/411@$1) State REPORTING
2014-12-15 11:51:37.140087 [DEBUG] switch_core_state_machine.c:104 sofia/internal/411@$1 Standard REPORTING, cause: NORMAL_TEMPORARY_FAILURE
2014-12-15 11:51:37.140087 [DEBUG] switch_core_state_machine.c:823 (sofia/internal/411@$1) State REPORTING going to sleep
2014-12-15 11:51:37.140087 [DEBUG] switch_core_state_machine.c:498 (sofia/internal/411@$1) State Change CS_REPORTING -> CS_DESTROY
2014-12-15 11:51:37.140087 [DEBUG] switch_core_session.c:1388 Send signal sofia/internal/411@$1 [BREAK]
2014-12-15 11:51:37.140087 [DEBUG] switch_core_session.c:1615 Session 28 (sofia/internal/411@$1) Locked, Waiting on external entities
2014-12-15 11:51:37.140087 [DEBUG] switch_ivr_originate.c:3698 Originate Resulted in Error Cause: 41 [NORMAL_TEMPORARY_FAILURE]
2014-12-15 11:51:37.140087 [NOTICE] switch_core_session.c:1633 Session 28 (sofia/internal/411@$1) Ended
2014-12-15 11:51:37.140087 [NOTICE] switch_core_session.c:1637 Close Channel sofia/internal/411@$1 [CS_DESTROY]
2014-12-15 11:51:37.140087 [DEBUG] switch_core_state_machine.c:626 (sofia/internal/411@$1) Running State Change CS_DESTROY
2014-12-15 11:51:37.140087 [DEBUG] switch_core_state_machine.c:636 (sofia/internal/411@$1) State DESTROY
2014-12-15 11:51:37.140087 [DEBUG] mod_sofia.c:323 sofia/internal/411@$1 SOFIA DESTROY
2014-12-15 11:51:37.140087 [DEBUG] switch_core_state_machine.c:111 sofia/internal/411@$1 Standard DESTROY
2014-12-15 11:51:37.140087 [DEBUG] switch_core_state_machine.c:636 (sofia/internal/411@$1) State DESTROY going to sleep
所以我的问题是没有日志意味着script2从未被执行过。如果您需要更多信息,请告诉我。希望有人可以帮助我。
答案 0 :(得分:0)
你的电话从未得到回答,因此python脚本从未被调用过。您的索菲亚延伸似乎有些问题。呼叫因挂断原因而死亡,并且#34; NORMAL_TEMPORARY_FAILURE&#34;