[Freeswitch-users] JAVA CODE ERROR

Freeswitch user freeswitch940 at gmail.com
Mon Sep 18 06:16:10 UTC 2017


Error:-  [ERR] switch_cpp.cpp:683 object is not initalized

import org.freeswitch.*;
import org.freeswitch.swig.*;

public class PhoneTest implements FreeswitchScript, DTMFCallback, HangupHook
{
    public PhoneTest()
    {
    }

    public String onDTMF(Object object, int i, String arg)
    {
        if (object instanceof String)
            freeswitch.console_log("notice", "DTMF: " + (String)object + "
ARG: " + arg + "\n");
        else
            freeswitch.console_log("notice", "WOW GOT AN EVENT: " +
object.toString());
        return "true";
    }

    public void onHangup()
    {
        freeswitch.console_log("notice", "HANGUP!\n");
    }

    public void run(String sessionUuid, String args)
    {
        freeswitch.console_log("notice", "UUID: " + sessionUuid + " ARGS: " +
args + "\n");
        JavaSession session = null;
        try
            {
                session = new JavaSession(sessionUuid);
                session.setDTMFCallback(this, "TEST"); // Getting error in
this line. session object not initilizing
                session.setHangupHook(this);

                session.answer();
                session.streamFile(args, 0);
                session.hangup("");
            }
        finally
            {
                if (session != null)
                    session.delete();
            }
    }
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freeswitch.org/pipermail/freeswitch-users/attachments/20170918/6a4968c2/attachment-0001.html>


More information about the FreeSWITCH-users mailing list