[Freeswitch-users] Socket inbound or outbound with PHP?

Dennis odermann at googlemail.com
Wed Oct 22 01:37:00 PDT 2008

2008/10/21 Michael Collins <msc at freeswitch.org>:
> So you need to create a second call leg that is somewhat independent of the
> first leg, so that you can play a file, and *then* bridge the new leg to the
> "current" leg?

Yes, this is exactly what I want.
A normal "bridge" is nice, because it seems, that no new process is
started and both legs know about each other.
But in many cases I first want to handle both legs a bit independant.
For example I want to have the option to play a soundfile to the
outbound leg, to press the #1, if he/she wants to talk to the caller
(I know, this is example is a little bit stupid). If the #1 is
pressed, I want to bridge both legs, if the outbound leg hangs up, we
hang up the inbound leg.

> Also, if you haven't put your dialplan and script in pastebin then it would
> be good to do so for the sake of everyone being on the same page.
> (pastebin.freeswitch.org)

In the moment there is not much to show in the pastebin. I am testing
different situations to see, if fs can do all the things I need (which
seems to be so :-)
When I am some steps further, I will put some code in the pastebin.

2008/10/21 David Knell <dave at 3c.co.uk>:
> That's some basic IPC.  The way I've done it is to create a database
> table
> which holds information about each call, keyed from the call's UUID.
> It's not hugely efficient, but works..!
> But each call has to know about the other.  So you need to pass the
> first
> call's UUID to the second one, which can be done like so (in Perl, but
> should translate to PHP pretty easily):
> print $sock "bgapi originate {3c_uuid=$uuid}sofia/gateway/number
> &application(or whatever)\n\n";

Thanks for the info! That's what I tried yesterday and it seems to
work quite good. It seems, that I have to work with something like a
call map, to handle the different legs.
I only thought, that there might be a nicer way to let both legs know
about each other.

2008/10/21 Anthony Minessale <anthony.minessale at gmail.com>:
> like i said, the inbound socket just needs to know the uuid of each leg
> and it can send the command to bridge them:
> api uuid_bridge <uuid of leg a> <uuid of leg b>
> as soon as you do this the legs will be bridged.

Thanks, api uuid_bridge works good (if the inbound knows about the
uuid of the outbound, which seems to make a call map neccesary).

More information about the FreeSWITCH-users mailing list