the scenario that you described is just ideal for two different contexts. Why do you want to have them in one?
Of course you can set a variable in an "inline" action in the beginning of a context, like this:
<action application="set" data="call_direction=inbound" inline="true"/>
and later in the dialplan, use this variable in conditions.
Also the variable can be assigned at the SIP gateway, then incoming calls will have it automatically:
<gateway name="gateway012">
<param name="realm" value="sip.voipcarrier.com" />
<param name="username" value="WBrandes" />
<param name="password" value="myvoiceismypassword" />
<param name="register" value="true" />
<param name="caller-id-in-from" value="true" />
<param name="ping" value="5" />
<param name="ping-max" value="3" />
<param name="retry-seconds" value="5" />
<param name="expire-seconds" value="60" />
<variables>
<variable name="this_is_inbound_call" value="true" direction="inbound"/>
</variables>
</gateway>direction="inbound" means to apply this variable for inbound calls.
From: Siri MM <sirimmfs@gmail.com>
To: FreeSWITCH Users Help <FreeSWITCH-users@lists.freeswitch.org>
Sent: Monday, September 30, 2013 9:27 AM
Subject: [Freeswitch-users] Differentiating internal/external calls
Hi,
Is it possible for me to have two sets of dialplans - one for
incoming (to FS) and other for outgoing (from FS), in the same context? On receiving an incoming call, I want to run through only a subset of xmls, and give up on not hitting, and the same for outbound - is this feasible? Or any channel variable that would help me differentiate between a external call and internal call?
Thanks!