[Freeswitch-users] mod_python and new Session from freeswitch.Session

Андрей Асташов astashov.andrey at gmail.com
Fri Oct 7 16:29:23 MSD 2016


Hi Guys.

>From Dialplan run scripts in Python, from which I perform
freeswitch.session("......"). That is, create a new session. And if I do
not get an answer for a long time from the gateway, the execution of other
scripts in Python is delayed until such time as the session will not be
installed.

Please tell me how you can create a new session, and do not block
completely mod_python. I understand that once had to be done through ESL,
but now everything has already been written by the script from the
dialplan. And it works, if it does not create a new session.

freeswitch at Test-Environment>
#
# Execute python script from fs_cli(in dialer mode):
#   fs_cli --retry --batchmode --interrupt --execute="python
python_test_script"
#
2016-10-07 17:55:29.970991 [NOTICE] mod_python.c:212 Invoking py module:
python_test_script
2016-10-07 17:55:30.119989 [NOTICE] switch_cpp.cpp:1360
-->(489d5441-701d-4a98-80ca-3389b00fa98a) Create a new session through
freeswitch.Session("sofia/gateway/Goip_One/+71234567890 at 192.168.100.28:5060
")
2016-10-07 17:55:30.119989 [NOTICE] switch_channel.c:1104 New Channel
sofia/external-g-eth0.nostun.noauth/%2B71234567890 at 192.168.100.28:5060
[489d5441-701d-4a98-80ca-3389b00fa98a]
freeswitch at Test-Environment>
#
# New incoming call
#
2016-10-07 17:55:33.920114 [NOTICE] switch_channel.c:1104 New Channel
sofia/external-g-eth0.stun.auth/384851 at 1.2.3.4
[e11d39b8-0479-4d4b-bd8b-28634f0a970a]
2016-10-07 17:55:33.920114 [INFO] mod_dialplan_xml.c:637 Processing 384851
<384851>->318386 in context hive-context
#
# Execute second python script from dialplan:
#
2016-10-07 17:55:33.920114 [NOTICE] mod_python.c:212 Invoking py module:
python_test_script
freeswitch at Test-Environment>
#
# 12 seconds of silence during which any python script will not be executed
and will be expected to complete
#
freeswitch at Test-Environment>
2016-10-07 17:55:45.140231 [NOTICE] sofia.c:8078 Hangup
sofia/external-g-eth0.nostun.noauth/%2B71234567890 at 192.168.100.28:5060
[CS_CONSUME_MEDIA] [UNALLOCATED_NUMBER]
2016-10-07 17:55:45.160086 [NOTICE] switch_cpp.cpp:1360
-->(489d5441-701d-4a98-80ca-3389b00fa98a) After Create a new session
through freeswitch.Session
2016-10-07 17:55:45.160086 [NOTICE] switch_core_session.c:1665 Session 15
(sofia/external-g-eth0.nostun.noauth/%2B71234567890 at 192.168.100.28:5060)
Ended
2016-10-07 17:55:45.160086 [NOTICE] switch_core_session.c:1669 Close
Channel sofia/external-g-eth0.nostun.noauth/%
2B71234567890 at 192.168.100.28:5060 [CS_DESTROY]
#
# Continue executing second python script(from 2016-10-07 17:55:33.920114)
after any answer from first python new freeswitch.Session
#
2016-10-07 17:55:45.160086 [ALERT] switch_cpp.cpp:1360 (mtid:3656):
Traceback 280920161717(e11d39b8-0479-4d4b-bd8b-28634f0a970a): --> 12 <--;
now: 1475841345; python_start_time:1475841333;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20161007/cd0486cb/attachment.html 


Join us at ClueCon 2016 Aug 8-12, 2016
More information about the FreeSWITCH-users mailing list