<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:m="http://schemas.microsoft.com/office/2004/12/omml" 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 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@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:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.MsoAcetate, li.MsoAcetate, div.MsoAcetate
        {mso-style-priority:99;
        mso-style-link:"Balloon Text Char";
        margin:0in;
        margin-bottom:.0001pt;
        font-size:8.0pt;
        font-family:"Tahoma","sans-serif";}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.BalloonTextChar
        {mso-style-name:"Balloon Text Char";
        mso-style-priority:99;
        mso-style-link:"Balloon Text";
        font-family:"Tahoma","sans-serif";}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.25in 1.0in 1.25in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal>Hello everyone<o:p></o:p></p><p class=MsoNormal>This is my first posting via the mailing list<o:p></o:p></p><p class=MsoNormal>I’m trying my hand at freeswitch esl with .net<o:p></o:p></p><p class=MsoNormal>I’ve managed to get a hold of all incoming events, but can’t seem to "pick up the phone"<o:p></o:p></p><p class=MsoNormal>my first goal is to pick up the phone and read out some text via tts<span style='font-family:"Arial","sans-serif"'><o:p></o:p></span></p><p class=MsoNormal>I’ve scoured the web, tried everything I can find or think of but no luck<span style='font-family:"Times New Roman","serif"'><o:p></o:p></span></p><p class=MsoNormal>here’s my code<span lang=HE dir=RTL style='font-family:"Times New Roman","serif"'><o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal> Private Sub winMain_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded<o:p></o:p></p><p class=MsoNormal> ThreadPool.QueueUserWorkItem(New WaitCallback(Sub(stateInfo)<o:p></o:p></p><p class=MsoNormal> FreeSwitch = New ESLconnection("10.0.0.1", 8021, "mypass")<o:p></o:p></p><p class=MsoNormal> Dim eslEvent = FreeSwitch.SendRecv("event plain ALL")<o:p></o:p></p><p class=MsoNormal> FreeSwitch.SendRecv("event plain DTMF")<o:p></o:p></p><p class=MsoNormal> If eslEvent IsNot Nothing Then<o:p></o:p></p><p class=MsoNormal> AddEvent(eslEvent)<o:p></o:p></p><p class=MsoNormal> While FreeSwitch.Connected<o:p></o:p></p><p class=MsoNormal> eslEvent = FreeSwitch.RecvEvent<o:p></o:p></p><p class=MsoNormal> AddEvent(eslEvent)<o:p></o:p></p><p class=MsoNormal> End While<o:p></o:p></p><p class=MsoNormal> End If<o:p></o:p></p><p class=MsoNormal> End Sub))<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal> End Sub<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal> Private Sub AddEvent(e As ESLevent)<o:p></o:p></p><p class=MsoNormal> Dim dd = TextCollection(e.Serialize(""), ": ", vbLf)<o:p></o:p></p><p class=MsoNormal> Dim eventname = dd("event-name")<o:p></o:p></p><p class=MsoNormal> 'Dim uid = dd("Unique-ID")<o:p></o:p></p><p class=MsoNormal> Dim uid = dd("Channel-Call-UUID")<o:p></o:p></p><p class=MsoNormal> If dd("Caller-Network-Addr") <> "" Then<o:p></o:p></p><p class=MsoNormal> Dim dcx = DBEntities()<o:p></o:p></p><p class=MsoNormal> Dim ses = dcx.Sessions.SingleOrDefault(Function(x) x.ServerCode = uid)<o:p></o:p></p><p class=MsoNormal> Dim ChannelState = dd("Channel-State")<o:p></o:p></p><p class=MsoNormal> Dim ChannelCallState = dd("Channel-Call-State").ToLower<o:p></o:p></p><p class=MsoNormal> Select Case eventname<o:p></o:p></p><p class=MsoNormal> Case "CHANNEL_STATE"<o:p></o:p></p><p class=MsoNormal> If ses Is Nothing Then<o:p></o:p></p><p class=MsoNormal> ses = New Session<o:p></o:p></p><p class=MsoNormal> dcx.Sessions.AddObject(ses)<o:p></o:p></p><p class=MsoNormal> End If<o:p></o:p></p><p class=MsoNormal> ses.CallerHost = dd("Caller-Network-Addr")<o:p></o:p></p><p class=MsoNormal> ses.CallerName = UrlDecoded(dd("Caller-Caller-ID-Name"))<o:p></o:p></p><p class=MsoNormal> ses.CallerPhone = dd("Caller-Caller-ID-Number")<o:p></o:p></p><p class=MsoNormal> ses.CallerUser = dd("Caller-Username")<o:p></o:p></p><p class=MsoNormal> ses.CalleeUser = dd("Caller-Destination-Number")<o:p></o:p></p><p class=MsoNormal> ses.ServerCode = uid<o:p></o:p></p><p class=MsoNormal> If {"cs_destroy", "cs_hangup"}.Contains(ChannelState) Then ses.HungUpOn = Now<o:p></o:p></p><p class=MsoNormal> Case "CHANNEL_CALLSTATE"<o:p></o:p></p><p class=MsoNormal> If ChannelCallState = "ringing" Then<o:p></o:p></p><p class=MsoNormal> Dim evn = FreeSwitch.Execute("answer", String.Empty, uid)<o:p></o:p></p><p class=MsoNormal> Dim res = evn.Serialize("")<o:p></o:p></p><p class=MsoNormal> End If<o:p></o:p></p><p class=MsoNormal> Case "CHANNEL_DESTROY"<o:p></o:p></p><p class=MsoNormal> If ses IsNot Nothing Then ses.HungUpOn = Now<o:p></o:p></p><p class=MsoNormal> End Select<o:p></o:p></p><p class=MsoNormal> dcx.SaveChanges()<o:p></o:p></p><p class=MsoNormal> End If<o:p></o:p></p><p class=MsoNormal> End Sub<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>the answer line is getting reached, and the result is "+OK" but the phone still keeps ringing<o:p></o:p></p><p class=MsoNormal>please note that I’m unsure which is the correct uuid, but trying both of them gave me identical results<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>As per advise from Nuwan Wijerathne, I put the “answer” action in the dialplan, and tried just the playback from code (just a wav file), but the result is the same. Freeswitch ignores entirely my commands.<o:p></o:p></p><p class=MsoNormal>It picks up, and immediately hangs up because it has finished the whole dialplan<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>I’d appreciate your help. I’m pretty new to freeswitch and esl<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Please advise<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><i><span style='color:#0F243E'>Sincerely,<o:p></o:p></span></i></p><p class=MsoNormal><i><span style='color:#0F243E'>ymo</span></i><b><span style='font-size:10.0pt;font-family:"Arial","sans-serif";color:#1F497D'><o:p></o:p></span></b></p><p class=MsoNormal><span style='font-family:"Times New Roman","serif"'><o:p> </o:p></span></p><p class=MsoNormal><span lang=HE dir=RTL style='font-family:"Times New Roman","serif"'><o:p> </o:p></span></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><o:p> </o:p></p></div></body></html>