[Freeswitch-users] answer via .net esl is getting ignored

Peter Olsson peter at olssononline.se
Wed Dec 25 11:01:59 MSK 2013


Sounds like it might be a codec issue. Paste the logs from the call, when
answer fails.

/Peter

24 dec 2013 kl. 16:50 skrev "Yisroel M. Olewski" <yisroel at machshevet.com>:

Hello everyone

This is my first posting via the mailing list

I’m trying my hand at freeswitch esl with .net

I’ve managed to get a hold of all incoming events, but can’t seem to "pick
up the phone"

my first goal is to pick up the phone and read out some text via tts

I’ve scoured the web, tried everything I can find or think of but no luck

here’s my code



    Private Sub winMain_Loaded(sender As Object, e As RoutedEventArgs)
Handles Me.Loaded

        ThreadPool.QueueUserWorkItem(New WaitCallback(Sub(stateInfo)

                                                          FreeSwitch = New
ESLconnection("10.0.0.1", 8021, "mypass")

                                                          Dim eslEvent =
FreeSwitch.SendRecv("event plain ALL")


                     FreeSwitch.SendRecv("event plain DTMF")

                                                          If eslEvent IsNot
Nothing Then


AddEvent(eslEvent)

                                                              While
FreeSwitch.Connected

                                                                  eslEvent
= FreeSwitch.RecvEvent


AddEvent(eslEvent)

                                                              End While

                                                          End If

                                                      End Sub))



    End Sub



    Private Sub AddEvent(e As ESLevent)

        Dim dd = TextCollection(e.Serialize(""), ": ", vbLf)

        Dim eventname = dd("event-name")

        'Dim uid = dd("Unique-ID")

        Dim uid = dd("Channel-Call-UUID")

        If dd("Caller-Network-Addr") <> "" Then

            Dim dcx = DBEntities()

            Dim ses = dcx.Sessions.SingleOrDefault(Function(x) x.ServerCode
= uid)

            Dim ChannelState = dd("Channel-State")

            Dim ChannelCallState = dd("Channel-Call-State").ToLower

            Select Case eventname

                Case "CHANNEL_STATE"

                    If ses Is Nothing Then

                        ses = New Session

                        dcx.Sessions.AddObject(ses)

                    End If

                    ses.CallerHost = dd("Caller-Network-Addr")

                    ses.CallerName = UrlDecoded(dd("Caller-Caller-ID-Name"))

                    ses.CallerPhone = dd("Caller-Caller-ID-Number")

                    ses.CallerUser = dd("Caller-Username")

                    ses.CalleeUser = dd("Caller-Destination-Number")

                    ses.ServerCode = uid

                    If {"cs_destroy", "cs_hangup"}.Contains(ChannelState)
Then ses.HungUpOn = Now

                Case "CHANNEL_CALLSTATE"

                    If ChannelCallState = "ringing" Then

                        Dim evn = FreeSwitch.Execute("answer",
String.Empty, uid)

                        Dim res = evn.Serialize("")

                    End If

                Case "CHANNEL_DESTROY"

                    If ses IsNot Nothing Then ses.HungUpOn = Now

            End Select

            dcx.SaveChanges()

        End If

    End Sub



the answer line is getting reached, and the result is "+OK" but the phone
still keeps ringing

please note that I’m unsure which is the correct uuid, but trying both of
them gave me identical results



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.

It picks up, and immediately hangs up because it has finished the whole
dialplan



I’d appreciate your help. I’m pretty new to freeswitch and esl



Please advise



*Sincerely,*

*ymo*









_________________________________________________________________________
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 --------------
An HTML attachment was scrubbed...
URL: http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20131225/357969d0/attachment.html 


Join us at ClueCon 2013 Aug 6-8, 2013
More information about the FreeSWITCH-users mailing list