Sponsor: VoiceMeUp - Corporate & Wholesale VoIP Services

VoIP Mailing List Archives
Mailing list archives for the VoIP community
 SearchSearch 

[Freeswitch-users] Action and Anti-Action


 
Post new topic   Reply to topic    VoIP Mailing List Archives Forum Index -> freeSWITCH Users
View previous topic :: View next topic  
Author Message
telles-listas at devel...
Guest





PostPosted: Thu Mar 26, 2009 9:36 am    Post subject: [Freeswitch-users] Action and Anti-Action Reply with quote

Hi Guys,

I'm trying to do some string matching against a created var and looks like I am doing something wrong but I can't find whats it.

I'm wrote an extension just for tests purposes on dialplan/default.xml:

<extension name="nat_detect" continue="true">
<condition>
<action application="set" data="nated=${cond(${network_addr} != ${sip_contact_host} ? 1 : 0)}"/>
</condition>
<condition field="${nated}" expression="1">
<action application="log" data="Action=${nated}"/>
<action application="set" data="proxy_media=true"/>
<action application="set" data="sip_nat_detected=true"/>
<anti-action application="log" data="Anti-Action=${nated}"/>
</condition>
</extension>

Using two SIP extensions (1000 and 1001) behind NAT and I expected too see "Action=1" on the logs/console, but I'm seeing "Anti-Action=1".

2009-03-26 11:02:57 [DEBUG] switch_core_state_machine.c:152 switch_core_standard_on_execute() sofia/internal/1001@x.x.x.x ([email]sofia/internal/1001@x.x.x.x[/email]) Execute set(nated=${cond(${network_addr} != ${sip_contact_host} ? 1 : 0)})
2009-03-26 11:02:57 [DEBUG] switch_core_session.c:1286 switch_core_session_exec() sofia/internal/1001@x.x.x.x ([email]sofia/internal/1001@x.x.x.x[/email]) Expanded String set(nated=1)
2009-03-26 11:02:57 [DEBUG] mod_dptools.c:711 set_function() sofia/internal/1001@x.x.x.x ([email]sofia/internal/1001@x.x.x.x[/email]) SET [nated]=[1]
2009-03-26 11:02:57 [DEBUG] switch_core_state_machine.c:152 switch_core_standard_on_execute() sofia/internal/1001@x.x.x.x ([email]sofia/internal/1001@x.x.x.x[/email]) Execute log(Anti-Action=${nated})
2009-03-26 11:02:57 [DEBUG] switch_core_session.c:1286 switch_core_session_exec() sofia/internal/1001@x.x.x.x ([email]sofia/internal/1001@x.x.x.x[/email]) Expanded String log(Anti-Action=1)
2009-03-26 11:02:57 [DEBUG] mod_dptools.c:895 log_function() Anti-Action=1
2009-03-26 11:02:57 [DEBUG] switch_core_state_machine.c:152 switch_core_standard_on_execute() sofia/internal/1001@x.x.x.x ([email]sofia/internal/1001@x.x.x.x[/email]) Execute set(dialed_extension=1000)
....

I really appreciate any inputs.
I'm using FS 1.0.3 stable.

regards,
Rodrigo Telles
Back to top
mike at jerris.com
Guest





PostPosted: Thu Mar 26, 2009 10:34 am    Post subject: [Freeswitch-users] Action and Anti-Action Reply with quote

Actions are all run AFTER all conditions are parsed so the nated var is not set yet. you can do a single condition in this case, and set nated for use elsewhere if you need it in the actions.

Mike

On Mar 26, 2009, at 10:27 AM, Rodrigo P. Telles wrote:
Quote:
Hi Guys,

I'm trying to do some string matching against a created var and looks like I am doing something wrong but I can't find whats it.

I'm wrote an extension just for tests purposes on dialplan/default.xml:

<extension name="nat_detect" continue="true">
<condition>
<action application="set" data="nated=${cond(${network_addr} != ${sip_contact_host} ? 1 : 0)}"/>
</condition>
<condition field="${nated}" expression="1">
<action application="log" data="Action=${nated}"/>
<action application="set" data="proxy_media=true"/>
<action application="set" data="sip_nat_detected=true"/>
<anti-action application="log" data="Anti-Action=${nated}"/>
</condition>
</extension>

Using two SIP extensions (1000 and 1001) behind NAT and I expected too see "Action=1" on the logs/console, but I'm seeing "Anti-Action=1".

2009-03-26 11:02:57 [DEBUG] switch_core_state_machine.c:152 switch_core_standard_on_execute() sofia/internal/1001@x.x.x.x ([email]sofia/internal/1001@x.x.x.x[/email]) Execute set(nated=${cond(${network_addr} != ${sip_contact_host} ? 1 : 0)})
2009-03-26 11:02:57 [DEBUG] switch_core_session.c:1286 switch_core_session_exec() sofia/internal/1001@x.x.x.x ([email]sofia/internal/1001@x.x.x.x[/email]) Expanded String set(nated=1)
2009-03-26 11:02:57 [DEBUG] mod_dptools.c:711 set_function() sofia/internal/1001@x.x.x.x ([email]sofia/internal/1001@x.x.x.x[/email]) SET [nated]=[1]
2009-03-26 11:02:57 [DEBUG] switch_core_state_machine.c:152 switch_core_standard_on_execute() sofia/internal/1001@x.x.x.x ([email]sofia/internal/1001@x.x.x.x[/email]) Execute log(Anti-Action=${nated})
2009-03-26 11:02:57 [DEBUG] switch_core_session.c:1286 switch_core_session_exec() sofia/internal/1001@x.x.x.x ([email]sofia/internal/1001@x.x.x.x[/email]) Expanded String log(Anti-Action=1)
2009-03-26 11:02:57 [DEBUG] mod_dptools.c:895 log_function() Anti-Action=1
2009-03-26 11:02:57 [DEBUG] switch_core_state_machine.c:152 switch_core_standard_on_execute() sofia/internal/1001@x.x.x.x ([email]sofia/internal/1001@x.x.x.x[/email]) Execute set(dialed_extension=1000)
....

I really appreciate any inputs.
I'm using FS 1.0.3 stable.

regards,
Rodrigo Telles


_______________________________________________
Freeswitch-users mailing list
Freeswitch-users@lists.freeswitch.org (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
Back to top
msc at freeswitch.org
Guest





PostPosted: Thu Mar 26, 2009 11:13 am    Post subject: [Freeswitch-users] Action and Anti-Action Reply with quote

Look in the default.xml dialplan file for the "tod_example" extension.
(It's near the top of the file.) It has an example of how to create an
extension that simply sets a variable that can be used in other
extensions in the dialplan.

-MC

2009/3/26 Rodrigo P. Telles <telles-listas@devel-it.com.br>:
Quote:
Hi Guys,

I'm trying to do some string matching against a created var and looks like I
am doing something wrong but I can't find whats it.

I'm wrote an extension just for tests purposes on dialplan/default.xml:

<extension name="nat_detect" continue="true">
     <condition>
        <action application="set" data="nated=${cond(${network_addr} !=
${sip_contact_host} ? 1 : 0)}"/>
     </condition>
     <condition field="${nated}" expression="1">
       <action application="log" data="Action=${nated}"/>
       <action application="set" data="proxy_media=true"/>
       <action application="set" data="sip_nat_detected=true"/>
       <anti-action application="log" data="Anti-Action=${nated}"/>
     </condition>
</extension>

Using two SIP extensions (1000 and 1001) behind NAT and I expected too see
"Action=1" on the logs/console, but I'm seeing "Anti-Action=1".

2009-03-26 11:02:57 [DEBUG] switch_core_state_machine.c:152
switch_core_standard_on_execute() sofia/internal/1001@x.x.x.x Execute
set(nated=${cond(${network_addr} != ${sip_contact_host} ? 1 : 0)})
2009-03-26 11:02:57 [DEBUG] switch_core_session.c:1286
switch_core_session_exec() sofia/internal/1001@x.x.x.x Expanded String
set(nated=1)
2009-03-26 11:02:57 [DEBUG] mod_dptools.c:711 set_function()
sofia/internal/1001@x.x.x.x SET [nated]=[1]
2009-03-26 11:02:57 [DEBUG] switch_core_state_machine.c:152
switch_core_standard_on_execute() sofia/internal/1001@x.x.x.x Execute
log(Anti-Action=${nated})
2009-03-26 11:02:57 [DEBUG] switch_core_session.c:1286
switch_core_session_exec() sofia/internal/1001@x.x.x.x Expanded String
log(Anti-Action=1)
2009-03-26 11:02:57 [DEBUG] mod_dptools.c:895 log_function() Anti-Action=1
2009-03-26 11:02:57 [DEBUG] switch_core_state_machine.c:152
switch_core_standard_on_execute() sofia/internal/1001@x.x.x.x Execute
set(dialed_extension=1000)
....

I really appreciate any inputs.
I'm using FS 1.0.3 stable.

regards,
Rodrigo Telles


_______________________________________________
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



_______________________________________________
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
Back to top
brian at freeswitch.org
Guest





PostPosted: Thu Mar 26, 2009 11:25 am    Post subject: [Freeswitch-users] Action and Anti-Action Reply with quote

Remember the dialplan is parsed, installed into the session then sent into the execute state. The dialplan is NOT execute line by line as it goes thru the dialplan. Which means you can not set a var on one line then condition on that var on the next line because the var isn't set yet... Remember its like a todo list one by one its compiled but not executed yet.

This is usually an alien concept when you're migrating from various other telephony software.

/b

On Mar 26, 2009, at 11:07 AM, Michael Collins wrote:
Quote:
Look in the default.xml dialplan file for the "tod_example" extension.
(It's near the top of the file.) It has an example of how to create an
extension that simply sets a variable that can be used in other
extensions in the dialplan.

-MC


Brian West
brian@freeswitch.org (brian@freeswitch.org)



-- Meet us a ClueCon! http://www.cluecon.com
Back to top
telles-listas at devel...
Guest





PostPosted: Thu Mar 26, 2009 5:34 pm    Post subject: [Freeswitch-users] Action and Anti-Action Reply with quote

Hi Mike,

Using a single condition did the trick, thanks Smile
Based on Brian's explanation the example from http://wiki.freeswitch.org/wiki/Proxy_Media is buggy...

regards,
Rodrigo Telles

Michael Jerris wrote:
Quote:
Actions are all run AFTER all conditions are parsed so the nated var is not set yet. you can do a single condition in this case, and set nated for use elsewhere if you need it in the actions.

Mike

On Mar 26, 2009, at 10:27 AM, Rodrigo P. Telles wrote:
Quote:
Hi Guys,

I'm trying to do some string matching against a created var and looks like I am doing something wrong but I can't find whats it.

I'm wrote an extension just for tests purposes on dialplan/default.xml:

<extension name="nat_detect" continue="true">
<condition>
<action application="set" data="nated=${cond(${network_addr} != ${sip_contact_host} ? 1 : 0)}"/>
</condition>
<condition field="${nated}" expression="1">
<action application="log" data="Action=${nated}"/>
<action application="set" data="proxy_media=true"/>
<action application="set" data="sip_nat_detected=true"/>
<anti-action application="log" data="Anti-Action=${nated}"/>
</condition>
</extension>

Using two SIP extensions (1000 and 1001) behind NAT and I expected too see "Action=1" on the logs/console, but I'm seeing "Anti-Action=1".

2009-03-26 11:02:57 [DEBUG] switch_core_state_machine.c:152 switch_core_standard_on_execute() sofia/internal/1001@x.x.x.x ([email]sofia/internal/1001@x.x.x.x[/email]) Execute set(nated=${cond(${network_addr} != ${sip_contact_host} ? 1 : 0)})
2009-03-26 11:02:57 [DEBUG] switch_core_session.c:1286 switch_core_session_exec() sofia/internal/1001@x.x.x.x ([email]sofia/internal/1001@x.x.x.x[/email]) Expanded String set(nated=1)
2009-03-26 11:02:57 [DEBUG] mod_dptools.c:711 set_function() sofia/internal/1001@x.x.x.x ([email]sofia/internal/1001@x.x.x.x[/email]) SET [nated]=[1]
2009-03-26 11:02:57 [DEBUG] switch_core_state_machine.c:152 switch_core_standard_on_execute() sofia/internal/1001@x.x.x.x ([email]sofia/internal/1001@x.x.x.x[/email]) Execute log(Anti-Action=${nated})
2009-03-26 11:02:57 [DEBUG] switch_core_session.c:1286 switch_core_session_exec() sofia/internal/1001@x.x.x.x ([email]sofia/internal/1001@x.x.x.x[/email]) Expanded String log(Anti-Action=1)
2009-03-26 11:02:57 [DEBUG] mod_dptools.c:895 log_function() Anti-Action=1
2009-03-26 11:02:57 [DEBUG] switch_core_state_machine.c:152 switch_core_standard_on_execute() sofia/internal/1001@x.x.x.x ([email]sofia/internal/1001@x.x.x.x[/email]) Execute set(dialed_extension=1000)
....

I really appreciate any inputs.
I'm using FS 1.0.3 stable.

regards,
Rodrigo Telles




Back to top
Display posts from previous:   
Post new topic   Reply to topic    VoIP Mailing List Archives Forum Index -> freeSWITCH Users All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group

VoiceMeUp - Corporate & Wholesale VoIP Services