Last active
August 29, 2015 14:06
-
-
Save arslan70/e1019b97cb725ac79a1b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SipStackAndroid implements SipListener { | |
protected SipStackAndroid() { | |
initialize(); | |
} | |
public static SipStackAndroid getInstance() { | |
if (instance == null) { | |
instance = new SipStackAndroid(); | |
} | |
return instance; | |
} | |
private static void initialize() { | |
localIp = getIPAddress(true); | |
localEndpoint = localIp + ":" + localPort; | |
remoteEndpoint = remoteIp + ":" + remotePort; | |
sipStack = null; | |
sipFactory = SipFactory.getInstance(); | |
sipFactory.setPathName("com.telestax"); | |
Properties properties = new Properties(); | |
properties.setProperty("tavax.sip.OUTBOUND_PROXY", remoteEndpoint + "/" | |
+ transport); | |
properties.setProperty("tavax.sip.STACK_NAME", "androidSip"); | |
try { | |
// Create SipStack object | |
sipStack = sipFactory.createSipStack(properties); | |
System.out.println("createSipStack " + sipStack); | |
} catch (PeerUnavailableException e) { | |
e.printStackTrace(); | |
System.err.println(e.getMessage()); | |
System.exit(0); | |
} | |
try { | |
headerFactory = sipFactory.createHeaderFactory(); | |
addressFactory = sipFactory.createAddressFactory(); | |
messageFactory = sipFactory.createMessageFactory(); | |
udpListeningPoint = sipStack.createListeningPoint(localIp, | |
localPort, transport); | |
sipProvider = sipStack.createSipProvider(udpListeningPoint); | |
sipProvider.addSipListener(SipStackAndroid.getInstance()); | |
// this.send_register(); | |
} catch (PeerUnavailableException e) { | |
e.printStackTrace(); | |
System.err.println(e.getMessage()); | |
System.exit(0); | |
} catch (Exception e) { | |
System.out.println("Creating Listener Points"); | |
System.out.println(e.getMessage()); | |
e.printStackTrace(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment