<br><br><div class="gmail_quote">On Wed, Oct 14, 2009 at 3:01 PM, Simon J Mudd <span dir="ltr"><<a href="mailto:sjmudd@pobox.com">sjmudd@pobox.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi again,<br>
<br>
I'm trying to build up a soho dialplan to replicate an existing Asterisk<br>
setup I want to replace.<br>
<br>
I'm editing<br>
/usr/local/freeswitch/conf/dialplan/default/00_mydomain.com.xml to add<br>
some dialplan rules for various destination numbers I'm using. These<br>
dialplans may use one of several gateways I have configured.<br>
<br>
I currently have:<br>
<br>
<include><br>
<extension name="<a href="http://spanish_mobiles.mydomain.com" target="_blank">spanish_mobiles.mydomain.com</a>"><br>
<condition field="destination_number" expression="^(6\d{8})$"><br>
<action application="set" data="effective_caller_id_number=${outbound_caller_id_number}"/><br>
<action application="set" data="effective_caller_id_name=${outbound_caller_id_name}"/><br>
<action application="bridge" data="sofia/gateway/asterisk/$1"/><br>
</condition><br>
</extension><br>
<br>
<extension name="<a href="http://spanish_fijos.mydomain.com" target="_blank">spanish_fijos.mydomain.com</a>"><br>
<condition field="destination_number" expression="^(9\d{8})$"><br>
<action application="set" data="effective_caller_id_number=${outbound_caller_id_number}"/><br>
<action application="set" data="effective_caller_id_name=${outbound_caller_id_name}"/><br>
<action application="bridge" data="sofia/gateway/asterisk/$1"/><br>
</condition><br>
</extension><br>
<br>
... more stuff not shown ...<br>
<br>
</include><br>
<br>
Which routes out to my existing asterisk installation.<br>
<br>
I now want to record all calls. Looking at<br>
<a href="http://wiki.freeswitch.org/wiki/Misc._Dialplan_Tools_record_session" target="_blank">http://wiki.freeswitch.org/wiki/Misc._Dialplan_Tools_record_session</a><br>
it seems I need to add a section like into each entry prior to the<br>
application="bridge".<br>
<br>
<action application="set" data="gateway_name=XXXXX"/><br>
<br>
<action application="set" data="RECORD_TITLE=Recording ${destination_number} ${caller_id_number} ${strftime(%Y-%m-%d %H:%M)}"/><br>
<action application="set" data="RECORD_COPYRIGHT=(C) 2009 my data here."/><br>
<action application="set" data="RECORD_SOFTWARE=FreeSwitch"/><br>
<action application="set" data="RECORD_ARTIST=My name"/><br>
<action application="set" data="RECORD_COMMENT=My comment"/><br>
<action application="set" data="RECORD_DATE=${strftime(%Y-%m-%d %H:%M)}"/><br>
<action application="set" data="RECORD_STEREO=true"/><br>
<action application="record_session" data="$${base_dir}/recordings/${gateway_name}_${strftime(%Y-%m-%d-%H-%M-%S)}_${destination_number}_${caller_id_number}.wav"/><br>
<br>
My question is how do I avoid repeatedly using these same 8-9 lines and<br>
"merge" this into some macro which given the right parameters allows me<br>
to define various extensions using different gateways but all configured<br>
"the same way"?<br>
<br>
Thanks for any pointers to how this should be done.<br></blockquote><div><br>Try using the execute_extension app. It's kinda like a gosub in BASIC: it'll go and execute an extension and then come back and continue executing. Put all those lines into a single extension and then call them from other extensions via execute_extension.<br>
-MC<br></div></div><br>