[Freeswitch-users] macros for performing repeated dialplan actions?
Simon J Mudd
sjmudd at pobox.com
Wed Oct 14 15:01:35 PDT 2009
Hi again,
I'm trying to build up a soho dialplan to replicate an existing Asterisk
setup I want to replace.
I'm editing
/usr/local/freeswitch/conf/dialplan/default/00_mydomain.com.xml to add
some dialplan rules for various destination numbers I'm using. These
dialplans may use one of several gateways I have configured.
I currently have:
<include>
<extension name="spanish_mobiles.mydomain.com">
<condition field="destination_number" expression="^(6\d{8})$">
<action application="set" data="effective_caller_id_number=${outbound_caller_id_number}"/>
<action application="set" data="effective_caller_id_name=${outbound_caller_id_name}"/>
<action application="bridge" data="sofia/gateway/asterisk/$1"/>
</condition>
</extension>
<extension name="spanish_fijos.mydomain.com">
<condition field="destination_number" expression="^(9\d{8})$">
<action application="set" data="effective_caller_id_number=${outbound_caller_id_number}"/>
<action application="set" data="effective_caller_id_name=${outbound_caller_id_name}"/>
<action application="bridge" data="sofia/gateway/asterisk/$1"/>
</condition>
</extension>
... more stuff not shown ...
</include>
Which routes out to my existing asterisk installation.
I now want to record all calls. Looking at
http://wiki.freeswitch.org/wiki/Misc._Dialplan_Tools_record_session
it seems I need to add a section like into each entry prior to the
application="bridge".
<action application="set" data="gateway_name=XXXXX"/>
<action application="set" data="RECORD_TITLE=Recording ${destination_number} ${caller_id_number} ${strftime(%Y-%m-%d %H:%M)}"/>
<action application="set" data="RECORD_COPYRIGHT=(C) 2009 my data here."/>
<action application="set" data="RECORD_SOFTWARE=FreeSwitch"/>
<action application="set" data="RECORD_ARTIST=My name"/>
<action application="set" data="RECORD_COMMENT=My comment"/>
<action application="set" data="RECORD_DATE=${strftime(%Y-%m-%d %H:%M)}"/>
<action application="set" data="RECORD_STEREO=true"/>
<action application="record_session" data="$${base_dir}/recordings/${gateway_name}_${strftime(%Y-%m-%d-%H-%M-%S)}_${destination_number}_${caller_id_number}.wav"/>
My question is how do I avoid repeatedly using these same 8-9 lines and
"merge" this into some macro which given the right parameters allows me
to define various extensions using different gateways but all configured
"the same way"?
Thanks for any pointers to how this should be done.
Simon
More information about the FreeSWITCH-users
mailing list