Search code examples
c++apivoipopalvoip

c++ ptlib PNotifier use in OPAL


I'm using OpalVoip for making a softphone application and i got stuck with following:

void MyManager::main()
{
    //variables
    PNotifier notify; // this is the problem
    //it is the template PNotifierFunctionTemplate<INT>

    //more stuff 

    listener->Open(notify); 

    //listener is of type OpalListenerUDP
    //it should start the listener and wait for incoming connection
    //but however i need to pass this NOTIFY which should be the INT parameter to the
    //new OpalTransport instance created by the listener...
    //however OpalListenerUDP only creates OpalTransport after the connection is
    //accepted as so in following: OpalListenerUDP::Accept(/*time interval*/)
    //
    //So far I think that this notifier should be a pointer to an object of type
    //OpalListenerUDP but i have no idea how to get it done 
}

Any help will be appreciated, Red.


Solution

  • After deeper research into opal source code, I've found the solution. It turns out that

    OpalConnection::StartListener(OpalListener&);
    

    Will do the job of opening listener, so there is no need of calling OpalListener::Open() so after it is only needed to call OpalListener::Accept to accept a connection.