RE: Memory leak in nist implementation

Francisco Javier Tellez Vaquero <[email protected]> Tue, 1 Jul 2008 12:45:28 +0200
Newsgroups gmane.comp.voip.nist-sip
Message-ID <[email protected]>
--===============5978763982435530527==
Content-Type: multipart/alternative;
	boundary="_62041d2f-4f3b-4ba6-8649-36fb71808a5b_"

--_62041d2f-4f3b-4ba6-8649-36fb71808a5b_
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable


Sorry, forget previous e-mails.=20
=20
Memory is recovered correctly. When I reproduce the scenario, I'll send it =
again.
=20
BR.
> Date: Tue, 1 Jul 2008 06:30:26 -0400> From: [email protected]=
v> Subject: nist-sip Digest, Vol 33, Issue 2> To: [email protected]> >=
 Send nist-sip mailing list submissions to> [email protected]> > To su=
bscribe or unsubscribe via the World Wide Web, visit> http://www-x.antd.nis=
t.gov/mailman/listinfo/nist-sip> or, via email, send a message with subject=
 or body 'help' to> [email protected]> > You can reach the per=
son managing the list at> [email protected]> > When replying, pl=
ease edit your Subject line so it is more specific> than "Re: Contents of n=
ist-sip digest..."> > > Today's Topics:> > 1. RE: Memory leak in nist imple=
mentation> (Francisco Javier Tellez Vaquero)> > > -------------------------=
---------------------------------------------> > Message: 1> Date: Tue, 1 J=
ul 2008 12:29:01 +0200> From: Francisco Javier Tellez Vaquero <fjavier_tell=
[email protected]>> Subject: [nist-sip] RE: Memory leak in nist implementation=
> To: <[email protected]>> Message-ID: <BAY143-W4861489994998B003BE340=
[email protected]>> Content-Type: text/plain; charset=3D"windows-1252"> > Skipp=
ed content of type multipart/alternative-------------- next part ----------=
----> package examples.simplecallsetup;> > import javax.sip.*;> import java=
x.sip.address.*;> import javax.sip.header.*;> import javax.sip.message.*;> =
import java.util.*;> > /**> * This class is a UAC template. Shootist is the=
 guy that shoots and shootme is> * the guy that gets shot.> * > * @author M=
. Ranganathan> */> > public class Shootist implements SipListener {> > > pr=
ivate static SipProvider sipProvider;> > private static AddressFactory addr=
essFactory;> > private static MessageFactory messageFactory;> > private sta=
tic HeaderFactory headerFactory;> > private static SipStack sipStack;> > pr=
ivate ContactHeader contactHeader;> > private ListeningPoint udpListeningPo=
int;> > private ClientTransaction inviteTid;> > private Dialog dialog;> > p=
rotected static final String usageString =3D "java "> + "examples.shootist.=
Shootist \n"> + ">>>> is your class path set to the root?";> > private stat=
ic void usage() {> System.out.println(usageString);> System.exit(0);> > }> =
> public void processRequest(RequestEvent requestReceivedEvent) {> Request =
request =3D requestReceivedEvent.getRequest();> ServerTransaction serverTra=
nsactionId =3D requestReceivedEvent> .getServerTransaction();> > System.out=
.println("\n\nRequest " + request.getMethod()> + " received at " + sipStack=
.getStackName()> + " with server transaction id " + serverTransactionId);> =
> // We are the UAC so the only request we get is the BYE.> if (request.get=
Method().equals(Request.BYE))> processBye(request, serverTransactionId);> >=
 }> > public void processBye(Request request,> ServerTransaction serverTran=
sactionId) {> try {> System.out.println("shootist: got a bye .");> if (serv=
erTransactionId =3D=3D null) {> System.out.println("shootist: null TID.");>=
 return;> }> Dialog dialog =3D serverTransactionId.getDialog();> System.out=
.println("Dialog State =3D " + dialog.getState());> Response response =3D m=
essageFactory.createResponse(200, request);> serverTransactionId.sendRespon=
se(response);> System.out.println("shootist: Sending OK.");> System.out.pri=
ntln("Dialog State =3D " + dialog.getState());> > } catch (Exception ex) {>=
 ex.printStackTrace();> System.exit(0);> > }> }> > public void processRespo=
nse(ResponseEvent responseReceivedEvent) {> System.out.println("Got a respo=
nse");> Response response =3D (Response) responseReceivedEvent.getResponse(=
);> ClientTransaction tid =3D responseReceivedEvent.getClientTransaction();=
> CSeqHeader cseq =3D (CSeqHeader) response.getHeader(CSeqHeader.NAME);> > =
System.out.println("Response received : Status Code =3D "> + response.getSt=
atusCode() + " " + cseq);> if (tid =3D=3D null) {> System.out.println("Stra=
y response -- dropping ");> return;> }> System.out.println("transaction sta=
te is " + tid.getState());> System.out.println("Dialog =3D " + tid.getDialo=
g());> System.out.println("Dialog State is " + tid.getDialog().getState());=
> > try {> if (response.getStatusCode() =3D=3D Response.OK) {> if (cseq.get=
Method().equals(Request.INVITE)) {> Request ackRequest =3D dialog.createReq=
uest(Request.ACK);> System.out.println("Sending ACK");> dialog.sendAck(ackR=
equest);> > Thread.sleep(2000);> Request byeRequest =3D dialog.createReques=
t(Request.BYE);> ClientTransaction ct =3D sipProvider> .getNewClientTransac=
tion(byeRequest);> dialog.sendRequest(ct);> > inviteTid =3D null;> dialog =
=3D null;> } else if (cseq.getMethod().equals(Request.CANCEL)) {> if (dialo=
g.getState() =3D=3D DialogState.CONFIRMED) {> // oops cancel went in too la=
te. Need to hang up the> // dialog.> System.out> .println("Sending BYE -- c=
ancel went in too late !!");> Request byeRequest =3D dialog.createRequest(R=
equest.BYE);> ClientTransaction ct =3D sipProvider> .getNewClientTransactio=
n(byeRequest);> dialog.sendRequest(ct);> > }> > }> }> } catch (Exception ex=
) {> ex.printStackTrace();> System.exit(0);> }> > }> > public void processT=
imeout(javax.sip.TimeoutEvent timeoutEvent) {> > System.out.println("Transa=
ction Time out");> }> > public void sendCancel() {> try {> System.out.print=
ln("Sending cancel");> Request cancelRequest =3D inviteTid.createCancel();>=
 ClientTransaction cancelTid =3D sipProvider> .getNewClientTransaction(canc=
elRequest);> cancelTid.sendRequest();> } catch (Exception ex) {> ex.printSt=
ackTrace();> }> }> > public void init() {> SipFactory sipFactory =3D null;>=
 sipStack =3D null;> sipFactory =3D SipFactory.getInstance();> sipFactory.s=
etPathName("gov.nist");> Properties properties =3D new Properties();> // If=
 you want to try TCP transport change the following to> String transport =
=3D "udp";> String peerHostPort =3D "127.0.0.1:7008";> properties.setProper=
ty("javax.sip.OUTBOUND_PROXY", peerHostPort + "/"> + transport);> // If you=
 want to use UDP then uncomment this.> properties.setProperty("javax.sip.ST=
ACK_NAME", "shootist");> > // The following properties are specific to nist=
-sip> // and are not necessarily part of any other jain-sip> // implementat=
ion.> // You can set a max message size for tcp transport to> // guard agai=
nst denial of service attack.> properties> .setProperty("gov.nist.javax.sip=
.MAX_MESSAGE_SIZE", "1048576");> properties.setProperty("gov.nist.javax.sip=
.DEBUG_LOG",> "shootistdebug.txt");> properties.setProperty("gov.nist.javax=
.sip.SERVER_LOG",> "shootistlog.txt");> > // Drop the client connection aft=
er we are done with the transaction.> properties.setProperty("gov.nist.java=
x.sip.CACHE_CLIENT_CONNECTIONS",> "false");> // Set to 0 in your production=
 code for max speed.> // You need 16 for logging traces. 32 for debug + tra=
ces.> // Your code will limp at 32 but it is best for debugging.> propertie=
s.setProperty("gov.nist.javax.sip.TRACE_LEVEL", "16");> > try {> // Create =
SipStack object> sipStack =3D sipFactory.createSipStack(properties);> Syste=
m.out.println("createSipStack " + sipStack);> } catch (PeerUnavailableExcep=
tion e) {> // could not find> // gov.nist.jain.protocol.ip.sip.SipStackImpl=
> // in the classpath> e.printStackTrace();> System.err.println(e.getMessag=
e());> System.exit(0);> }> > try {> headerFactory =3D sipFactory.createHead=
erFactory();> addressFactory =3D sipFactory.createAddressFactory();> messag=
eFactory =3D sipFactory.createMessageFactory();> udpListeningPoint =3D sipS=
tack.createListeningPoint("127.0.0.1",7010, "udp");> sipProvider =3D sipSta=
ck.createSipProvider(udpListeningPoint);> Shootist listener =3D this;> sipP=
rovider.addSipListener(listener);> > > > > String fromName =3D "BigGuy";> S=
tring fromSipAddress =3D "here.com";> String fromDisplayName =3D "The Maste=
r Blaster";> > String toSipAddress =3D "there.com";> String toUser =3D "Lit=
tleGuy";> String toDisplayName =3D "The Little Blister";> > // create >From=
 Header> SipURI fromAddress =3D addressFactory.createSipURI(fromName,> from=
SipAddress);> > Address fromNameAddress =3D addressFactory.createAddress(fr=
omAddress);> fromNameAddress.setDisplayName(fromDisplayName);> FromHeader f=
romHeader =3D headerFactory.createFromHeader(> fromNameAddress, "12345");> =
> // create To Header> SipURI toAddress =3D addressFactory> .createSipURI(t=
oUser, toSipAddress);> Address toNameAddress =3D addressFactory.createAddre=
ss(toAddress);> toNameAddress.setDisplayName(toDisplayName);> ToHeader toHe=
ader =3D headerFactory.createToHeader(toNameAddress,> null);> > // create R=
equest URI> SipURI requestURI =3D addressFactory.createSipURI(toUser,> peer=
HostPort);> > // Create ViaHeaders> > ArrayList viaHeaders =3D new ArrayLis=
t();> ViaHeader viaHeader =3D headerFactory.createViaHeader("127.0.0.1", si=
pProvider.getListeningPoint(transport).getPort(),> transport, null);> > // =
add via headers> viaHeaders.add(viaHeader);> > // Create ContentTypeHeader>=
 ContentTypeHeader contentTypeHeader =3D headerFactory> .createContentTypeH=
eader("application", "sdp");> > // Create a new CallId header> CallIdHeader=
 callIdHeader =3D sipProvider.getNewCallId();> > // Create a new Cseq heade=
r> CSeqHeader cSeqHeader =3D headerFactory.createCSeqHeader(1,> Request.INV=
ITE);> > // Create a new MaxForwardsHeader> MaxForwardsHeader maxForwards =
=3D headerFactory> .createMaxForwardsHeader(70);> > // Create the request.>=
 Request request =3D messageFactory.createRequest(requestURI,> Request.INVI=
TE, callIdHeader, cSeqHeader, fromHeader,> toHeader, viaHeaders, maxForward=
s);> // Create contact headers> String host =3D "127.0.0.1";> > SipURI cont=
actUrl =3D addressFactory.createSipURI(fromName, host);> contactUrl.setPort=
(udpListeningPoint.getPort());> > // Create the contact name address.> SipU=
RI contactURI =3D addressFactory.createSipURI(fromName, host);> contactURI.=
setPort(sipProvider.getListeningPoint(transport).getPort());> > Address con=
tactAddress =3D addressFactory.createAddress(contactURI);> > // Add the con=
tact address.> contactAddress.setDisplayName(fromName);> > contactHeader =
=3D headerFactory.createContactHeader(contactAddress);> request.addHeader(c=
ontactHeader);> > // Add the extension header.> Header extensionHeader =3D =
headerFactory.createHeader("My-Header",> "my header value");> request.addHe=
ader(extensionHeader);> > String sdpData =3D "v=3D0\r\n"> + "o=3D4855 13760=
799956958020 13760799956958020"> + " IN IP4 129.6.55.78\r\n" + "s=3Dmysessi=
on session\r\n"> + "p=3D+46 8 52018010\r\n" + "c=3DIN IP4 129.6.55.78\r\n">=
 + "t=3D0 0\r\n" + "m=3Daudio 6022 RTP/AVP 0 4 18\r\n"> + "a=3Drtpmap:0 PCM=
U/8000\r\n" + "a=3Drtpmap:4 G723/8000\r\n"> + "a=3Drtpmap:18 G729A/8000\r\n=
" + "a=3Dptime:20\r\n";> byte[] contents =3D sdpData.getBytes();> > request=
.setContent(contents, contentTypeHeader);> > extensionHeader =3D headerFact=
ory.createHeader("My-Other-Header",> "my new header value ");> request.addH=
eader(extensionHeader);> > Header callInfoHeader =3D headerFactory.createHe=
ader("Call-Info",> "<http://www.antd.nist.gov>");> request.addHeader(callIn=
foHeader);> > // Create the client transaction.> inviteTid =3D sipProvider.=
getNewClientTransaction(request);> > // send the request out.> inviteTid.se=
ndRequest();> > dialog =3D inviteTid.getDialog();> > } catch (Exception ex)=
 {> System.out.println(ex.getMessage());> ex.printStackTrace();> usage();> =
}> }> > public static void main(String args[]) {> new Shootist().init();> >=
 }> > public void processIOException(IOExceptionEvent exceptionEvent) {> Sy=
stem.out.println("IOException happened for " + exceptionEvent.getHost() + "=
 port =3D " > + exceptionEvent.getPort());> > }> > public void processTrans=
actionTerminated(> TransactionTerminatedEvent transactionTerminatedEvent) {=
> System.out.println("Transaction terminated event recieved");> }> > public=
 void processDialogTerminated(> DialogTerminatedEvent dialogTerminatedEvent=
) {> System.out.println("dialogTerminatedEvent");> > }> }> > --------------=
----------------> > _______________________________________________> nist-s=
ip mailing list> [email protected]> http://www-x.antd.nist.gov/mailman=
/listinfo/nist-sip> > > End of nist-sip Digest, Vol 33, Issue 2> **********=
*****************************
_________________________________________________________________
MSN Noticias
http://noticias.msn.es/comunidad.aspx=

--_62041d2f-4f3b-4ba6-8649-36fb71808a5b_
Content-Type: text/html; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
FONT-SIZE: 10pt;
FONT-FAMILY:Tahoma
}
</style>
</head>
<body class=3D'hmmessage'>
Sorry, forget previous e-mails.&nbsp;<BR>
&nbsp;<BR>
Memory is recovered correctly. When I&nbsp;reproduce the&nbsp;scenario, I'l=
l send it again.<BR>
&nbsp;<BR>
BR.<BR>
<BR><BR>&gt; Date: Tue, 1 Jul 2008 06:30:26 -0400<BR>&gt; From: nist-sip-re=
[email protected]<BR>&gt; Subject: nist-sip Digest, Vol 33, Issue 2<BR>&g=
t; To: [email protected]<BR>&gt; <BR>&gt; Send nist-sip mailing list s=
ubmissions to<BR>&gt; [email protected]<BR>&gt; <BR>&gt; To subscribe =
or unsubscribe via the World Wide Web, visit<BR>&gt; http://www-x.antd.nist=
.gov/mailman/listinfo/nist-sip<BR>&gt; or, via email, send a message with s=
ubject or body 'help' to<BR>&gt; [email protected]<BR>&gt; <BR=
>&gt; You can reach the person managing the list at<BR>&gt; nist-sip-owner@=
antd.nist.gov<BR>&gt; <BR>&gt; When replying, please edit your Subject line=
 so it is more specific<BR>&gt; than "Re: Contents of nist-sip digest..."<B=
R>&gt; <BR>&gt; <BR>&gt; Today's Topics:<BR>&gt; <BR>&gt; 1. RE: Memory lea=
k in nist implementation<BR>&gt; (Francisco Javier Tellez Vaquero)<BR>&gt; =
<BR>&gt; <BR>&gt; ---------------------------------------------------------=
-------------<BR>&gt; <BR>&gt; Message: 1<BR>&gt; Date: Tue, 1 Jul 2008 12:=
29:01 +0200<BR>&gt; From: Francisco Javier Tellez Vaquero &lt;fjavier_telle=
[email protected]&gt;<BR>&gt; Subject: [nist-sip] RE: Memory leak in nist imple=
mentation<BR>&gt; To: &lt;[email protected]&gt;<BR>&gt; Message-ID: &l=
t;[email protected]&gt;<BR>&gt; Content-Type: tex=
t/plain; charset=3D"windows-1252"<BR>&gt; <BR>&gt; Skipped content of type =
multipart/alternative-------------- next part --------------<BR>&gt; packag=
e examples.simplecallsetup;<BR>&gt; <BR>&gt; import javax.sip.*;<BR>&gt; im=
port javax.sip.address.*;<BR>&gt; import javax.sip.header.*;<BR>&gt; import=
 javax.sip.message.*;<BR>&gt; import java.util.*;<BR>&gt; <BR>&gt; /**<BR>&=
gt; * This class is a UAC template. Shootist is the guy that shoots and sho=
otme is<BR>&gt; * the guy that gets shot.<BR>&gt; * <BR>&gt; * @author M. R=
anganathan<BR>&gt; */<BR>&gt; <BR>&gt; public class Shootist implements Sip=
Listener {<BR>&gt; <BR>&gt; <BR>&gt; private static SipProvider sipProvider=
;<BR>&gt; <BR>&gt; private static AddressFactory addressFactory;<BR>&gt; <B=
R>&gt; private static MessageFactory messageFactory;<BR>&gt; <BR>&gt; priva=
te static HeaderFactory headerFactory;<BR>&gt; <BR>&gt; private static SipS=
tack sipStack;<BR>&gt; <BR>&gt; private ContactHeader contactHeader;<BR>&gt=
; <BR>&gt; private ListeningPoint udpListeningPoint;<BR>&gt; <BR>&gt; priva=
te ClientTransaction inviteTid;<BR>&gt; <BR>&gt; private Dialog dialog;<BR>=
&gt; <BR>&gt; protected static final String usageString =3D "java "<BR>&gt;=
 + "examples.shootist.Shootist \n"<BR>&gt; + "&gt;&gt;&gt;&gt; is your clas=
s path set to the root?";<BR>&gt; <BR>&gt; private static void usage() {<BR=
>&gt; System.out.println(usageString);<BR>&gt; System.exit(0);<BR>&gt; <BR>=
&gt; }<BR>&gt; <BR>&gt; public void processRequest(RequestEvent requestRece=
ivedEvent) {<BR>&gt; Request request =3D requestReceivedEvent.getRequest();=
<BR>&gt; ServerTransaction serverTransactionId =3D requestReceivedEvent<BR>=
&gt; .getServerTransaction();<BR>&gt; <BR>&gt; System.out.println("\n\nRequ=
est " + request.getMethod()<BR>&gt; + " received at " + sipStack.getStackNa=
me()<BR>&gt; + " with server transaction id " + serverTransactionId);<BR>&g=
t; <BR>&gt; // We are the UAC so the only request we get is the BYE.<BR>&gt=
; if (request.getMethod().equals(Request.BYE))<BR>&gt; processBye(request, =
serverTransactionId);<BR>&gt; <BR>&gt; }<BR>&gt; <BR>&gt; public void proce=
ssBye(Request request,<BR>&gt; ServerTransaction serverTransactionId) {<BR>=
&gt; try {<BR>&gt; System.out.println("shootist: got a bye .");<BR>&gt; if =
(serverTransactionId =3D=3D null) {<BR>&gt; System.out.println("shootist: n=
ull TID.");<BR>&gt; return;<BR>&gt; }<BR>&gt; Dialog dialog =3D serverTrans=
actionId.getDialog();<BR>&gt; System.out.println("Dialog State =3D " + dial=
og.getState());<BR>&gt; Response response =3D messageFactory.createResponse=
(200, request);<BR>&gt; serverTransactionId.sendResponse(response);<BR>&gt;=
 System.out.println("shootist: Sending OK.");<BR>&gt; System.out.println("D=
ialog State =3D " + dialog.getState());<BR>&gt; <BR>&gt; } catch (Exception=
 ex) {<BR>&gt; ex.printStackTrace();<BR>&gt; System.exit(0);<BR>&gt; <BR>&g=
t; }<BR>&gt; }<BR>&gt; <BR>&gt; public void processResponse(ResponseEvent r=
esponseReceivedEvent) {<BR>&gt; System.out.println("Got a response");<BR>&g=
t; Response response =3D (Response) responseReceivedEvent.getResponse();<BR=
>&gt; ClientTransaction tid =3D responseReceivedEvent.getClientTransaction(=
);<BR>&gt; CSeqHeader cseq =3D (CSeqHeader) response.getHeader(CSeqHeader.N=
AME);<BR>&gt; <BR>&gt; System.out.println("Response received : Status Code =
=3D "<BR>&gt; + response.getStatusCode() + " " + cseq);<BR>&gt; if (tid =3D=
=3D null) {<BR>&gt; System.out.println("Stray response -- dropping ");<BR>&=
gt; return;<BR>&gt; }<BR>&gt; System.out.println("transaction state is " + =
tid.getState());<BR>&gt; System.out.println("Dialog =3D " + tid.getDialog()=
);<BR>&gt; System.out.println("Dialog State is " + tid.getDialog().getState=
());<BR>&gt; <BR>&gt; try {<BR>&gt; if (response.getStatusCode() =3D=3D Res=
ponse.OK) {<BR>&gt; if (cseq.getMethod().equals(Request.INVITE)) {<BR>&gt; =
Request ackRequest =3D dialog.createRequest(Request.ACK);<BR>&gt; System.ou=
t.println("Sending ACK");<BR>&gt; dialog.sendAck(ackRequest);<BR>&gt; <BR>&=
gt; Thread.sleep(2000);<BR>&gt; Request byeRequest =3D dialog.createRequest=
(Request.BYE);<BR>&gt; ClientTransaction ct =3D sipProvider<BR>&gt; .getNew=
ClientTransaction(byeRequest);<BR>&gt; dialog.sendRequest(ct);<BR>&gt; <BR>=
&gt; inviteTid =3D null;<BR>&gt; dialog =3D null;<BR>&gt; } else if (cseq.g=
etMethod().equals(Request.CANCEL)) {<BR>&gt; if (dialog.getState() =3D=3D D=
ialogState.CONFIRMED) {<BR>&gt; // oops cancel went in too late. Need to ha=
ng up the<BR>&gt; // dialog.<BR>&gt; System.out<BR>&gt; .println("Sending B=
YE -- cancel went in too late !!");<BR>&gt; Request byeRequest =3D dialog.c=
reateRequest(Request.BYE);<BR>&gt; ClientTransaction ct =3D sipProvider<BR>=
&gt; .getNewClientTransaction(byeRequest);<BR>&gt; dialog.sendRequest(ct);<=
BR>&gt; <BR>&gt; }<BR>&gt; <BR>&gt; }<BR>&gt; }<BR>&gt; } catch (Exception =
ex) {<BR>&gt; ex.printStackTrace();<BR>&gt; System.exit(0);<BR>&gt; }<BR>&g=
t; <BR>&gt; }<BR>&gt; <BR>&gt; public void processTimeout(javax.sip.Timeout=
Event timeoutEvent) {<BR>&gt; <BR>&gt; System.out.println("Transaction Time=
 out");<BR>&gt; }<BR>&gt; <BR>&gt; public void sendCancel() {<BR>&gt; try {=
<BR>&gt; System.out.println("Sending cancel");<BR>&gt; Request cancelReques=
t =3D inviteTid.createCancel();<BR>&gt; ClientTransaction cancelTid =3D sip=
Provider<BR>&gt; .getNewClientTransaction(cancelRequest);<BR>&gt; cancelTid=
.sendRequest();<BR>&gt; } catch (Exception ex) {<BR>&gt; ex.printStackTrace=
();<BR>&gt; }<BR>&gt; }<BR>&gt; <BR>&gt; public void init() {<BR>&gt; SipFa=
ctory sipFactory =3D null;<BR>&gt; sipStack =3D null;<BR>&gt; sipFactory =
=3D SipFactory.getInstance();<BR>&gt; sipFactory.setPathName("gov.nist");<B=
R>&gt; Properties properties =3D new Properties();<BR>&gt; // If you want t=
o try TCP transport change the following to<BR>&gt; String transport =3D "u=
dp";<BR>&gt; String peerHostPort =3D "127.0.0.1:7008";<BR>&gt; properties.s=
etProperty("javax.sip.OUTBOUND_PROXY", peerHostPort + "/"<BR>&gt; + transpo=
rt);<BR>&gt; // If you want to use UDP then uncomment this.<BR>&gt; propert=
ies.setProperty("javax.sip.STACK_NAME", "shootist");<BR>&gt; <BR>&gt; // Th=
e following properties are specific to nist-sip<BR>&gt; // and are not nece=
ssarily part of any other jain-sip<BR>&gt; // implementation.<BR>&gt; // Yo=
u can set a max message size for tcp transport to<BR>&gt; // guard against =
denial of service attack.<BR>&gt; properties<BR>&gt; .setProperty("gov.nist=
.javax.sip.MAX_MESSAGE_SIZE", "1048576");<BR>&gt; properties.setProperty("g=
ov.nist.javax.sip.DEBUG_LOG",<BR>&gt; "shootistdebug.txt");<BR>&gt; propert=
ies.setProperty("gov.nist.javax.sip.SERVER_LOG",<BR>&gt; "shootistlog.txt")=
;<BR>&gt; <BR>&gt; // Drop the client connection after we are done with the=
 transaction.<BR>&gt; properties.setProperty("gov.nist.javax.sip.CACHE_CLIE=
NT_CONNECTIONS",<BR>&gt; "false");<BR>&gt; // Set to 0 in your production c=
ode for max speed.<BR>&gt; // You need 16 for logging traces. 32 for debug =
+ traces.<BR>&gt; // Your code will limp at 32 but it is best for debugging=
.<BR>&gt; properties.setProperty("gov.nist.javax.sip.TRACE_LEVEL", "16");<B=
R>&gt; <BR>&gt; try {<BR>&gt; // Create SipStack object<BR>&gt; sipStack =
=3D sipFactory.createSipStack(properties);<BR>&gt; System.out.println("crea=
teSipStack " + sipStack);<BR>&gt; } catch (PeerUnavailableException e) {<BR=
>&gt; // could not find<BR>&gt; // gov.nist.jain.protocol.ip.sip.SipStackIm=
pl<BR>&gt; // in the classpath<BR>&gt; e.printStackTrace();<BR>&gt; System.=
err.println(e.getMessage());<BR>&gt; System.exit(0);<BR>&gt; }<BR>&gt; <BR>=
&gt; try {<BR>&gt; headerFactory =3D sipFactory.createHeaderFactory();<BR>&=
gt; addressFactory =3D sipFactory.createAddressFactory();<BR>&gt; messageFa=
ctory =3D sipFactory.createMessageFactory();<BR>&gt; udpListeningPoint =3D =
sipStack.createListeningPoint("127.0.0.1",7010, "udp");<BR>&gt; sipProvider=
 =3D sipStack.createSipProvider(udpListeningPoint);<BR>&gt; Shootist listen=
er =3D this;<BR>&gt; sipProvider.addSipListener(listener);<BR>&gt; <BR>&gt;=
 <BR>&gt; <BR>&gt; <BR>&gt; String fromName =3D "BigGuy";<BR>&gt; String fr=
omSipAddress =3D "here.com";<BR>&gt; String fromDisplayName =3D "The Master=
 Blaster";<BR>&gt; <BR>&gt; String toSipAddress =3D "there.com";<BR>&gt; St=
ring toUser =3D "LittleGuy";<BR>&gt; String toDisplayName =3D "The Little B=
lister";<BR>&gt; <BR>&gt; // create &gt;From Header<BR>&gt; SipURI fromAddr=
ess =3D addressFactory.createSipURI(fromName,<BR>&gt; fromSipAddress);<BR>&=
gt; <BR>&gt; Address fromNameAddress =3D addressFactory.createAddress(fromA=
ddress);<BR>&gt; fromNameAddress.setDisplayName(fromDisplayName);<BR>&gt; F=
romHeader fromHeader =3D headerFactory.createFromHeader(<BR>&gt; fromNameAd=
dress, "12345");<BR>&gt; <BR>&gt; // create To Header<BR>&gt; SipURI toAddr=
ess =3D addressFactory<BR>&gt; .createSipURI(toUser, toSipAddress);<BR>&gt;=
 Address toNameAddress =3D addressFactory.createAddress(toAddress);<BR>&gt;=
 toNameAddress.setDisplayName(toDisplayName);<BR>&gt; ToHeader toHeader =3D=
 headerFactory.createToHeader(toNameAddress,<BR>&gt; null);<BR>&gt; <BR>&gt=
; // create Request URI<BR>&gt; SipURI requestURI =3D addressFactory.create=
SipURI(toUser,<BR>&gt; peerHostPort);<BR>&gt; <BR>&gt; // Create ViaHeaders=
<BR>&gt; <BR>&gt; ArrayList viaHeaders =3D new ArrayList();<BR>&gt; ViaHead=
er viaHeader =3D headerFactory.createViaHeader("127.0.0.1", sipProvider.get=
ListeningPoint(transport).getPort(),<BR>&gt; transport, null);<BR>&gt; <BR>=
&gt; // add via headers<BR>&gt; viaHeaders.add(viaHeader);<BR>&gt; <BR>&gt;=
 // Create ContentTypeHeader<BR>&gt; ContentTypeHeader contentTypeHeader =
=3D headerFactory<BR>&gt; .createContentTypeHeader("application", "sdp");<B=
R>&gt; <BR>&gt; // Create a new CallId header<BR>&gt; CallIdHeader callIdHe=
ader =3D sipProvider.getNewCallId();<BR>&gt; <BR>&gt; // Create a new Cseq =
header<BR>&gt; CSeqHeader cSeqHeader =3D headerFactory.createCSeqHeader(1,<=
BR>&gt; Request.INVITE);<BR>&gt; <BR>&gt; // Create a new MaxForwardsHeader=
<BR>&gt; MaxForwardsHeader maxForwards =3D headerFactory<BR>&gt; .createMax=
ForwardsHeader(70);<BR>&gt; <BR>&gt; // Create the request.<BR>&gt; Request=
 request =3D messageFactory.createRequest(requestURI,<BR>&gt; Request.INVIT=
E, callIdHeader, cSeqHeader, fromHeader,<BR>&gt; toHeader, viaHeaders, maxF=
orwards);<BR>&gt; // Create contact headers<BR>&gt; String host =3D "127.0.=
0.1";<BR>&gt; <BR>&gt; SipURI contactUrl =3D addressFactory.createSipURI(fr=
omName, host);<BR>&gt; contactUrl.setPort(udpListeningPoint.getPort());<BR>=
&gt; <BR>&gt; // Create the contact name address.<BR>&gt; SipURI contactURI=
 =3D addressFactory.createSipURI(fromName, host);<BR>&gt; contactURI.setPor=
t(sipProvider.getListeningPoint(transport).getPort());<BR>&gt; <BR>&gt; Add=
ress contactAddress =3D addressFactory.createAddress(contactURI);<BR>&gt; <=
BR>&gt; // Add the contact address.<BR>&gt; contactAddress.setDisplayName(f=
romName);<BR>&gt; <BR>&gt; contactHeader =3D headerFactory.createContactHea=
der(contactAddress);<BR>&gt; request.addHeader(contactHeader);<BR>&gt; <BR>=
&gt; // Add the extension header.<BR>&gt; Header extensionHeader =3D header=
Factory.createHeader("My-Header",<BR>&gt; "my header value");<BR>&gt; reque=
st.addHeader(extensionHeader);<BR>&gt; <BR>&gt; String sdpData =3D "v=3D0\r=
\n"<BR>&gt; + "o=3D4855 13760799956958020 13760799956958020"<BR>&gt; + " IN=
 IP4 129.6.55.78\r\n" + "s=3Dmysession session\r\n"<BR>&gt; + "p=3D+46 8 52=
018010\r\n" + "c=3DIN IP4 129.6.55.78\r\n"<BR>&gt; + "t=3D0 0\r\n" + "m=3Da=
udio 6022 RTP/AVP 0 4 18\r\n"<BR>&gt; + "a=3Drtpmap:0 PCMU/8000\r\n" + "a=
=3Drtpmap:4 G723/8000\r\n"<BR>&gt; + "a=3Drtpmap:18 G729A/8000\r\n" + "a=3D=
ptime:20\r\n";<BR>&gt; byte[] contents =3D sdpData.getBytes();<BR>&gt; <BR>=
&gt; request.setContent(contents, contentTypeHeader);<BR>&gt; <BR>&gt; exte=
nsionHeader =3D headerFactory.createHeader("My-Other-Header",<BR>&gt; "my n=
ew header value ");<BR>&gt; request.addHeader(extensionHeader);<BR>&gt; <BR=
>&gt; Header callInfoHeader =3D headerFactory.createHeader("Call-Info",<BR>=
&gt; "&lt;http://www.antd.nist.gov&gt;");<BR>&gt; request.addHeader(callInf=
oHeader);<BR>&gt; <BR>&gt; // Create the client transaction.<BR>&gt; invite=
Tid =3D sipProvider.getNewClientTransaction(request);<BR>&gt; <BR>&gt; // s=
end the request out.<BR>&gt; inviteTid.sendRequest();<BR>&gt; <BR>&gt; dial=
og =3D inviteTid.getDialog();<BR>&gt; <BR>&gt; } catch (Exception ex) {<BR>=
&gt; System.out.println(ex.getMessage());<BR>&gt; ex.printStackTrace();<BR>=
&gt; usage();<BR>&gt; }<BR>&gt; }<BR>&gt; <BR>&gt; public static void main(=
String args[]) {<BR>&gt; new Shootist().init();<BR>&gt; <BR>&gt; }<BR>&gt; =
<BR>&gt; public void processIOException(IOExceptionEvent exceptionEvent) {<=
BR>&gt; System.out.println("IOException happened for " + exceptionEvent.get=
Host() + " port =3D " <BR>&gt; + exceptionEvent.getPort());<BR>&gt; <BR>&gt=
; }<BR>&gt; <BR>&gt; public void processTransactionTerminated(<BR>&gt; Tran=
sactionTerminatedEvent transactionTerminatedEvent) {<BR>&gt; System.out.pri=
ntln("Transaction terminated event recieved");<BR>&gt; }<BR>&gt; <BR>&gt; p=
ublic void processDialogTerminated(<BR>&gt; DialogTerminatedEvent dialogTer=
minatedEvent) {<BR>&gt; System.out.println("dialogTerminatedEvent");<BR>&gt=
; <BR>&gt; }<BR>&gt; }<BR>&gt; <BR>&gt; ------------------------------<BR>&=
gt; <BR>&gt; _______________________________________________<BR>&gt; nist-s=
ip mailing list<BR>&gt; [email protected]<BR>&gt; http://www-x.antd.ni=
st.gov/mailman/listinfo/nist-sip<BR>&gt; <BR>&gt; <BR>&gt; End of nist-sip =
Digest, Vol 33, Issue 2<BR>&gt; ***************************************<BR>=
<BR><br /><hr />Tecnolog=EDa, moda, motor, viajes,.suscr=EDbete a nuestros =
boletines para estar siempre a la =FAltima <a href=3D'http://newsletters.ms=
n.com/hm/maintenanceeses.asp?L=3DES&C=3DES&P=3DWCMaintenance&Brand=3DWL&RU=
=3Dhttp%3a%2f%2fmail.live.com' target=3D'_new'>MSN Newsletters</a></body>
</html>=

--_62041d2f-4f3b-4ba6-8649-36fb71808a5b_--

--===============5978763982435530527==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
nist-sip mailing list
[email protected]
http://www-x.antd.nist.gov/mailman/listinfo/nist-sip

--===============5978763982435530527==--