java - Sending Options command to SIP UDP server -
i working on program needs figure out if remote sip udp port 5060 reachable client machine.
as there no direct method check availability of udp port. want create simple java class send options message sip udp server , server reply client in java.
any help/ direction great help!
thanks, anupam
thanks response, tried below piece of code did not reply server:
string message = "options sip:opensips@host;transport=udp sip/2.0\r\ncall-id: 7df5e96c6b1b98af25ad6c7845d48f5d@49.249.132.30\r\ncseq: 1 options\r\nfrom: \"anupam\" <sip:anupam@localhost:5080>;tag=textclientv1.0\r\nto: \"opensips\" <sip:opensips@host>\r\nvia: sip/2.0/udp 49.249.132.30:5080;branch=z9hg4bk-3938-f66aaa8dda2fe3b863b4acde5fbcab67\r\nmax-forwards: 70\r\ncontact: \"anupam\" <sip:anupam@localhost:5080>\r\ncontent-length: 0\r\n\r\n"; system.out.println("message "+ message); byte [] data = message.getbytes(); datagrampacket packet = new datagrampacket( data, data.length, host, port ) ;
but didn't work.
to book (compliant rfc 3261), either need create quite bit of machinery handle retransmissions, etc., or use library jain-sip.
however, may able of way there opening udp socket, sending string containing appropriately-formatted options
message on socket, , waiting while see if sip response on socket. old sip response (success or error) verify server reachable.
here example options
message rfc:
options sip:carol@chicago.com sip/2.0 via: sip/2.0/udp pc33.atlanta.com;branch=z9hg4bkhjhs8ass877 max-forwards: 70 to: <sip:carol@chicago.com> from: alice <sip:alice@atlanta.com>;tag=1928301774 call-id: a84b4c76e66710 cseq: 63104 options contact: <sip:alice@pc33.atlanta.com> accept: application/sdp content-length: 0
Comments
Post a Comment