Simple proxy server in eclipse ericssonsds

Source: Internet
Author: User

What is a simple Proxy Server feature implementation from http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/index.jsp? Topic =/com.ibm.websphere.express.doc/INFO/EXP/AE/rsip_servclass1.html

 

 

Protected void doinvite (sipservletrequest request) <br/> throws servletexception, ioexception {<br/> try {<br/> If (request. isinitial () = true) <br/>{< br/> // This shoshould cause the SIP session to be created. this sample only uses the session on grouping <br/> // a bye but the Tivoli performance viewer can be used to track the creation of callby viewing the <br/>/active session count. <br/> integer State = new INTEGER (invite_received); <br/> sipsession session = request. getsession (); <br/> session. setattribute (state_key, State); <br/> // log ("simpleproxy: doinvite: Setting attribute"); <br/> proxy = request. getproxy (); <br/> sipfactory = (sipfactory) getservletcontext (). getattribute (sip_factory); <br/> If (sipfactory = NULL) {<br/> throw new servletexception ("No sipfactory in C Ontext "); <br/>}< br/> string callingnumber = request. getto (). tostring (); <br/> If (callingnumber! = NULL) <br/>{< br/> string deststr = format_lookup (callingnumber); <br/> uri dest = sipfactory. createuri (deststr); <br/> // log ("simpleproxy: doinvite: proxying to DEST uri =" + DeST. tostring (); <br/> If (sipuri) request. getrequesturi ()). gettransportparam ()! = NULL) <br/> (sipuri) DEST ). settransportparam (sipuri) request. getrequesturi ()). gettransportparam (); <br/> proxy. setrecordroute (true); <br/> proxy. proxyto (DEST); <br/>}< br/> else {<br/> // log ("simpleproxy: doinvite: request is invalid. did not contain a to: field. "); <br/> sipservletresponse sipresponse = request. createeresponse (400); <br/> sipresponse. send (); <br/>}< br/> else <br/>{< br/> // log ("simpleproxy: doinvite: Target refresh, let Container Handle invite "); <br/> super. doinvite (request); <br/>}< br/> catch (exception e) {<br/> E. printstacktrace (); <br/>}< br/> protected string format_lookup (string toformat) {<br/> int start_index = toformat. indexof ('<') + 1; <br/> int end_index = toformat. indexof ('>'); <br/> If (start_index = 0) {<br/> // don't worry about it <br/>}< br/> If (end_index =-1) {<br/> end_index = toformat. length (); <br/>}< br/> return toformat. substring (start_index, end_index); <br/>}

 

In addition, we recommend http://tech-invite.com/ti-sip-service-1.html, which is a standard messaging process ~ Saliva...

 

With this proxy server, you can run the above standard signaling process.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.