[Freeswitch-users] Transfer using lua no bleg present

KPS Maillinglist ksims.ml at gmail.com
Fri Jul 6 06:07:39 MSD 2012


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>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20120705/90974c97/attachment.html 


Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-users mailing list