[Freeswitch-users] bridging two outbound calls

Jun Sun jsun at junsun.net
Sun Mar 31 10:30:35 MSD 2013


Is there any specific reason why "&" must be immediately followed by the 
application name? I found this restriction pretty annoying (at least for 
newbies ;0)

A simple patch would easily fix this. See one attached. Any takers?

I'm still searching for the solution for no sound after bridging. Would 
appreciate any pointers. (Again, this really has to be one of the 
simplest cases ... why it has been so hard?)

Cheers.

Jun

On 3/30/2013 8:36 AM, Jun Sun wrote:
>
> Oh, my god. That is it! After removing the extra space between "&" and
> "bridge", the second number now gets dialed.
>
> However, I cannot hear each other between these two phones. I think the
> signaling part is working, because hanging up one end will cause the
> other end hung up. However, the media is not flowing through.
>
> This must be a simple mistake. Any pointers?
>
> BTW, using conference() app works, i.e., both ends can connect and talk.
> So my system should be in general healthy state.
>
> Cheers.
>
> Jun
>
> On 3/29/2013 11:38 PM, Peter Olsson wrote:
>> It looks like you have a space between & and bridge? It might be my
>> email reader though. Anyway, it must be set like this: &bridge().
>>
>> Also, I'm not sure about the tel: stuff, if you can set it that way,
>> especially since there is a whitespace in between as well.
>>
>> /Peter
>>
>> 30 mar 2013 kl. 07:27 skrev "Jun Sun" <jsun at junsun.net>:
>>
>>>
>>> Yes, I tried. I can reverse the positions of those two numbers and
>>> always the first number gets called and the second number gets nothing.
>>>
>>> I start to wonder whether I'm using bridge() application wrongly. Can it
>>> dial out directly to a PSTN number via sofia?
>>>
>>> I was also fumbling with two orignate commands (followed by park()
>>> application) and uuid_bridge to connect. No failures on console, but the
>>> two lines are not talking.
>>>
>>> Thanks.
>>>
>>> Jun
>>>
>>> On 3/29/2013 6:25 PM, Zoltan Medveczky wrote:
>>>> You probably already tried this, but are you able to place a call to
>>>> your party B endpoint at all (i.e. originate(sofia/internal/18005551212
>>>> <tel:18005551212>@X.X.X.X:5060)?
>>>>
>>>> If that's failing, I'd say there's probably something wrong with your
>>>> dial string.  Perhaps your SIP UA is not bound to port 5060?
>>>>
>>>> On Fri, Mar 29, 2013 at 5:45 PM, Jun Sun <jsun at junsun.net
>>>> <mailto:jsun at junsun.net>> wrote:
>>>>
>>>>     I feel really stupid. This has to be one of the simplest cases in
>>>>     freeswitch, but I can't seem to get it work.
>>>>
>>>>     My goal is to originate two outbound calls and bridge them
>>>> together, a
>>>>     typical callback use case. I like to to do it from socket
>>>> api/fs_cli.
>>>>
>>>>     Here is what I typed in fs_cli:
>>>>
>>>>     originate sofia/internal/15102991912
>>>> <tel:15102991912>@X.X.X.X:5060  &
>>>>     bridge(sofia/internal/18005551212 <tel:18005551212>@X.X.X.X:5060)
>>>>
>>>>     The first leg is initiated and answered successfully, but the
>>>> second leg
>>>>     never happens. From the console I don't see any action done by
>>>> FS to do
>>>>     the bridging part.
>>>>
>>>>     Any idea? Thanks in advance.
>>>>
>>>>     Cheers.
>>>>
>>>>     Jun
>>>>
>>>>
>>>> _________________________________________________________________________
>>>>
>>>>     Professional FreeSWITCH Consulting Services:
>>>>     consulting at freeswitch.org <mailto:consulting at freeswitch.org>
>>>>     http://www.freeswitchsolutions.com
>>>>
>>>>     
>>>>     
>>>>
>>>>     Official FreeSWITCH Sites
>>>>     http://www.freeswitch.org
>>>>     http://wiki.freeswitch.org
>>>>     http://www.cluecon.com
>>>>
>>>>     FreeSWITCH-users mailing list
>>>>     FreeSWITCH-users at lists.freeswitch.org
>>>>     <mailto:FreeSWITCH-users at lists.freeswitch.org>
>>>>     http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>>>>
>>>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>>>>
>>>>     http://www.freeswitch.org
>>>>
>>>>
>>>>
>>>>
>>>> _________________________________________________________________________
>>>>
>>>> Professional FreeSWITCH Consulting Services:
>>>> consulting at freeswitch.org
>>>> http://www.freeswitchsolutions.com
>>>>
>>>> 
>>>> 
>>>>
>>>> Official FreeSWITCH Sites
>>>> http://www.freeswitch.org
>>>> http://wiki.freeswitch.org
>>>> http://www.cluecon.com
>>>>
>>>> FreeSWITCH-users mailing list
>>>> FreeSWITCH-users at lists.freeswitch.org
>>>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>>>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>>>>
>>>> http://www.freeswitch.org
>>>
>>>
>>> _________________________________________________________________________
>>>
>>> Professional FreeSWITCH Consulting Services:
>>> consulting at freeswitch.org
>>> http://www.freeswitchsolutions.com
>>>
>>> 
>>> 
>>>
>>> Official FreeSWITCH Sites
>>> http://www.freeswitch.org
>>> http://wiki.freeswitch.org
>>> http://www.cluecon.com
>>>
>>> FreeSWITCH-users mailing list
>>> FreeSWITCH-users at lists.freeswitch.org
>>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>>> http://www.freeswitch.org
>>>
>>> !DSPAM:5156810f32761697518053!
>>>
>>
>> _________________________________________________________________________
>> Professional FreeSWITCH Consulting Services:
>> consulting at freeswitch.org
>> http://www.freeswitchsolutions.com
>>
>> 
>> 
>>
>> Official FreeSWITCH Sites
>> http://www.freeswitch.org
>> http://wiki.freeswitch.org
>> http://www.cluecon.com
>>
>> FreeSWITCH-users mailing list
>> FreeSWITCH-users at lists.freeswitch.org
>> http://lists.freeswitch.org/mailman/listinfo/freeswitch-users
>> UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users
>> http://www.freeswitch.org
>>
>
>

-------------- next part --------------
diff -Nru freeswitch-1.2.5.3/src/mod/applications/mod_commands/mod_commands.c.orig freeswitch-1.2.5.3/src/mod/applications/mod_commands/mod_commands.c
--- freeswitch-1.2.5.3/src/mod/applications/mod_commands/mod_commands.c.orig	2012-12-07 15:21:47.000000000 +0000
+++ freeswitch-1.2.5.3/src/mod/applications/mod_commands/mod_commands.c	2013-03-31 06:21:04.140453102 +0000
@@ -3951,6 +3951,19 @@
 }
 
 #define ORIGINATE_SYNTAX "<call url> <exten>|&<application_name>(<app_args>) [<dialplan>] [<context>] [<cid_name>] [<cid_num>] [<timeout_sec>]"
+void _remove_ampersand_space(char *cmd)
+{
+	char *c;
+
+	// find ampersand, if any
+	for(c=cmd; *c; c++) if (*c=='&') break;
+	if (!*c) return;
+
+	*c=' ';	// remove ampersand for now
+	c++;	// move to next char
+	for(;*c && isspace(*c); c++);
+	*(--c)='&'; //add it back to the last char
+}
 SWITCH_STANDARD_API(originate_function)
 {
 	switch_channel_t *caller_channel;
@@ -3974,6 +3987,9 @@
 	}
 
 	mycmd = strdup(cmd);
+	// remove space after '&"
+	_remove_ampersand_space(mycmd);
+
 	switch_assert(mycmd);
 	argc = switch_separate_string(mycmd, ' ', argv, (sizeof(argv) / sizeof(argv[0])));
 


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