[Freeswitch-users] Originate call into conference - no early media

Alex Crow acrow at integrafin.co.uk
Mon Apr 23 21:29:51 MSD 2012


On 23/04/12 16:09, Anthony Minessale wrote:
> If you originate loopback channels in that manner it chooses raw PCM
> (L16) because it has no idea what other codec to use.
> You want to avoid loopback unless its absolutely necessary since it
> adds extra resource consumption dynamically allocating the audio for
> each frame.
>
> I suggest you study the books we have (not a plug, just that's where
> its best documented) To get the full descriptions of how the dialplan
> and codec stuff works.  It's very complicated and hard to describe in
> a simple reply.


Thanks Anthony,

I do have the FreeSwitch book and just got the cookbook. However I'd not 
come across any docs stating that loopback defaults to L16/8000 so far, 
so perhaps I should reread them.

Is there any reason why loopback can't use L16/16000 or higher so HD 
codecs can be of advantage? Just curious as my new dialplan seems to 
have solved the problem. For anyone else that is interested I have 
pasted it below (it is slightly adapted from the example):

<extension name="confringback">
<condition field="destination_number" expression="^confringback$">
<action application="set" data="ringback=$${uk-ring}"/>
<action application="bridge" 
data="{ignore_early_media=true}loopback/confringback_media"/>
</condition>
</extension>

<extension name="confringback_media">
<condition field="destination_number" expression="^confringback_media$">
<action application="pre_answer"/>
<action application="sleep" data="200000"/>
<action application="hangup"/>
</condition>
</extension>

<extension name="Add new OB call to conference">
<condition field="destination_number" expression="^add_a_call$">
<!-- ask caller for a number + #, collect into ${target_num} variable -->
<action application="play_and_get_digits" data="3 13 4 5000 # 
file_string://ivr/ivr-please_enter_the_phone_number.wav!ivr/ivr-followed_by_pound.wav 
ivr/ivr-that_was_an_invalid_entry.wav target_num \d+"/>
<!-- add this call to the conference -->
<action application="execute_extension" 
data="ADD_CALL_TO_CONF__${target_num}"/>
</condition>
</extension>

<extension name="Remove last OB call added to conference">
<condition field="destination_number" expression="^remove_a_call$">
<!-- remove a call from the conference -->
<action application="play_and_get_digits" data="3 13 1 5000 # 
file_string://ivr/ivr-please_enter_the_phone_number.wav!ivr/ivr-followed_by_pound.wav 
ivr/ivr-that_was_an_invalid_entry.wav target_num \d+"/>
<action application="set" data="res=${uuid_kill 
${hash(select/domain-${domain_name}/last_user_${target_num})}}"/>
<action application="set" data="res=${uuid_kill 
${hash(select/domain-${domain_name}/last_user_ring_${target_num})}}"/>
</condition>
</extension>

<extension name="add that call">
<!-- if we have a four-digit number then attempt to dial it as a user 
... -->
<condition field="destination_number" 
expression="^ADD_CALL_TO_CONF__(2\d{2})$" break="on-true">
<action application="set" data="new_uuid=${create_uuid foo}" inline="true"/>
<action application="set" data="pb_uuid=${create_uuid foo}" inline="true"/>
<action application="hash" 
data="insert/domain-${domain_name}/last_user_$1/${new_uuid}" />
<action application="hash" 
data="insert/domain-${domain_name}/last_user_ring_$1/${pb_uuid}" />
<action application="set" data="res=${bgapi originate 
{origination_uuid=${pb_uuid}}loopback/confringback 
&conference(${conference_name})}"/>
<action application="set" data="res=${bgapi originate 
{origination_uuid=${new_uuid}}sofia/gateway/om.net/$1 
&conference(${conference_name})}"/>
</condition>
<condition field="destination_number" 
expression="^ADD_CALL_TO_CONF__(6\d{2})$" break="on-true">
<action application="set" data="new_uuid=${create_uuid foo}" inline="true"/>
<action application="hash" 
data="insert/domain-${domain_name}/last_user_$1/${new_uuid}" />
<action application="set" data="res=${bgapi originate 
{origination_uuid=${new_uuid}}sofia/gateway/192.168.44.43/$1 
&conference(${conference_name})}"/>
</condition>
<condition field="destination_number" 
expression="^ADD_CALL_TO_CONF__(49\d\d|5[3-4]\d\d|74\d\d|8\d{3}|0|9\d{3,13}|0\d{10,12})$" 
break="on-true">
<action application="set" data="new_uuid=${create_uuid foo}" inline="true"/>
<action application="set" data="pb_uuid=${create_uuid foo}" inline="true"/>
<action application="hash" 
data="insert/domain-${domain_name}/last_user_$1/${new_uuid}" />
<action application="hash" 
data="insert/domain-${domain_name}/last_user_ring_$1/${pb_uuid}" />
<action application="set" data="res=${bgapi originate 
{origination_uuid=${pb_uuid}}loopback/*9181 
&conference(${conference_name})}"/>
<action application="set" data="res=${bgapi originate 
{origination_uuid=${new_uuid},api_on_answer='uuid_kill 
${pb_uuid}'}sofia/gateway/10.10.0.2/$1 &conference(${conference_name})}"/>
</condition>
<condition field="destination_number" 
expression="^ADD_CALL_TO_CONF__(3\d{2})$" break="on-true">
<action application="set" data="new_uuid=${create_uuid foo}" inline="true"/>
<action application="hash" 
data="insert/domain-${domain_name}/last_user_$1/${new_uuid}" />
<action application="set" data="res=${bgapi originate 
{origination_uuid=${new_uuid}}sofia/gateway/192.168.44.15/$1 
&conference(${conference_name})}"/>
</condition>
<condition field="destination_number" 
expression="^ADD_CALL_TO_CONF__(1\d{3}|11\d{4})$" break="on-true">
<action application="set" data="new_uuid=${create_uuid foo}" inline="true"/>
<action application="set" data="pb_uuid=${create_uuid foo}" inline="true"/>
<action application="hash" 
data="insert/domain-${domain_name}/last_user_$1/${new_uuid}" />
<action application="hash" 
data="insert/domain-${domain_name}/last_user_ring_$1/${pb_uuid}" />
<action application="set" data="res=${bgapi originate 
{origination_uuid=${pb_uuid}}loopback/confringback 
&conference(${conference_name})}"/>
<action application="set" data="res=${bgapi originate 
{origination_uuid=${new_uuid},api_on_answer='uuid_kill 
${pb_uuid}'}user/$1 &conference(${conference_name})}"/>
</condition>
<!-- ... otherwise inform moderator that the operation was not exactly 
successful -->
<condition field="destination_number" expression="^ADD_CALL_TO_CONF__$">
<action application="playback" data="ivr/ivr-please_try_again.wav"/>
</condition>
</extension>


So for 3 destinations (1st local extensions at 1xxx or 11xxxx, 2nd 
350-399 and 3rd 600-649) we don't need to fake it, for the other 2 
gateways we do.

Seems to work pretty well for now. Would it be worth getting Wiki write 
access to add that to the article about joining members by calling out 
from a conference?

Cheers

Alex



Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-users mailing list