<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:st1="urn:schemas-microsoft-com:office:smarttags" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 11 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]--><o:SmartTagType
namespaceuri="urn:schemas-microsoft-com:office:smarttags" name="PersonName"/>
<!--[if !mso]>
<style>
st1\:*{behavior:url(#default#ieooui) }
</style>
<![endif]-->
<style>
<!--
/* Font Definitions */
@font-face
        {font-family:Courier;
        panose-1:2 7 4 9 2 2 5 2 4 4;}
@font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:blue;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:Arial;
        color:navy;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
        {page:Section1;}
-->
</style>
</head>
<body lang=EN-US link=blue vlink=blue>
<div class=Section1>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Anthony,<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>This information is incredibly invaluable!
Is there any other documentation outside of the source code that contains this
kind of “here’s what happens and why” type of info? Just
curious. <o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>Thanks for working on such a great idea.
I’m looking forward to using FreeSwitch in the not-so-distant future.<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>-MC<o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'>P.S. – Before I go drop $2K on a
Sangoma T1 card, has anyone started working on mod_zap for FreeSwitch? I have
a Tormenta2 clone that actually works very well and I don’t want to spend
more $$ on hardware if I don’t have to… </span></font><font size=2
color=navy face=Wingdings><span style='font-size:10.0pt;font-family:Wingdings;
color:navy'>J</span></font><font size=2 color=navy face=Arial><span
style='font-size:10.0pt;font-family:Arial;color:navy'><o:p></o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p> </o:p></span></font></p>
<div style='border:none;border-left:solid blue 1.5pt;padding:0in 0in 0in 4.0pt'>
<div>
<div class=MsoNormal align=center style='text-align:center'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>
<hr size=2 width="100%" align=center tabindex=-1>
</span></font></div>
<p class=MsoNormal><b><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma;font-weight:bold'>From:</span></font></b><font size=2
face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'> Anthony
Minessale [mailto:anthmct@yahoo.com] <br>
<b><span style='font-weight:bold'>Sent:</span></b> Wednesday, September 06,
2006 12:02 PM<br>
<b><span style='font-weight:bold'>To:</span></b> <st1:PersonName w:st="on">freeswitch-dev@lists.freeswitch.org</st1:PersonName><br>
<b><span style='font-weight:bold'>Subject:</span></b> Re: [Freeswitch-dev]
Questions regarding the architecture</span></font><o:p></o:p></p>
</div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p> </o:p></span></font></p>
<div>
<div>
<p class=MsoNormal><font size=3 face=Courier><span style='font-size:12.0pt;
font-family:Courier'>1. Thread architecture. For a basic
call, why do we need two threads for the sessions (one for each
endpoint)? While the thread in charge of originator is in the
switch_core_standard_on_execute(), the other thread is in the
switch_core_session_run() while loop. What's advantage of
doing this compared to Asterisk's one thread approach? Why do we need the
thread for the originatee?<o:p></o:p></span></font></p>
</div>
<div>
<p class=MsoNormal><font size=3 face=Courier><span style='font-size:12.0pt;
font-family:Courier'>A)<o:p></o:p></span></font></p>
</div>
<div>
<p class=MsoNormal><font size=3 face=Courier><span style='font-size:12.0pt;
font-family:Courier'> <o:p></o:p></span></font></p>
</div>
<div>
<p class=MsoNormal><font size=3 face=Courier><span style='font-size:12.0pt;
font-family:Courier'>Every session has a thread which is managed by the state
machine in the core which sees it from creation to destruction.<br>
In the case of a bridged call the existing thread of both sessions are used to
move inbound audio across to the opposite session at the same time.<br>
A one threaded approach such as asterisk will leave you doing poll's on 2
sockets at once and blocking in one direction will impeed the other as <br>
well as forcing you to expose something that can be polled, (not all channels
have sockets)<o:p></o:p></span></font></p>
</div>
<div>
<p class=MsoNormal><font size=3 face=Courier><span style='font-size:12.0pt;
font-family:Courier'>The states of the orignatee channel are overridden from
the default behaviour to perform the bridge<br>
in this case:<br>
CS_HOLD pauses the thread.<br>
CS_RING moves the state to CS_HOLD where it will wait until it's moved to
CS_LOOPBACK or CS_HANGUP by the originate function. <br>
CS_LOOPBACK runs the audio bridge code sending the audio back to the other
channel.<o:p></o:p></span></font></p>
</div>
<div>
<p class=MsoNormal><font size=3 face=Courier><span style='font-size:12.0pt;
font-family:Courier'>The originator is in CS_EXECUTE meaning it's running
instructions installed by a dialplan module.<o:p></o:p></span></font></p>
</div>
<div>
<p class=MsoNormal><font size=3 face=Courier><span style='font-size:12.0pt;
font-family:Courier'>At this point both channels are in the same code reading A
and writing B as well as moving messages and dtmf across one another.<o:p></o:p></span></font></p>
</div>
<div>
<p class=MsoNormal><font size=3 face=Courier><span style='font-size:12.0pt;
font-family:Courier'>If either is interrupted the functions exits in both
sessions and the originatee state override table <br>
is cleared and the session is moved to the new state where the execution
continues. if this state is hangup<br>
the call ends.<o:p></o:p></span></font></p>
</div>
<div>
<p class=MsoNormal><font size=3 face=Courier><span style='font-size:12.0pt;
font-family:Courier'><br>
2. What does CS_LOOPBACK really mean? When A calls B, B is in the
LOOPBACK state after the call is established. Yet, the
switch_core_on_loopback() is not really called.<o:p></o:p></span></font></p>
</div>
<div>
<p class=MsoNormal><font size=3 face=Courier><span style='font-size:12.0pt;
font-family:Courier'>A)<o:p></o:p></span></font></p>
</div>
<div>
<p class=MsoNormal><font size=3 face=Courier><span style='font-size:12.0pt;
font-family:Courier'> <o:p></o:p></span></font></p>
</div>
<div>
<p class=MsoNormal><font size=3 face=Courier><span style='font-size:12.0pt;
font-family:Courier'>The default for loopback is to echo the audio back to the
channel, <br>
in the case of a bridge it's overridden to send it audio to the other session
instead<br>
of itself.<o:p></o:p></span></font></p>
</div>
<div>
<p class=MsoNormal><font size=3 face=Courier><span style='font-size:12.0pt;
font-family:Courier'> <o:p></o:p></span></font></p>
</div>
<div>
<p class=MsoNormal><font size=3 face=Courier><span style='font-size:12.0pt;
font-family:Courier'> <o:p></o:p></span></font></p>
</div>
<div>
<p class=MsoNormal><font size=3 face=Courier><span style='font-size:12.0pt;
font-family:Courier'>3. When A calls B and before B answers, the caller session
thread does busy waiting by constantly calling check_channel_status(). Is
there a better approach than this? And with this architecture how
are we going to incorporate with the voice mail and other timer-based
applications?<o:p></o:p></span></font></p>
</div>
<div>
<p class=MsoNormal><font size=3 face=Courier><span style='font-size:12.0pt;
font-family:Courier'> <o:p></o:p></span></font></p>
</div>
<div>
<p class=MsoNormal><font size=3 face=Courier><span style='font-size:12.0pt;
font-family:Courier'>A)<o:p></o:p></span></font></p>
</div>
<div>
<p class=MsoNormal><font size=3 face=Courier><span style='font-size:12.0pt;
font-family:Courier'>Yes this is the best approach, the originator has created
the originatee and is waiting for the endpoint module to place it into the
CS_RING state <br>
when this happens because we overrode it we move it to CS_HOLD and wait for it
to be answered or for a timeout to occur.<br>
The point is we have waited for it to be safe for us to control.<o:p></o:p></span></font></p>
</div>
<div>
<p class=MsoNormal><font size=3 face=Courier><span style='font-size:12.0pt;
font-family:Courier'><br>
4. When the orginatee hangs up, the exosip_kill_channel() was called 3 times
just for the orginatee channel. The same function is called twice for the
originator channel. Is this by design?<o:p></o:p></span></font></p>
</div>
<div>
<p class=MsoNormal><font size=3 face=Courier><span style='font-size:12.0pt;
font-family:Courier'> <o:p></o:p></span></font></p>
</div>
<div>
<p class=MsoNormal><font size=3 face=Courier><span style='font-size:12.0pt;
font-family:Courier'>A)<o:p></o:p></span></font></p>
</div>
<div>
<p class=MsoNormal><font size=3 face=Courier><span style='font-size:12.0pt;
font-family:Courier'>The should be as few calls to this as possible once it's
ok to have mutiple calls to it it just calls for any blocking to end<br>
on a read or write operation such as the socket api call "shutdown()"
does <o:p></o:p></span></font></p>
</div>
<div>
<p class=MsoNormal><font size=3 face=Courier><span style='font-size:12.0pt;
font-family:Courier'>We are not using exosip anymore, we have started coding
mod_sofia which is our preferred sip code.<br>
There are several changes comming up this week you may want to study.<o:p></o:p></span></font></p>
</div>
<div>
<p class=MsoNormal><font size=3 face=Courier><span style='font-size:12.0pt;
font-family:Courier'><br>
Thanks,<br>
<br>
<o:p></o:p></span></font></p>
</div>
<div>
<p class=MsoNormal><font size=3 face=Courier><span style='font-size:12.0pt;
font-family:Courier'>Anthony Minessale II<br>
<br>
FreeSWITCH http://www.freeswitch.org/<br>
ClueCon http://www.cluecon.com/<br>
<br>
AIM: anthm<br>
MSN:anthony_minessale@hotmail.com<br>
JABBER:anthony.minessale@gmail.com<br>
IRC: irc.freenode.net #freeswitch<o:p></o:p></span></font></p>
</div>
<div>
<p class=MsoNormal><font size=3 face=Courier><span style='font-size:12.0pt;
font-family:Courier'><br>
FreeSWITCH Developer Conference<br>
sip:888@66.250.68.194<br>
iax:guest@66.250.68.194/888<br>
googletalk:freeswitch@gmail.com<br>
pstn:712-432-7800<o:p></o:p></span></font></p>
</div>
<div>
<p class=MsoNormal style='margin-bottom:12.0pt'><font size=3 face=Courier><span
style='font-size:12.0pt;font-family:Courier'><o:p> </o:p></span></font></p>
<div>
<p class=MsoNormal style='margin-bottom:12.0pt'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>----- Original Message
----<br>
From: Alex Guan <alex.guan@prodeasystems.com><br>
To: <st1:PersonName w:st="on">freeswitch-dev@lists.freeswitch.org</st1:PersonName><br>
Sent: Wednesday, September 6, 2006 10:13:43 AM<br>
Subject: [Freeswitch-dev] Questions regarding the architecture<o:p></o:p></span></font></p>
<div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>Gang,<br>
<br>
I am new to freeswitch and have been studying it for the last
week. A few questions regarding the architecture. Any
input will be greatly appreciated.<br>
<br>
1. Thread architecture. For a basic call, why do we need
two threads for the sessions (one for each endpoint)? While the
thread in charge of originator is in the
switch_core_standard_on_execute(), the other thread is in the switch_core_session_run()
while loop. What's advantage of doing this compared to
Asterisk's one thread approach? Why do we need the thread for the
originatee?<br>
<br>
2. What does CS_LOOPBACK really mean? When A calls B, B is in the
LOOPBACK state after the call is established. Yet, the switch_core_on_loopback()
is not really called.<br>
<br>
3. When A calls B and before B answers, the caller session thread does busy
waiting by constantly calling check_channel_status(). Is there a
better approach than this? And with this architecture how are we
going to incorporate with the voice mail and other timer-based applications?<br>
<br>
4. When the orginatee hangs up, the exosip_kill_channel() was called 3 times
just for the orginatee channel. The same function is called twice
for the originator channel. Is this by design?<br>
<br>
Thanks,<br>
Alex<o:p></o:p></span></font></p>
</div>
<div>
<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'>_______________________________________________<br>
Freeswitch-dev mailing list<br>
Freeswitch-dev@lists.freeswitch.org<br>
<a href="http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev"
target="_blank">http://lists.freeswitch.org/mailman/listinfo/freeswitch-dev</a><br>
UNSUBSCRIBE:<a href="http://lists.freeswitch.org/mailman/options/freeswitch-dev"
target="_blank">http://lists.freeswitch.org/mailman/options/freeswitch-dev</a><br>
<a href="http://www.freeswitch.org/" target="_blank">http://www.freeswitch.org</a><o:p></o:p></span></font></p>
</div>
</div>
<p class=MsoNormal><font size=3 face=Courier><span style='font-size:12.0pt;
font-family:Courier'><o:p> </o:p></span></font></p>
</div>
</div>
</div>
</div>
</body>
</html>