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