Excellent description and cool new chan var.

Alex, this is definitely something you should put on the wiki. If you need any help please let me know. Don't forget that we have a template that you can use to add a channel variable:

http://wiki.freeswitch.org/wiki/Variable_skeleton

The rest of the documentation can go in http://wiki.freeswitch.org/wiki/Mod_loopback. For bonus points you can use the wiki {{:foo}} syntax to include the channel variable docs in the mod_loopback page w/o actually duplicating your work. See the main channel variables page for examples on how to do that.

-MC

On Mon, Apr 23, 2012 at 12:21 PM, Anthony Minessale <anthony.minessale@gmail.com> wrote:
You should definitely help on the wiki.  It's always worth it.

I did not mean that the book would teach you about L16 on loopback but
codecs and setting up calls.
Since you said you cannot understand why there is no early media in
your conference I thought you might benefit but studying the nuances
of call origination.

As for loopback, if its important enough to you to get that ring
sound, its really the only choice you have.
I check and it's easy enough to add a patch to let you specify the
initial codec so try out git HEAD and use the new variable
loopback_initial_codec you can specify it in the originate string like

originate {loopback_initial_codec=L16@16000h}loopback/1234 4321

Transcoding fees may apply.




On Mon, Apr 23, 2012 at 12:29 PM, Alex Crow <acrow@integrafin.co.uk> wrote:
> 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
>
> _________________________________________________________________________
> Professional FreeSWITCH Consulting Services:
> consulting@freeswitch.org
> http://www.freeswitchsolutions.com
>
> FreeSWITCH-powered IP PBX: The CudaTel Communication Server
> http://www.cudatel.com
>
> Official FreeSWITCH Sites
> http://www.freeswitch.org
> http://wiki.freeswitch.org
> http://www.cluecon.com
>
> 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



--
Anthony Minessale II

FreeSWITCH http://www.freeswitch.org/
ClueCon http://www.cluecon.com/
Twitter: http://twitter.com/FreeSWITCH_wire

AIM: anthm
MSN:anthony_minessale@hotmail.com
GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com
IRC: irc.freenode.net #freeswitch

FreeSWITCH Developer Conference
sip:888@conference.freeswitch.org
googletalk:conf+888@conference.freeswitch.org
pstn:+19193869900

_________________________________________________________________________
Professional FreeSWITCH Consulting Services:
consulting@freeswitch.org
http://www.freeswitchsolutions.com

FreeSWITCH-powered IP PBX: The CudaTel Communication Server
http://www.cudatel.com

Official FreeSWITCH Sites
http://www.freeswitch.org
http://wiki.freeswitch.org
http://www.cluecon.com

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