start_dtmf when no RFC 2833
Hi All, The following dial plan detects RFC 2833 and if it is not present, runs the "start_dtmf" application. <condition field="${switch_r_sdp}" expression="a=rtpmap:(\d+)\stelephone-event/8000" break="never"> <action application="set" data="rtp_payload_number=$1"/> <anti-action application="start_dtmf"/> </condition> I need to do this on the outbound leg - using Lua. Can anyone point me to some code example that would achieve this or get me started? Any help appreciated. Thanks Phil
You could set the "execute_on_answer" variable on the b-leg dialstring to execute the lua script. In the lua script, you'd use session:getVariable("switch_r_sdp") and then some pattern matching to figure out if "telephone-event" is in the SDP. If not, then do session:execute("start_dtmf", "") Chris On Tue, Mar 17, 2015 at 3:05 PM, Phillip Jones <pjintheusa@gmail.com> wrote:
Hi All,
The following dial plan detects RFC 2833 and if it is not present, runs the "start_dtmf" application.
<condition field="${switch_r_sdp}" expression="a=rtpmap:(\d+)\stelephone-event/8000" break="never"> <action application="set" data="rtp_payload_number=$1"/> <anti-action application="start_dtmf"/> </condition>
I need to do this on the outbound leg - using Lua. Can anyone point me to some code example that would achieve this or get me started?
Any help appreciated.
Thanks
Phil
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
Official FreeSWITCH Sites http://www.freeswitch.org http://confluence.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
Thanks Chris. So something like. s = session:getVariable("switch_r_sdp") if string.find(s, "telephone-event/8000") == nil then session.execute("start_dtfm") end Is telephone-event/8000 the correct thing to look for? I guess it is from the dial plan example. On Tue, Mar 17, 2015 at 3:10 PM, Christopher Rienzo <cmrienzo@gmail.com> wrote:
You could set the "execute_on_answer" variable on the b-leg dialstring to execute the lua script. In the lua script, you'd use session:getVariable("switch_r_sdp") and then some pattern matching to figure out if "telephone-event" is in the SDP. If not, then do session:execute("start_dtmf", "")
Chris
On Tue, Mar 17, 2015 at 3:05 PM, Phillip Jones <pjintheusa@gmail.com> wrote:
Hi All,
The following dial plan detects RFC 2833 and if it is not present, runs the "start_dtmf" application.
<condition field="${switch_r_sdp}" expression="a=rtpmap:(\d+)\stelephone-event/8000" break="never"> <action application="set" data="rtp_payload_number=$1"/> <anti-action application="start_dtmf"/> </condition>
I need to do this on the outbound leg - using Lua. Can anyone point me to some code example that would achieve this or get me started?
Any help appreciated.
Thanks
Phil
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
Official FreeSWITCH Sites http://www.freeswitch.org http://confluence.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
Official FreeSWITCH Sites http://www.freeswitch.org http://confluence.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
Use session:execute("start_dtmf", "") and it should work. Chris On Tue, Mar 17, 2015 at 3:29 PM, Phillip Jones <pjintheusa@gmail.com> wrote:
Thanks Chris.
So something like.
s = session:getVariable("switch_r_sdp")
if string.find(s, "telephone-event/8000") == nil then
session.execute("start_dtfm")
end
Is telephone-event/8000 the correct thing to look for? I guess it is from the dial plan example.
On Tue, Mar 17, 2015 at 3:10 PM, Christopher Rienzo <cmrienzo@gmail.com> wrote:
You could set the "execute_on_answer" variable on the b-leg dialstring to execute the lua script. In the lua script, you'd use session:getVariable("switch_r_sdp") and then some pattern matching to figure out if "telephone-event" is in the SDP. If not, then do session:execute("start_dtmf", "")
Chris
On Tue, Mar 17, 2015 at 3:05 PM, Phillip Jones <pjintheusa@gmail.com> wrote:
Hi All,
The following dial plan detects RFC 2833 and if it is not present, runs the "start_dtmf" application.
<condition field="${switch_r_sdp}" expression="a=rtpmap:(\d+)\stelephone-event/8000" break="never"> <action application="set" data="rtp_payload_number=$1"/> <anti-action application="start_dtmf"/> </condition>
I need to do this on the outbound leg - using Lua. Can anyone point me to some code example that would achieve this or get me started?
Any help appreciated.
Thanks
Phil
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
Official FreeSWITCH Sites http://www.freeswitch.org http://confluence.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
Official FreeSWITCH Sites http://www.freeswitch.org http://confluence.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
Official FreeSWITCH Sites http://www.freeswitch.org http://confluence.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
It is. The regex checking a=rtpmap too would be more 'correct', but in practice you'll only see that string on that line. Since telephone-event has no static payload type assigned you'll always see the a=rtpmap line for it, so you don't need to worry about non-verbose SDP. On 17 March 2015 at 19:29, Phillip Jones <pjintheusa@gmail.com> wrote:
Thanks Chris.
So something like.
s = session:getVariable("switch_r_sdp")
if string.find(s, "telephone-event/8000") == nil then
session.execute("start_dtfm")
end
Is telephone-event/8000 the correct thing to look for? I guess it is from the dial plan example.
On Tue, Mar 17, 2015 at 3:10 PM, Christopher Rienzo <cmrienzo@gmail.com> wrote:
You could set the "execute_on_answer" variable on the b-leg dialstring to execute the lua script. In the lua script, you'd use session:getVariable("switch_r_sdp") and then some pattern matching to figure out if "telephone-event" is in the SDP. If not, then do session:execute("start_dtmf", "")
Chris
On Tue, Mar 17, 2015 at 3:05 PM, Phillip Jones <pjintheusa@gmail.com> wrote:
Hi All,
The following dial plan detects RFC 2833 and if it is not present, runs the "start_dtmf" application.
<condition field="${switch_r_sdp}" expression="a=rtpmap:(\d+)\stelephone-event/8000" break="never"> <action application="set" data="rtp_payload_number=$1"/> <anti-action application="start_dtmf"/> </condition>
I need to do this on the outbound leg - using Lua. Can anyone point me to some code example that would achieve this or get me started?
Any help appreciated.
Thanks
Phil
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
Official FreeSWITCH Sites http://www.freeswitch.org http://confluence.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
Official FreeSWITCH Sites http://www.freeswitch.org http://confluence.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
Official FreeSWITCH Sites http://www.freeswitch.org http://confluence.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
Appreciated. Thanks On Tue, Mar 17, 2015 at 4:38 PM, Steven Ayre <steveayre@gmail.com> wrote:
It is. The regex checking a=rtpmap too would be more 'correct', but in practice you'll only see that string on that line.
Since telephone-event has no static payload type assigned you'll always see the a=rtpmap line for it, so you don't need to worry about non-verbose SDP.
On 17 March 2015 at 19:29, Phillip Jones <pjintheusa@gmail.com> wrote:
Thanks Chris.
So something like.
s = session:getVariable("switch_r_sdp")
if string.find(s, "telephone-event/8000") == nil then
session.execute("start_dtfm")
end
Is telephone-event/8000 the correct thing to look for? I guess it is from the dial plan example.
On Tue, Mar 17, 2015 at 3:10 PM, Christopher Rienzo <cmrienzo@gmail.com> wrote:
You could set the "execute_on_answer" variable on the b-leg dialstring to execute the lua script. In the lua script, you'd use session:getVariable("switch_r_sdp") and then some pattern matching to figure out if "telephone-event" is in the SDP. If not, then do session:execute("start_dtmf", "")
Chris
On Tue, Mar 17, 2015 at 3:05 PM, Phillip Jones <pjintheusa@gmail.com> wrote:
Hi All,
The following dial plan detects RFC 2833 and if it is not present, runs the "start_dtmf" application.
<condition field="${switch_r_sdp}" expression="a=rtpmap:(\d+)\stelephone-event/8000" break="never"> <action application="set" data="rtp_payload_number=$1"/> <anti-action application="start_dtmf"/> </condition>
I need to do this on the outbound leg - using Lua. Can anyone point me to some code example that would achieve this or get me started?
Any help appreciated.
Thanks
Phil
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
Official FreeSWITCH Sites http://www.freeswitch.org http://confluence.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE: http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
Official FreeSWITCH Sites http://www.freeswitch.org http://confluence.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
Official FreeSWITCH Sites http://www.freeswitch.org http://confluence.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
_________________________________________________________________________ Professional FreeSWITCH Consulting Services: consulting@freeswitch.org http://www.freeswitchsolutions.com
Official FreeSWITCH Sites http://www.freeswitch.org http://confluence.freeswitch.org http://www.cluecon.com
FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
Just for others looking later, here is the final code I came up with, with rtp_payload extracted. if session:getVariable("switch_r_sdp") ~= nil then local s = '[[' .. session:getVariable("switch_r_sdp") ..']]' if string.find(s, "a=rtpmap:(%d+)%stelephone%-event%/8000") ~= nil then freeswitch.consoleLog("debug", "NO NEED TO START starting spandsp_start_dtmf\n") local payload = string.match(s,"a=rtpmap:(%d+)%stelephone%-event%/8000") if payload ~= nil then freeswitch.consoleLog("debug", "rtp_payload_number = " .. payload .."\n") end else freeswitch.consoleLog("info", "starting spandsp_start_dtmf\n") session:execute("spandsp_start_dtmf") session:sleep(2000) end end Cheers Phil
participants (3)
-
Christopher Rienzo
-
Phillip Jones
-
Steven Ayre