class PBXSignaling{ PBXSignaling(){} // constructor int AssginLine(){ When a telephone call arrives at the local PBX, it is associated with one of the lines leading to the gateway. The number of line is used as int CallID defined in SIP protocol. CallID is returned. } boolean isSignal(){waiting for a signaling} boolean isFromTelephone(){} boolean isFromGateray(){} int getCallID(){ find which line has siganl } int getSignal(CallID){ get signal type } stream SignalProcess(){ if (isSignal()){ CallID=3DgetCallID(); if (isFromTelephone()){ switch(getSignaling(CallID)){ case a new call to internet: Assignline(); break; case a new call to telephone: normal; break; case telephone is busy: busySignal(); break; case hang up: free(CallID); break; output stream (signal) to Gateway at each case } }else if(isFromGateway()) { switch(getSignaling(CallID)){ case a call to telephone: dialTelephone(); break; case internet user is busy or timeout: free(telephoneCallID); break; output stream (signal) to Gateway at each case } } } void free(CallID){ when a call ends, free this line.} public void static main(){ PBXSignaling pbx=3Dnew PBXSignaling(); while(true){ Stream=3DSignalProcess(); } } }
This part is similar to that on PBX but we have to add some function to offer information to team 5 about bill and team 3 about multi-point call.
class GatewaySignaling implement DirectoryStub{ GatewaySignaling{} boolean IsSignal(){ listen to signal } boolean isFromInternet(){} boolean isFromPBX(){} int getCallID(){ find which line has signal } int getSignal(CallID){ find out what kind of signal } // tell team 5 to bill information=20 SIPAddress LocateUser(SIPAddress){ LookUp DirectoryService to get the destination address } float connectionTime(SIPAddress){} // guide the gateway when setting up mulit-point call.=20 // Maybe we have to call function of team 3 int numOfParticipent(ConferenceSession){ return number of participants in this conference } vector listOfParticipent(ConferenceSession){ list of participants in this conference } boolean isMulticast(ConferenceSession){ Does this conference session use multicast way? } stream SignalProcess(){ if (isSignal()){ CallID=3DgetCallID(); if (isFromInternet()){ switch(getSignaling(CallID)){ case new call to telephone: Assignline(); break; case new call to internet: normal(); break; case hang up or timeout: free(CallID); break; Output stream(signal) to PBX at each case } } else if(isFromPBX){ switch(getSignaling(CallID)){ case a call to telephone: connectComputerUser(); break; case busy signal or hang out: free(telephoneCallID); break; output stream(signal) to PBX at each case } } } public void static main(){ GatewaySignaling gws=3Dnew GatewaySignaling(); while(true){ gws.SignalProcess(); } } }
// team 7,8 will use this interface, we will give a sample application class DesktopSignaling{ Constructor(); RegisterUpcallForIncomingConnections(); Dial(); Hangup(); AcceptCall(); RejectCall(); Destructor(); } When there are many applications running on a desktop computer, signaling parts should be at least aware of each other. Team 8 designs the API and we implement it. class DesktopCommunicationSignaling{ int numOfApplications; vector listOfApplications(){} boolean isMultiCast(){} //other members }