首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Freeswitch起源于python esl的扩展

Freeswitch起源于python esl的扩展
EN

Stack Overflow用户
提问于 2014-12-15 18:57:14
回答 1查看 1.2K关注 0票数 0

嘿,我有一个关于freeswitch和python esl的问题。

通过命令"pyrun“,我调用了我的脚本(script.py),它看起来像这样:

代码语言:javascript
复制
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是我的分机号码:

代码语言:javascript
复制
<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看起来像这样:

代码语言:javascript
复制
def handler(session, args):
    session.answer()
    logging.basicConfig(filename='/tmp/test.log',level=logging.INFO)
    logging.info('LOG SOMETHING FOR TEST')
    session.hangup()

这是freeswitch生成的输出:

代码语言:javascript
复制
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从未执行过。如果你需要更多信息,尽管告诉我。希望有人能帮我。

EN

回答 1

Stack Overflow用户

发布于 2015-01-12 14:19:57

您的呼叫从未被应答,因此python脚本也从未被调用。你的索非亚分机好像有点问题。呼叫挂断,原因是"NORMAL_TEMPORARY_FAILURE“

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/27482484

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档