การรับส่งข้อมูล (message) ของ SIP Protocol
จาก Asterisk DIY - VoIP Opensource WiKi, สารานุกรมฟรี
**กำลังจัดทำอยู่ครับ** http://clubs.tdetonline.com/phpbb/viewtopic.php?t=19 http://www.voipplanet.com/backgrounders/article.php/3508601
SIP มีการ Request ได้ทั้งหมด 6 รูปแบบ (method)
1. INVITE ใช้เมื่อ client ต้องการสร้าง session เพื่อติดต่อ 2. ACK ใช้เมื่อ client ได้รับการตอบกลับจาก INVITE ภายในเวลาที่กำหนด 3. BYE ใช้เมื่อต้องการสิ้นสุดการเชื่อมต่อ ซึ่งผู้ส่งและผู้รับสามารถส่งได้เหมือนกัน 4. CANCEL ใช้เพื่อยุติการค้นหา แต่ไม่สามารถใช้ยกเลิกสายที่รับแล้วได้ 5. OPTIONS ใช้ตรวจสอบคุณสมบัติของ Server 6. REGISTER ใช้ในกรณีที่ SIP_Client (เช่น IP-Phone) ทำการบอก IP-Address ของตัวเองให้กับเครื่อง server (SIP-Server)
RFC 3262 เพิ่มความน่าเชื่อถือในการตอบกลับของ SIP - PRACK
RFC 3265 เพิ่มเติม - SUBSCRIBE แจ้ง Event ของ Notification จากผู้แจ้ง - NOTIFY แจ้งเหตุการณ์ใหม่
SIP Response
1xx ข้อมูลการตอบกลับ - 100 กำลังพยายาม - 180 กำลังเรียก (ring) - 181 กำลัง forward - 182 กำลังเข้าคิว - 183 ความคืบหน้าของ session
2xx ได้รับการตอบกลับ - 200 OK - 202 ตกลง
3xx Redirect - 300 มีหลายตัวเลือก - 301 ย้ายเป็นการถาวร - 302 ย้ายเป็นการชั่วคราว - 305 ใช้ Proxy - 380 บริการเสริม
4xx การตอบกลับล้มเหลว - 400 คำสั่ง Request ไม่ถูกต้อง - 401 ไม่ได้รับสิทธิ ใช้กับ registrar เท่านั้น ส่วน Proxy ใช้ 407 - 402 ต้องจ่ายเงิน (สงวนไว้ใช้ในอนาคต) - 403 ซ่อน - 404 ไม่พบ ไม่มีผู้ใช้ชื่อนี้ - 405 ไม่อนุญาตให้ใช้วิธีนี้ - 406 ไม่สามารถรับได้ - 407 ไม่ได้รับสิทธิจาก Proxy - 408 หมดเวลา ไม่สามารถค้นหาผู้ใช้ได้ในเวลาที่กำหนด - 410 ไม่สามารถติดต่อผู้ใช้ได้ ณ เวลานี้ - 413 คำสั่ง Request ยาวเกินไป - 414 Request-URI ยาวเกินไป - 416 ไม่สนับสนุน URI แบบนี้ - 420 Server ไม่เข้าใจโปรโคตอ SIP ที่ส่งมา - 421 ต้องการข้อมูลเพิ่มเติม - 423 ช่วงเวลาน้อยเกินไป - 479 ไม่สามารถใช้ URI นี้ได้ - 480 ปิดบริการชั่วคราว - 481 ติดต่อไม่ได้ - 482 เกิดการวน loop - 483 เชื่อมต่อมากเกินไป - 484 Address ไม่ถูกต้อง - 485 สับสน - 486 สายไม่ว่าง - 487 ยุติการร้องขอ - 488 ไม่ได้รับ - 489 เหตุการณ์ไม่ถูกต้อง - 491 ยุติการร้องขอ - 493 ไม่ถูกกฎ ไม่สามารถถอดรหัส S/MIME ได้ - 494 ต้องการความปลอดภัย
5xx server มีปัญหา - 500 server มีปัญหาภายใน - 501 ยังไม่เปิดใช้วิธีนี้ - 502 Gateway ไม่ถูกต้อง - 503 ไม่สามารถให้บริการได้ - 504 หมดเวลาติดต่อ Server - 505 Server ไม่สนับสนุนโปรโคตอล SIP รุ่นนี้ - 513 ข้อความยาวเกินไป
6xx ความล้มเหลว - 600 ยุ่งตลอดเวลา - 603 ไม่รับ - 604 ไม่อยู่ตลอดเวลา - 606 ไม่ยอมรับ
อื่น ๆ เช่น - INFO ส่งข้อมูลโดยไม่แก้ไข Session State - REFER ใช้กับ call transfer - MESSAGE ข้อความที่ต้องการส่ง - UPDATE ส่งข้อมูลเพื่อแก้ไข Session State แต่ไม่เปลี่ยนสถานะการทำงาน
With the addressing scheme thus understood, there are six types of request messages defined, distinguished by what is called a method:
REGISTER: Is used by a client to register an address with a SIP server. INVITE: Indicates that the user or service is being invited to participate in a session. The body of this message would include a description of the session to which the callee is being invited. ACK: Confirms that the client has received a final response to an INVITE request, and is only used with INVITE requests. CANCEL: Is used to cancel a pending request. BYE: Is sent by a User Agent Client to indicate to the server that it wishes to terminate the call. OPTIONS: Is used to query a server about its capabilities. Other methods may be defined in the future and documented in subsequently published RFCs.
The response messages contain Status Codes and Reason Phrases that indicate the current condition of this request. The status code values are divided into six general categories:
1xx: Provisional: The request has been received and processing is continuing. 2xx: Success: An ACK, to indicate that the action was successfully received, understood, and accepted. 3xx: Redirection: Further action is required to process this request. 4xx: Client Error: The request contains bad syntax and cannot be fulfilled at this server. 5xx: Server Error: The server failed to fulfill an apparently valid request. 6xx: Global Failure: The request cannot be fulfilled at any server. As before, specific details on the SIP message formats, status codes, and other parameters are specified in RFC 3261.
Recall from our earlier tutorials that the SIP session may include voice, video and/or data information, and therefore a standard method of describing the session that is being initiated (using the INVITE message noted above) is required. This part of the puzzle is solved by the use of the Session Description Protocol (SDP), defined in RFC 2327, which will be the topic of our next tutorial.
