SIP protocol learning 2

Source: Internet
Author: User

SIP protocol learning 2
1. Compile pjsipsource code using vc6.0in windows and read the readme.txt file to find the compilation method of source code on win32 platform. The following is a summary: a. Set pjsua to the current active Project B. Because the config_site.h file is missing during compilation, create an empty config_site.h file under pjlib/include/pj. C. the iPhone lpapi cannot be found. h. microsoft does not maintain vc6.0. Therefore, download the latest Platform SDKfor internet and add Tools> Option> Directories in Library files and sorted ded. the unresolved external symbol _ pj_get_sys_info error occurs during compilation. Add OS _info.c under pjlib \ src \ pj to the pjlib project and compile it under pjsip-apps \ binto generate pjsua_vc6.exe. 1. compile pjsip source code in Linux $. /configure $ make dep & make clean & make in/pjproject-2.1.0/pjsip-apps/bin you can see the pjsua-i686-pc-linux-gnu and pjsystest-i686-pc-linux-gnu3 using the build source code generated app to simulate a session creation, use wireshark to capture packets and analyze the sip protocol. Windows ip address; 172.16.2.138linux ip address; 172.16.2.63 2. First, run pjsua_vc6.exe on Windows, select m, create a new call, and enter sip: 172.16.2.63 (linux address ). The terminal then prints the following information, which can be roughly divided into three parts: 1. INVITE sip: 172.162.63 SIP/2.0 INVITE indicates that you are invited to a session. 02. the message header field is Via: SIP/2.0/UDP172.16.2.138: 5060; rport; branch = forward. The Request Path is provided here. The response request will send the Response Request according to this path. The transport layer protocol, the client name and address, and the receiving port number Max-Forwards: 70 indicate the maximum number of requests forwarded From: <sip: 172.16.2.138>; tag = signature request sender To: sip: 172.16.2.63 request recipient Contact: <sip: 172.16.2.138: 5060; ob> a URL-ID: fdc4d3c08c594ac499b184fbdbc35550, which is a globally unique identifier, used to uniquely identify the call CSeq: 2322 INVITE used to identify sending different requests Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONSSupported: replaces, 100rel, Timer, norefersubSession-Expires: 1800Min-SE: 90 or above. Identify the server. specify additional information about the response of the transfer address. User-Agent: PJSUA v1.16.0win32-5.1/i386/msvc-12.0 send request Proxy Information Content-Type: application/sdp message body Type Content-Length: 450 message body Length 3, marking the end of the message empty line 4, SDP Message Body (optional, sometimes not) v = 0 Protocol version o =-3585476598 3585476598 IN IP4 172.16.2.138 is the username, session ID, version, and network type of the session viewer IN sequence, address s = pjmedia session name c = IN IP4 172.16.2.138 connection data t = 0 0 start time and end time a = X-nat: 0 session/media attributes: value: m = audio 4000 RTP/AVP 98 97 99 104 3 0 89 96 media type, port, the format that the caller wants to send and receive next is to see the response message, no optional message body SIP/2.0 100 Trying100 is the status code, trying indicates in connection Via: SIP/2.0/UDP172.16.2.138: 5060; rport = 5060; partitioned ED = 172.16.2.138; branch = z9hG4bKPj9d24f4650227482987e044d641050ef6Call-ID: Protocol: <sip: 172.16.2.138>; tag = protocol: <sip: 172.16.2.63> CSeq: 2322 INVITEContent-Length: 0 3. Run the pjsua-i686-pc-linux-gnu on linux. If you see a connection request input 200, it indicates that the connection is accepted. You can see the Response Message SIP/2.0200 OKVia: SIP/2.0/UDP172.16.2.138: 5060; rport = 5060; received = 172.16.2.138; branch = z9hG4bKPj9d24f4650227482987e044d641050ef6Call-ID: small: <sip: 172.16.2.138>; tag = small: <sip: 172.16.2.63>; tag = ypVNCtNyGRBI9Ij4K9-Ig3Hf14zTkucmCSeq: 2322 INVITEContact: <sip: 172.16.2.63: 5060> Allow: PRACK, INVITE, ACK, BYE, CANCE L, UPDATE, INFO, SUBSCRIBE, comment y, REFER, MESSAGE, OPTIONSSupported: replaces, 100rel, timer, norefersubSession-Expires: 1800; refresher = uacRequire: timerContent-Type: application/sdpContent-Length: 274 v = 0o =-3585447798 3585447799 INIP4 172.16.2.63s = pjmediab = AS: 84 t = 00a = X-nat: 0 m = audio40000 RTP/AVP 98 96c = INIP4 172.16.2.63b = TIAS: 64000a = rtcp: 40001 IN IP4 172.16.2.63a = sendrecva = rtpmap: 98 speex/16000a = rtpmap: 96telephone-event/8000a = fmtp: 96015-next we can see the ACK confirmation message sent from the receiving end to the request end. In fact, the to, from, call-id, and cseq fields are copied from the invite request above. ACKsip: 172.16.2.63: 5060 SIP/2.0Via: SIP/2.0/UDP172.16.2.138: 5060; rport; branch = z9hG4bKPj1fb3c29b50914f4db87a8bd92ce0921fMax-Forwards: 70 From: <sip: 172.16.2.138>; tag = Protocol: sip: 172.16.2.63; tag = ypVNCtNyGRBI9Ij4K9-Ig3Hf14zTkucmCall-ID: fdc4d3c08c594ac499b184fbdbc35550CSeq: 2322 ACKContent-Length: 0 4. Terminate the connection at the receiving end input h, indicating to send a BYE to the connection side BYEsip: 172.16.2.138: 5060: SIPs/2.0/UDP172.16. 2.63: 5060; rport; branch = z9hG4bKPjYBk6NnV2mwIut0wJaHNxU7S6h3eq42IJMax-Forwards: 70 From: <sip: 172.16.2.63>; tag = ypVNCtNyGRBI9Ij4K9-Ig3Hf14zTkucmTo: <sip: 172.16.2.138>; tag = Protocol: 18290 BYEUser-Agent: PJSUA v2.1 Linux-2.6.35.22/i686/glibc-2.12Content-Length: 0 receive BYE end will send a receive BYE validation message 200 over SIP/2.0200 OKVia: SIP/2.0/UDP172.16.2.63: 5060; rport = 5060; received = 172.16.2.63; branch = z9hG4bKPjYBk6NnV2mwIut0wJaHNxU7S6h3eq42IJCall-ID: small: <sip: 172.16.2.63>; tag = ypVNCtNyGRBI9Ij4K9-Ig3Hf14zTkucmTo: <sip: 172.16.2.138>; tag = small: 18290 BYEContent-Length: 0 wireshark can be used to capture this session for 6 times. The six times are 1 in sequence. the client sends an INVITE message to the server. the server segment agrees to the call and sends a 100 status code indicating that the request has been received and is being processed. 3. Sending 200 indicates that the request has been completed. 4. The client sends an ACK to the server and confirms that the ACK has been received. 5. The client suddenly does not want to participate in this session and sends BYE to the server. 6. Conclusion confirmation 200.

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.