[Freeswitch-users] Transfer using lua no bleg present
Michael Collins
msc at freeswitch.org
Fri Jul 6 08:28:41 MSD 2012
I honestly don't mean to be a smart alleck, but the warning "No B-leg
present" is exactly what is wrong. This is a one-legged call into a Lua
script, therefore there is only the A-leg. That means this line is
incorrect:
session:execute("transfer", "-bleg " .. orig_transfer_digits .. " XML " ..
orig_ucon)
The session that the Lua script is controlling is not bridged to another
leg (which would be the B-leg) and so there is no reason to try and
transfer the B-leg. Perhaps you could just do a simple transfer?
-MC
On Thu, Jul 5, 2012 at 7:07 PM, KPS Maillinglist <ksims.ml at gmail.com> wrote:
> Hi All,
> I have a issue where when i transfer a call using lua. It tells me that
> "[WARNING] mod_dptools.c:976 No B-leg present."
>
> Below you will find some background info:
>
> @@@@@@@@@@ Log:
> http://pastebin.freeswitch.org/19458
>
> @@@@@@@@@@ lua file relevant potions
> ########## dx_script.lua ######################
> session:setAutoHangup(false)
>
> session:answer();
> session:set_tts_parms("cepstral", "amy");
>
> -- session:execute("", "")
>
> digits = session:read(4, 11, "tone_stream://%(10000,0,350,440)", 5000, "#")
> write_FS_LOG("Got dtmf: ", digits)
>
> --freeswitch.consoleLog("info", "Got dtmf: ".. digits .."\n");
> --session:execute("read", "11 11 'tone_stream://%(10000,0,350,440)' digits
> 5000 #")
> session:execute("export","orig_transfer_digits=" .. digits)
> session:setVariable("orig_transfer_digits", digits)
> session:setVariable("orig_user_context",usr_context)
> session:execute("export","orig_user_context=" .. usr_context)
> atoit = string.sub(dst_number, 4)
> session:execute("transfer", "is_transfer-" .. atoit .. " XML FEATURES")
>
>
> write_FS_LOG("Script End Time: ", os.date("%Y-%m-%d %X"))
>
> ############### is_transfer_script.lua ######################
>
> if string.find(dst_number, "-") ~= nil then
> dst_num_context_str = string.split(dst_number,"-")
> for dncs_index,dncs_str in pairs(dst_num_context_str) do
> -- do some stuff
> write_FS_LOG("DCNS Index", string.format("dcns_ind%s", dncs_index))
> write_FS_LOG("DCNS VAR", string.format("%s", dncs_str))
> session:setVariable("dcns_ind" .. dncs_index, dncs_str)
> orig_ucon = dncs_str
> end
> end
> -- orig_ucon = session:getVariable("dcns_ind2")
> -- orig_ucon = dcns_ind2
> write_FS_LOG("orig_ucon", orig_ucon)
>
> if orig_ucon == nil then
> write_FS_ERRLOG("Missing data", "Missing user originating context")
> write_FS_LOG("Script End Time", os.date("%Y-%m-%d %X"))
> session:hangup()
> else
> write_FS_LOG("Recieved Context - Continuing...", orig_ucon)
> end
>
> if session:getVariable("orig_transfer_digits") == nil then
> write_FS_ERRLOG("Missing data",
> "session:getVariable(orig_transfer_digits)")
> write_FS_LOG("Script End Time", os.date("%Y-%m-%d %X"))
> session:hangup()
> else
> write_FS_LOG("Recieved digits - Continuing...",
> session:getVariable("orig_transfer_digits"))
> end
>
> -- session:execute("info","")
> -- session:execute("info","")
>
> -- orig_user_context = session:getVariable("orig_user_context")
> orig_transfer_digits = session:getVariable("orig_transfer_digits")
>
> write_FS_LOG("Script: ", "regsrv is_transfer_script.lua")
> write_FS_LOG("Script Start Time: ", os.date("%Y-%m-%d %X"))
> session:setAutoHangup(false)
>
> session:answer();
> session:set_tts_parms("cepstral", "amy");
>
> -- session:execute("", "")
>
> session:execute("transfer", "-bleg " .. orig_transfer_digits .. " XML " ..
> orig_ucon)
>
>
> write_FS_LOG("Script End Time: ", os.date("%Y-%m-%d %X"))
>
>
> @@@@@@@@@@ dialplan<document type="freeswitch/xml"> <section
> name="dialplan" description="FreeSWITCH Dialplan"> <context
> name="FEATURES"> <extension name="DX"> <condition
> field="destination_number" expression="^DX-.*"> <action
> application="lua" data="/fs/scripts/users/dx_script.lua"/>
> </condition> </extension> <extension name="is_transfer">
> <condition field="destination_number" expression="^is_transfer-.*">
> <action application="lua"
> data="/fs/scripts/users/is_transfer_script.lua"/> <anti-action
> application="eval" data="cancel transfer"/> </condition>
> </extension> </context> </section>
> </document>
>
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting at freeswitch.org
> http://www.freeswitchsolutions.com
>
>
>
>
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://wiki.freeswitch.org
> http://www.cluecon.com
>
> Join Us At ClueCon - Aug 7-9, 2012
>
> FreeSWITCH-users mailing list
> FreeSWITCH-users at lists.freeswitch.org
> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
> http://www.freeswitch.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20120705/6165bbe2/attachment-0001.html
Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-users
mailing list