You need to implement both of those classes.
The SipProvider class will connect to your endpoint (Aterisk, for example). Note that this class must be on an static context, because only one connection is allowed per client.
You cant create a SipProvider instance calling a SipStack class, on sipStack.createSipProvider(listeningPoint)
. After this, you be able to create transactions and send requests to you endpoint.
The SipListener is the class that will process all responses from your server. This means that every request that you send to the server (Via SipProvider) will receive a response on SipListener. So, you must have this listener to process all data returned by your endpoint.
Try to implement the code that was described on oracle article that you cite. I started to develop based on this article, and works very fine!