VoIP Mailing List Archives
Mailing list archives for the VoIP community |
|
View previous topic :: View next topic |
Author |
Message |
odermann at googlemail... Guest
|
Posted: Fri Oct 17, 2008 10:38 am Post subject: [Freeswitch-users] Socket inbound or outbound with PHP? |
|
|
Hi,
I am new to freeswitch and found out quite a lot of things the past
days. But there are still many questions left, which I can't figure
out without some help.
I want to use freeswitch for a project, where freeswitch should
communicate with PHP-scripts and receive the messages to different
events.
I was told to use socket and found some quite helpful PHP-scripts in
this mailing list. One was for using socket outbound, one was for
socket inbound.
I would like to ask, which direction is the best oder most reliable?
When using socket outbound, freeswitch connects to the PHP-script, the
PHP-script forks and is registered to "myevents" (events all seems to
give me all events from all connections).
One of the problems I have with "outbound" is, that I won't get all
events. For example I do not get "hangup", because the socket
connection seems to die, before freeswitch sends the last command when
hanging up. With "ringing" the problem seems to be the same.
I only get a "hangup", when I register to "events all" and have to
active calls. When one of the two calls hangs up, i can see it by
printing out all events in the PHP-script.
When using socket inbound, the PHP-script does not fork and seems to
handle all events for all calls. What, if a request hangs for one
call? Do all the other calls have to wait, till the other call is
killed?
Another thing ist the events "heartbeat". Will I get the "heartbeat"
for every single call or just one heartbeat for all calls?
I feel that I am missing some basic knowledge about sockets and
freeswitch. Could someone help to find the right way, please?
Thanks and kind regards
Dennis
_______________________________________________
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 |
|
Back to top |
|
|
ivan at myrvold.org Guest
|
Posted: Fri Oct 17, 2008 10:55 am Post subject: [Freeswitch-users] Socket inbound or outbound with PHP? |
|
|
Den 17. okt.. 2008 kl. 14:45 skrev Dennis:
Quote: | One of the problems I have with "outbound" is, that I won't get all
events. For example I do not get "hangup", because the socket
connection seems to die, before freeswitch sends the last command when
hanging up. With "ringing" the problem seems to be the same.
|
Yes, this is true, I also have the same issue. But I am using the
time the connection died as the event to set the hangup time in my own
application.
But you of course do not get the hangup cause here.
I haven't had any problem with "ringing", though.
Ivan
_______________________________________________
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 |
|
Back to top |
|
|
gilbertandrew at mac.com Guest
|
Posted: Fri Oct 17, 2008 11:28 am Post subject: [Freeswitch-users] Socket inbound or outbound with PHP? |
|
|
Big caveat on fs inexperience here, but from doc my guess is:
Outbound is likely a good choice for dialplan application scenarios,
for example a call out to external app for a specific route or route
set. And Inbound is perhaps better at driving the switch through an
external application, say to do origination. But I have no history, so
am not an authority.
As for not hanging/blocking using Inbound the documentation/wiki seems
to address this in the BGAPI section:
http://wiki.freeswitch.org/wiki/Event_Socket#Inbound
And I believe there have been threads on the list about it before.
The netcat examples also look quite promising, you may want to work
scenarios through with that before diving into your PHP app.
Andy
On Oct 17, 2008, at 11:41 AM, Ivan C Myrvold wrote:
Quote: |
Den 17. okt.. 2008 kl. 14:45 skrev Dennis:
Quote: | One of the problems I have with "outbound" is, that I won't get all
events. For example I do not get "hangup", because the socket
connection seems to die, before freeswitch sends the last command
when
hanging up. With "ringing" the problem seems to be the same.
|
Yes, this is true, I also have the same issue. But I am using the
time the connection died as the event to set the hangup time in my own
application.
But you of course do not get the hangup cause here.
I haven't had any problem with "ringing", though.
Ivan
_______________________________________________
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
|
_______________________________________________
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 |
|
Back to top |
|
|
anthony.minessale at g... Guest
|
Posted: Fri Oct 17, 2008 2:02 pm Post subject: [Freeswitch-users] Socket inbound or outbound with PHP? |
|
|
On Fri, Oct 17, 2008 at 7:45 AM, Dennis <odermann@googlemail.com (odermann@googlemail.com)> wrote:
Quote: | Hi,
I am new to freeswitch and found out quite a lot of things the past
days. But there are still many questions left, which I can't figure
out without some help.
I want to use freeswitch for a project, where freeswitch should
communicate with PHP-scripts and receive the messages to different
events.
I was told to use socket and found some quite helpful PHP-scripts in
this mailing list. One was for using socket outbound, one was for
socket inbound.
I would like to ask, which direction is the best oder most reliable?
When using socket outbound, freeswitch connects to the PHP-script, the
PHP-script forks and is registered to "myevents" (events all seems to
give me all events from all connections).
One of the problems I have with "outbound" is, that I won't get all
events. For example I do not get "hangup", because the socket
connection seems to die, before freeswitch sends the last command when
hanging up. With "ringing" the problem seems to be the same.
I only get a "hangup", when I register to "events all" and have to
active calls. When one of the two calls hangs up, i can see it by
printing out all events in the PHP-script.
|
Good point. I fixed latest release to linger on the socket until you get the channel_hangup
event providing you did "myevents"
Quote: |
When using socket inbound, the PHP-script does not fork and seems to
handle all events for all calls. What, if a request hangs for one
call? Do all the other calls have to wait, till the other call is
killed?
|
events are not connected to channels at all the events are in their own backend. and each
event_socket connection has a dedicated thread and it's own copy of all the events.
Quote: |
Another thing ist the events "heartbeat". Will I get the "heartbeat"
for every single call or just one heartbeat for all calls?
|
The regular heartbeat event is for the whole system in case you are managing a connection
to several boxes or you want to be sure the box is up.
There is a per call heartbeat you can enable at a desired interval for calls with media
flowing through FS.
--
Anthony Minessale II
FreeSWITCH http://www.freeswitch.org/
ClueCon http://www.cluecon.com/
AIM: anthm
MSN:anthony_minessale@hotmail.com ([email]MSN%3Aanthony_minessale@hotmail.com[/email])
GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com ([email]PAYPAL%3Aanthony.minessale@gmail.com[/email])
IRC: irc.freenode.net #freeswitch
FreeSWITCH Developer Conference
sip:888@conference.freeswitch.org ([email]sip%3A888@conference.freeswitch.org[/email])
iax:guest@conference.freeswitch.org/888
googletalk:conf+888@conference.freeswitch.org ([email]googletalk%3Aconf%2B888@conference.freeswitch.org[/email])
pstn:213-799-1400 |
|
Back to top |
|
|
odermann at googlemail... Guest
|
Posted: Sat Oct 18, 2008 4:01 am Post subject: [Freeswitch-users] Socket inbound or outbound with PHP? |
|
|
Quote: | Quote: | When using socket outbound, freeswitch connects to the PHP-script, the
PHP-script forks and is registered to "myevents" (events all seems to
give me all events from all connections).
One of the problems I have with "outbound" is, that I won't get all
events. For example I do not get "hangup", because the socket
connection seems to die, before freeswitch sends the last command when
hanging up. With "ringing" the problem seems to be the same.
I only get a "hangup", when I register to "events all" and have to
active calls. When one of the two calls hangs up, i can see it by
printing out all events in the PHP-script.
|
Good point. I fixed latest release to linger on the socket until you get
the channel_hangup
event providing you did "myevents"
|
Anthony, that is so cool! It works exactly as I whished now. As far as
I can see, I get all needed events thanks to your changes. Thanks a
lot for the great support!
Quote: | Quote: | Another thing ist the events "heartbeat". Will I get the "heartbeat"
for every single call or just one heartbeat for all calls?
|
The regular heartbeat event is for the whole system in case you are managing
a connection
to several boxes or you want to be sure the box is up.
There is a per call heartbeat you can enable at a desired interval for calls
with media flowing through FS.
|
A per call heartbeat is exactly what I am looking for (as far, as I
get it, when registering to myevents). What does "calls with media
flowing" mean? What makes them different from other calls?
Where can I aktivate a per call heartbeat and where can I set the interval?
A more precise question about inbound/outbound: I want to read out the
events from freeswitch with my PHP-script and then tell freeswitch,
what to do next. I have the feeling, that "outbound" is the way to go.
But of course I also want to be able to start calls. Can I do this by
using "outbound"?
If I want to start a call without bridging two sides, is "originate"
the command to use? I have problems to understand, when to use
"sendmsg" and when to use "api". Like "bridge" works with "sendmsg"
and "originate" seems only to work with the "api" command.
Thanks again
Dennis
_______________________________________________
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 |
|
Back to top |
|
|
odermann at googlemail... Guest
|
Posted: Sun Oct 19, 2008 8:05 am Post subject: [Freeswitch-users] Socket inbound or outbound with PHP? |
|
|
Quote: | Quote: | There is a per call heartbeat you can enable at a desired interval for calls
with media flowing through FS.
|
A per call heartbeat is exactly what I am looking for (as far, as I
get it, when registering to myevents). What does "calls with media
flowing" mean? What makes them different from other calls?
Where can I aktivate a per call heartbeat and where can I set the interval?
|
I just want to let you know, that we found out how the "per call
heartbeat" can be used. It works very well and we are very happy with
it.
For the ones, who also want to use the "per call heartbeat" and are
not sure how to use it, can find a short description here:
Where we connect in freeswitch to the PHP-script, we set:
<action application="set" data="enable_heartbeat_events=10"/>
In this example the heartbeat will come every 10 seconds. Default is
"every 60 seconds", the maximum is "every 10 seconds".
In the PHP-script we register to the event by using "event
SESSION_HEARTBEAT". That's it...
My other questions still remain
Kind regards
Dennis
_______________________________________________
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 |
|
Back to top |
|
|
anthony.minessale at g... Guest
|
Posted: Mon Oct 20, 2008 3:05 pm Post subject: [Freeswitch-users] Socket inbound or outbound with PHP? |
|
|
On Sat, Oct 18, 2008 at 3:50 AM, Dennis <odermann@googlemail.com (odermann@googlemail.com)> wrote:
Quote: | >> When using socket outbound, freeswitch connects to the PHP-script, the
Quote: | Quote: | PHP-script forks and is registered to "myevents" (events all seems to
give me all events from all connections).
One of the problems I have with "outbound" is, that I won't get all
events. For example I do not get "hangup", because the socket
connection seems to die, before freeswitch sends the last command when
hanging up. With "ringing" the problem seems to be the same.
I only get a "hangup", when I register to "events all" and have to
active calls. When one of the two calls hangs up, i can see it by
printing out all events in the PHP-script.
|
Good point. I fixed latest release to linger on the socket until you get
the channel_hangup
event providing you did "myevents"
|
Anthony, that is so cool! It works exactly as I whished now. As far as
I can see, I get all needed events thanks to your changes. Thanks a
lot for the great support!
Quote: | Quote: | Another thing ist the events "heartbeat". Will I get the "heartbeat"
for every single call or just one heartbeat for all calls?
|
The regular heartbeat event is for the whole system in case you are managing
a connection
to several boxes or you want to be sure the box is up.
There is a per call heartbeat you can enable at a desired interval for calls
with media flowing through FS.
|
A per call heartbeat is exactly what I am looking for (as far, as I
get it, when registering to myevents). What does "calls with media
flowing" mean? What makes them different from other calls?
Where can I aktivate a per call heartbeat and where can I set the interval?
|
Meaning in bypass_media mode it will not work because the logic lives
in the media io handler. Supporting it in calls where media is point to point would require
some more code.
Quote: |
A more precise question about inbound/outbound: I want to read out the
events from freeswitch with my PHP-script and then tell freeswitch,
what to do next. I have the feeling, that "outbound" is the way to go.
But of course I also want to be able to start calls. Can I do this by
using "outbound"?
|
yes
Quote: |
If I want to start a call without bridging two sides, is "originate"
the command to use? I have problems to understand, when to use
"sendmsg" and when to use "api". Like "bridge" works with "sendmsg"
and "originate" seems only to work with the "api" command.
|
sendmsg is for dialplan applications (show application) on the cli
api is for FSAPI interface (show api)
btw you should update again to latest as I made another tweak regarding this
behavior change
--
Anthony Minessale II
FreeSWITCH http://www.freeswitch.org/
ClueCon http://www.cluecon.com/
AIM: anthm
MSN:anthony_minessale@hotmail.com ([email]MSN%3Aanthony_minessale@hotmail.com[/email])
GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com ([email]PAYPAL%3Aanthony.minessale@gmail.com[/email])
IRC: irc.freenode.net #freeswitch
FreeSWITCH Developer Conference
sip:888@conference.freeswitch.org ([email]sip%3A888@conference.freeswitch.org[/email])
iax:guest@conference.freeswitch.org/888
googletalk:conf+888@conference.freeswitch.org ([email]googletalk%3Aconf%2B888@conference.freeswitch.org[/email])
pstn:213-799-1400 |
|
Back to top |
|
|
odermann at googlemail... Guest
|
Posted: Tue Oct 21, 2008 10:14 am Post subject: [Freeswitch-users] Socket inbound or outbound with PHP? |
|
|
2008/10/20 Anthony Minessale <anthony.minessale@gmail.com>:
Quote: | Quote: | A more precise question about inbound/outbound: I want to read out the
events from freeswitch with my PHP-script and then tell freeswitch,
what to do next. I have the feeling, that "outbound" is the way to go.
But of course I also want to be able to start calls. Can I do this by
using "outbound"?
|
yes
|
But what is the difference between "bridge" and "originate" in
handling dials? "bridge" connects two calls together, but "originate"
seems to be a part of "bridge".
If we make a "bridge", both legs seem to bee in the same session, when
using socked outbound.
We make a "bridge" as follows:
$this->invokeMessage("bridge", "sofia/internal/1001@192.168.1.5");
When we use "originate" (which we prefer, because we do not want to
connect both call with each other immediately), we use the following
command:
$this->invokeCommand("API originate
{origination_caller_id_number=123455}sofia/internal/1001@192.168.1.5
123");
The problem is, that the new call is now in another call-session and
we do not know how to bring the calls together.
Does it have something to do with "API"? If yes, is there a way to use
"originate" with "sendmsg"?
Thanks
Dennis
_______________________________________________
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 |
|
Back to top |
|
|
anthony.minessale at g... Guest
|
Posted: Tue Oct 21, 2008 11:46 am Post subject: [Freeswitch-users] Socket inbound or outbound with PHP? |
|
|
once you are controlling both sessions individually use api to send the uuid_bridge command:
api uuid_bridge <uuid of leg a> <uuid of leg b>
On Tue, Oct 21, 2008 at 9:37 AM, Dennis <odermann@googlemail.com (odermann@googlemail.com)> wrote:
Quote: | 2008/10/20 Anthony Minessale <anthony.minessale@gmail.com (anthony.minessale@gmail.com)>:
Quote: | Quote: | A more precise question about inbound/outbound: I want to read out the
events from freeswitch with my PHP-script and then tell freeswitch,
what to do next. I have the feeling, that "outbound" is the way to go.
But of course I also want to be able to start calls. Can I do this by
using "outbound"?
|
yes
|
But what is the difference between "bridge" and "originate" in
handling dials? "bridge" connects two calls together, but "originate"
seems to be a part of "bridge".
If we make a "bridge", both legs seem to bee in the same session, when
using socked outbound.
We make a "bridge" as follows:
$this->invokeMessage("bridge", "sofia/internal/1001@192.168.1.5 (1001@192.168.1.5)");
When we use "originate" (which we prefer, because we do not want to
connect both call with each other immediately), we use the following
command:
$this->invokeCommand("API originate
{origination_caller_id_number=123455}sofia/internal/1001@192.168.1.5 (1001@192.168.1.5)
123");
The problem is, that the new call is now in another call-session and
we do not know how to bring the calls together.
Does it have something to do with "API"? If yes, is there a way to use
"originate" with "sendmsg"?
Thanks
Dennis
_______________________________________________
Freeswitch-users mailing list
Freeswitch-users@lists.freeswitch.org (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/
AIM: anthm
MSN:anthony_minessale@hotmail.com ([email]MSN%3Aanthony_minessale@hotmail.com[/email])
GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com ([email]PAYPAL%3Aanthony.minessale@gmail.com[/email])
IRC: irc.freenode.net #freeswitch
FreeSWITCH Developer Conference
sip:888@conference.freeswitch.org ([email]sip%3A888@conference.freeswitch.org[/email])
iax:guest@conference.freeswitch.org/888
googletalk:conf+888@conference.freeswitch.org ([email]googletalk%3Aconf%2B888@conference.freeswitch.org[/email])
pstn:213-799-1400 |
|
Back to top |
|
|
odermann at googlemail... Guest
|
Posted: Tue Oct 21, 2008 11:48 am Post subject: [Freeswitch-users] Socket inbound or outbound with PHP? |
|
|
I think I have problems to understand what is happening in detail.
Just a short explaination, of what we are doing. We use socket
outbound and have a PHP script, which is listening to "myevents". If a
new call is coming in, we fork the PHP script in a new process to
handle this call. Now we have a new "inbound", which we can handle
with fs and the PHP script.
In example, we play a file for the caller. After we have played the
file, we want to call to the dialed number. But we do not want to
connect both call immediately. We originate to the target number,
because we want to play a file, before we connect, perhaps. A "bridge"
would connect both legs immediately. Therefore we need to originate.
If we originate, the originated call will run in a new child process
in PHP (this does not happen with "bridge").
How could our PHP "inbound"-process know, what the "outbound"-process
is doing? They have nothing to do with each other.
We have an inbound and then we play a file. The current process
"knows", that we have to make an originate, play a file and then
bridge. But the "current" process does not know, when the playfile is
done and the bridge can be executed.
So how could we "control both sessions individually"?
Sorry for all these questions, but we have serious problems, because
we can not find the answers.
Thanks
Dennis
2008/10/21 Anthony Minessale <anthony.minessale@gmail.com>:
Quote: | once you are controlling both sessions individually use api to send the
uuid_bridge command:
api uuid_bridge <uuid of leg a> <uuid of leg b>
On Tue, Oct 21, 2008 at 9:37 AM, Dennis <odermann@googlemail.com> wrote:
Quote: |
2008/10/20 Anthony Minessale <anthony.minessale@gmail.com>:
Quote: | Quote: | A more precise question about inbound/outbound: I want to read out the
events from freeswitch with my PHP-script and then tell freeswitch,
what to do next. I have the feeling, that "outbound" is the way to go.
But of course I also want to be able to start calls. Can I do this by
using "outbound"?
|
yes
|
But what is the difference between "bridge" and "originate" in
handling dials? "bridge" connects two calls together, but "originate"
seems to be a part of "bridge".
If we make a "bridge", both legs seem to bee in the same session, when
using socked outbound.
We make a "bridge" as follows:
$this->invokeMessage("bridge", "sofia/internal/1001@192.168.1.5");
When we use "originate" (which we prefer, because we do not want to
connect both call with each other immediately), we use the following
command:
$this->invokeCommand("API originate
{origination_caller_id_number=123455}sofia/internal/1001@192.168.1.5
123");
The problem is, that the new call is now in another call-session and
we do not know how to bring the calls together.
Does it have something to do with "API"? If yes, is there a way to use
"originate" with "sendmsg"?
|
|
_______________________________________________
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 |
|
Back to top |
|
|
msc at freeswitch.org Guest
|
Posted: Tue Oct 21, 2008 12:06 pm Post subject: [Freeswitch-users] Socket inbound or outbound with PHP? |
|
|
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?
I just want to make sure that I grok what you are trying to accomplish. 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)
-MC
On Tue, Oct 21, 2008 at 9:26 AM, Dennis <odermann@googlemail.com (odermann@googlemail.com)> wrote:
Quote: | I think I have problems to understand what is happening in detail.
Just a short explaination, of what we are doing. We use socket
outbound and have a PHP script, which is listening to "myevents". If a
new call is coming in, we fork the PHP script in a new process to
handle this call. Now we have a new "inbound", which we can handle
with fs and the PHP script.
In example, we play a file for the caller. After we have played the
file, we want to call to the dialed number. But we do not want to
connect both call immediately. We originate to the target number,
because we want to play a file, before we connect, perhaps. A "bridge"
would connect both legs immediately. Therefore we need to originate.
If we originate, the originated call will run in a new child process
in PHP (this does not happen with "bridge").
How could our PHP "inbound"-process know, what the "outbound"-process
is doing? They have nothing to do with each other.
We have an inbound and then we play a file. The current process
"knows", that we have to make an originate, play a file and then
bridge. But the "current" process does not know, when the playfile is
done and the bridge can be executed.
So how could we "control both sessions individually"?
Sorry for all these questions, but we have serious problems, because
we can not find the answers.
Thanks
Dennis
2008/10/21 Anthony Minessale <anthony.minessale@gmail.com (anthony.minessale@gmail.com)>:
Quote: | once you are controlling both sessions individually use api to send the
uuid_bridge command:
api uuid_bridge <uuid of leg a> <uuid of leg b>
On Tue, Oct 21, 2008 at 9:37 AM, Dennis <odermann@googlemail.com (odermann@googlemail.com)> wrote:
Quote: |
2008/10/20 Anthony Minessale <anthony.minessale@gmail.com (anthony.minessale@gmail.com)>:
Quote: | Quote: | A more precise question about inbound/outbound: I want to read out the
events from freeswitch with my PHP-script and then tell freeswitch,
what to do next. I have the feeling, that "outbound" is the way to go.
But of course I also want to be able to start calls. Can I do this by
using "outbound"?
|
yes
|
But what is the difference between "bridge" and "originate" in
handling dials? "bridge" connects two calls together, but "originate"
seems to be a part of "bridge".
If we make a "bridge", both legs seem to bee in the same session, when
using socked outbound.
We make a "bridge" as follows:
$this->invokeMessage("bridge", "sofia/internal/1001@192.168.1.5 (1001@192.168.1.5)");
When we use "originate" (which we prefer, because we do not want to
connect both call with each other immediately), we use the following
command:
$this->invokeCommand("API originate
{origination_caller_id_number=123455}sofia/internal/1001@192.168.1.5 (1001@192.168.1.5)
123");
The problem is, that the new call is now in another call-session and
we do not know how to bring the calls together.
Does it have something to do with "API"? If yes, is there a way to use
"originate" with "sendmsg"?
|
|
_______________________________________________
Freeswitch-users mailing list
Freeswitch-users@lists.freeswitch.org (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
|
|
|
Back to top |
|
|
dave at 3c.co.uk Guest
|
Posted: Tue Oct 21, 2008 12:11 pm Post subject: [Freeswitch-users] Socket inbound or outbound with PHP? |
|
|
Hi Dennis
Quote: | I think I have problems to understand what is happening in detail.
Just a short explaination, of what we are doing. We use socket
outbound and have a PHP script, which is listening to "myevents". If a
new call is coming in, we fork the PHP script in a new process to
handle this call. Now we have a new "inbound", which we can handle
with fs and the PHP script.
In example, we play a file for the caller. After we have played the
file, we want to call to the dialed number. But we do not want to
connect both call immediately. We originate to the target number,
because we want to play a file, before we connect, perhaps. A "bridge"
would connect both legs immediately. Therefore we need to originate.
If we originate, the originated call will run in a new child process
in PHP (this does not happen with "bridge").
How could our PHP "inbound"-process know, what the "outbound"-process
is doing? They have nothing to do with each other.
|
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";
Now your outbound call has a channel variable called 3c_uuid, which
holds the UUID of your inbound leg. From this point onwards, the
outbound can talk to the inbound and, if it includes a way of replying,
the inbound can talk to the outbound.
There's plenty of other ways of establishing IPC - one which comes to
mind is to listen on a socket on the inbound leg, and pass the port to
the outbound one.
Hope this helps..
Cheers --
Dave
Quote: | We have an inbound and then we play a file. The current process
"knows", that we have to make an originate, play a file and then
bridge. But the "current" process does not know, when the playfile is
done and the bridge can be executed.
So how could we "control both sessions individually"?
Sorry for all these questions, but we have serious problems, because
we can not find the answers.
Thanks
Dennis
2008/10/21 Anthony Minessale <anthony.minessale@gmail.com>:
Quote: | once you are controlling both sessions individually use api to send
the
uuid_bridge command:
api uuid_bridge <uuid of leg a> <uuid of leg b>
On Tue, Oct 21, 2008 at 9:37 AM, Dennis <odermann@googlemail.com>
wrote:
Quote: |
2008/10/20 Anthony Minessale <anthony.minessale@gmail.com>:
Quote: | Quote: | A more precise question about inbound/outbound: I want to read
out the
events from freeswitch with my PHP-script and then tell
freeswitch,
what to do next. I have the feeling, that "outbound" is the way
to go.
But of course I also want to be able to start calls. Can I do
this by
using "outbound"?
|
yes
|
But what is the difference between "bridge" and "originate" in
handling dials? "bridge" connects two calls together, but
"originate"
seems to be a part of "bridge".
If we make a "bridge", both legs seem to bee in the same session,
when
using socked outbound.
We make a "bridge" as follows:
$this->invokeMessage("bridge", "sofia/internal/1001@192.168.1.5");
When we use "originate" (which we prefer, because we do not want to
connect both call with each other immediately), we use the following
command:
$this->invokeCommand("API originate
{origination_caller_id_number=123455}sofia/internal/1001@192.168.1.5
123");
The problem is, that the new call is now in another call-session and
we do not know how to bring the calls together.
Does it have something to do with "API"? If yes, is there a way to
use
"originate" with "sendmsg"?
|
|
_______________________________________________
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
|
_______________________________________________
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 |
|
Back to top |
|
|
anthony.minessale at g... Guest
|
Posted: Tue Oct 21, 2008 1:12 pm Post subject: [Freeswitch-users] Socket inbound or outbound with PHP? |
|
|
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.
On Tue, Oct 21, 2008 at 11:26 AM, Dennis <odermann@googlemail.com (odermann@googlemail.com)> wrote:
Quote: | I think I have problems to understand what is happening in detail.
Just a short explaination, of what we are doing. We use socket
outbound and have a PHP script, which is listening to "myevents". If a
new call is coming in, we fork the PHP script in a new process to
handle this call. Now we have a new "inbound", which we can handle
with fs and the PHP script.
In example, we play a file for the caller. After we have played the
file, we want to call to the dialed number. But we do not want to
connect both call immediately. We originate to the target number,
because we want to play a file, before we connect, perhaps. A "bridge"
would connect both legs immediately. Therefore we need to originate.
If we originate, the originated call will run in a new child process
in PHP (this does not happen with "bridge").
How could our PHP "inbound"-process know, what the "outbound"-process
is doing? They have nothing to do with each other.
We have an inbound and then we play a file. The current process
"knows", that we have to make an originate, play a file and then
bridge. But the "current" process does not know, when the playfile is
done and the bridge can be executed.
So how could we "control both sessions individually"?
Sorry for all these questions, but we have serious problems, because
we can not find the answers.
Thanks
Dennis
2008/10/21 Anthony Minessale <anthony.minessale@gmail.com (anthony.minessale@gmail.com)>:
Quote: | once you are controlling both sessions individually use api to send the
uuid_bridge command:
api uuid_bridge <uuid of leg a> <uuid of leg b>
On Tue, Oct 21, 2008 at 9:37 AM, Dennis <odermann@googlemail.com (odermann@googlemail.com)> wrote:
Quote: |
2008/10/20 Anthony Minessale <anthony.minessale@gmail.com (anthony.minessale@gmail.com)>:
Quote: | Quote: | A more precise question about inbound/outbound: I want to read out the
events from freeswitch with my PHP-script and then tell freeswitch,
what to do next. I have the feeling, that "outbound" is the way to go.
But of course I also want to be able to start calls. Can I do this by
using "outbound"?
|
yes
|
But what is the difference between "bridge" and "originate" in
handling dials? "bridge" connects two calls together, but "originate"
seems to be a part of "bridge".
If we make a "bridge", both legs seem to bee in the same session, when
using socked outbound.
We make a "bridge" as follows:
$this->invokeMessage("bridge", "sofia/internal/1001@192.168.1.5 (1001@192.168.1.5)");
When we use "originate" (which we prefer, because we do not want to
connect both call with each other immediately), we use the following
command:
$this->invokeCommand("API originate
{origination_caller_id_number=123455}sofia/internal/1001@192.168.1.5 (1001@192.168.1.5)
123");
The problem is, that the new call is now in another call-session and
we do not know how to bring the calls together.
Does it have something to do with "API"? If yes, is there a way to use
"originate" with "sendmsg"?
|
|
_______________________________________________
Freeswitch-users mailing list
Freeswitch-users@lists.freeswitch.org (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/
AIM: anthm
MSN:anthony_minessale@hotmail.com ([email]MSN%3Aanthony_minessale@hotmail.com[/email])
GTALK/JABBER/PAYPAL:anthony.minessale@gmail.com ([email]PAYPAL%3Aanthony.minessale@gmail.com[/email])
IRC: irc.freenode.net #freeswitch
FreeSWITCH Developer Conference
sip:888@conference.freeswitch.org ([email]sip%3A888@conference.freeswitch.org[/email])
iax:guest@conference.freeswitch.org/888
googletalk:conf+888@conference.freeswitch.org ([email]googletalk%3Aconf%2B888@conference.freeswitch.org[/email])
pstn:213-799-1400 |
|
Back to top |
|
|
odermann at googlemail... Guest
|
Posted: Wed Oct 22, 2008 3:49 am Post subject: [Freeswitch-users] Socket inbound or outbound with PHP? |
|
|
2008/10/21 Michael Collins <msc@freeswitch.org>:
Quote: | 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.
Quote: | 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@3c.co.uk>:
Quote: | 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@gmail.com>:
Quote: | 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).
_______________________________________________
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 |
|
Back to top |
|
|
odermann at googlemail... Guest
|
Posted: Wed Oct 22, 2008 10:42 am Post subject: [Freeswitch-users] Socket inbound or outbound with PHP? |
|
|
Ahh, help, I found something out about my question and would like to
know, if I am really in trouble...
The problem is, when one does not read every single word.
Till now I always worked with socket outbound and a PHP script, which
forks the different processes. Everything seemed to work great (in my
little test environment) and I am at the point, where I could do most
if not all of the things I wanted to do with fs.
Today I made an originate over api, passed the inbound uuid to the
outbound and could control different things - I also could bridge both
calls. Great, I thought. Then I wanted to start the next little test:
Start a playfile from the outbound, so that the inbound can hear it...
Negative!
It seems to be impossible to send a playfile or hangup (and more) over
api. Both command seem only to be available with sendmsg. But sendmsg
<uuid> does not work with socket outbound, at least not from the
outbound to the inbound.
show application and show api tell a lot and I do know, when I stopped
thinking Perhaps my mistakes came up, because I started to use fs
one and a half week ago - I don't know.
So do I have to switch completely to socket inbound or is there a way
to continue using socket outbound? Or will I perhaps find out, that I
can not do some things with socket inbound, which I could do with
socket outbound?
In the moment I just do not know which way to go...
Dennis
_______________________________________________
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 |
|
Back to top |
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|