CN105765917A - Method and apparatus for coding and decoding SIP message - Google Patents

Method and apparatus for coding and decoding SIP message Download PDF

Info

Publication number
CN105765917A
CN105765917A CN201380081228.1A CN201380081228A CN105765917A CN 105765917 A CN105765917 A CN 105765917A CN 201380081228 A CN201380081228 A CN 201380081228A CN 105765917 A CN105765917 A CN 105765917A
Authority
CN
China
Prior art keywords
protocol header
message body
fields
message
binary data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201380081228.1A
Other languages
Chinese (zh)
Inventor
李春雷
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Feinno Communication Technology Co Ltd
Original Assignee
Beijing Feinno Communication Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Feinno Communication Technology Co Ltd filed Critical Beijing Feinno Communication Technology Co Ltd
Publication of CN105765917A publication Critical patent/CN105765917A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L51/00User-to-user messaging in packet-switching networks, transmitted according to store-and-forward or real-time protocols, e.g. e-mail
    • H04L51/06Message adaptation to terminal or network requirements
    • H04L51/066Format adaptation, e.g. format conversion or compression

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)
  • Telephonic Communication Services (AREA)

Abstract

Disclosed are a method and an apparatus for coding and decoding an SIP message. The method for coding an SIP message of an embodiment of the present invention comprises: obtaining mark information of an SIP message, and converting the mark information into binary data according to a first correspondence and then writing the binary data into a mark bit; for each protocol header, obtaining protocol header preamble information and protocol header content, converting the protocol header preamble information into binary data according to a second correspondence and then writing the binary data into a protocol header field, and converting the protocol header content into binary data and then writing the binary data into the protocol header field; when the SIP message comprises a message body, obtaining message body preamble information and a message body, converting the message body preamble information into binary data according to a third correspondence and then writing the binary data into a message body field, and converting the message body into binary data and then writing the binary data into the message body field; and combining the binary data in the mark bit, the protocol header field and the message body field according to a preset sequence, so as to obtain a coding result of the SIP message.

Description

Method and apparatus for coding and decoding SIP message
Coding method, coding/decoding method and the device of sip message
Technical field
The present invention relates to network communication technology field, the coding method of more particularly to a kind of SIP message and code device, and a kind of SIP message coding/decoding method and decoding apparatus.
Background technology
SIP (Session Initiation Protocol, Session initiation Protocol)The control protocol of an application layer, can for setting up, modification and terminate Multimedia session (or meeting), such as Internet phones.SIP can also invite participant to participate in the session existed, such as Multi-Party Conference.SIP pellucidly supports name to map and redirects service, so that Personal Mobile(User)A unique trappings can be used and without being concerned about their real network place.SIP can be from many aspects such as session, user's positioning, user's validity check, user capability inspection and session management be set up, and foundation, maintenance and termination to Multimedia session agreement provide support.
However, Session Initiation Protocol is plain text agreement, cause sip message body than larger, for example, SIP is invited(INVITE) message may be in 1500 bytes or more, and the general length of SIP OK message is 200-700 bytes, and SIP registration(REGISTER) message may be 400 bytes or more in length.
With use of the Session Initiation Protocol in 2.5G, 3G wireless domain handoff procedure, huge message body brings many problems to communication, for example, causing the propagation delay time in low speed IP connections excessive because sip message body is larger;Scene to needing retransmitting message, due to use diversified message in some message flows, huge SIP message bodies cause the lifting of call setup and call quality to be severely impacted.The content of the invention
In view of the above problems, the embodiments of the invention provide a kind of coding method of sip message and code device, and the coding/decoding method and decoding apparatus of corresponding sip message, the problem of causing propagation delay time larger because SIP message bodies are excessive to solve existing scheme, and have a strong impact on call setup and call quality etc..
In order to achieve the above object, the technical scheme that the embodiment of the present invention is used is as follows:
On the one hand, the embodiments of the invention provide a kind of coding method of sip message, including:
Obtain the label information of SIP message to be encoded, label information is converted to according to the first corresponding relation and write after binary data in marker bit, bit and label information corresponding numerical value of the first corresponding relation cue mark information in marker bit, the label information include type of message;
To each protocol header in SIP message, obtain the protocol header guidance information and protocol header content of protocol header, protocol header guidance information is converted to according to the second corresponding relation and write after binary data in protocol header fields, and by protocol header Content Transformation in write-in protocol header fields after binary data, second corresponding relation indicates bit and protocol header guidance information corresponding numerical value of the protocol header guidance information in protocol header fields, and indicates bit of the protocol header content in protocol header fields;
When sip message includes sip message body, obtain message body guidance information and the message body of sip message body, message body guidance information is converted to according to the 3rd corresponding relation and write after binary data in message body fields, and be converted to message body after binary data in write-in message body fields, 3rd corresponding relation indicates bit and message body guidance information corresponding numerical value of the message body guidance information in message body fields, and indicates bit of the message body in message body fields;
Binary data in marker bit, protocol header fields and message body fields is combined according to predefined procedure and obtains the coding result of SIP message.
On the other hand, the embodiments of the invention provide a kind of coding/decoding method of sip message, including:
Marker bit is determined from the binary data stream of SIP message to be decoded according to predefined procedure, the binary data stream is obtained by the binary data in marker bit, protocol header fields and message body fields;
The label information of sip message is known from marker bit according to the first corresponding relation, the label information includes type of message;Protocol header fields and message body fields are obtained from binary data stream;
To each protocol header fields, protocol header guidance information and protocol header content are extracted from protocol header fields according to the second corresponding relation, and protocol header guidance information and protocol header content are carried out decoding the protocol header for obtaining sip message;
To message body fields, message body guidance information and message body are extracted from message body fields according to the 3rd corresponding relation, and to message Body guidance information and message body decode the message body for obtaining sip message;
According to type of message, decoded sip message is obtained by the protocol header of sip message and the message body of sip message,
Wherein, bit and label information corresponding numerical value of the first corresponding relation cue mark information in marker bit;Second corresponding relation indicates bit and protocol header guidance information corresponding numerical value of the protocol header guidance information in protocol header fields, and indicates bit of the protocol header content in protocol header fields;3rd corresponding relation indicates bit and message body guidance information corresponding numerical value of the message body guidance information in message body fields, and indicates bit of the message body in message body fields.
Another further aspect, the embodiments of the invention provide a kind of code device of sip message, including:
Marker bit coding unit, the label information of the SIP message to be encoded for obtaining, label information is converted to according to the first corresponding relation and write after binary data in marker bit, bit and label information corresponding numerical value of the first corresponding relation cue mark information in marker bit, the label information include type of message;
Protocol header fields coding unit, for to each protocol header in SIP message, obtain the protocol header guidance information and protocol header content of protocol header, protocol header guidance information is converted to according to the second corresponding relation and write after binary data in protocol header fields, and by protocol header Content Transformation in write-in protocol header fields after binary data, second corresponding relation indicates bit and protocol header guidance information corresponding numerical value of the protocol header guidance information in protocol header fields, and indicates bit of the protocol header content in protocol header fields;
Message body fields coding unit, for when sip message includes sip message body, obtain message body guidance information and the message body of sip message body, message body guidance information is converted to according to the 3rd corresponding relation and write after binary data in message body fields, and be converted to message body after binary data in write-in message body fields, 3rd corresponding relation indicates bit and message body guidance information corresponding numerical value of the message body guidance information in message body fields, and indicates bit of the message body in message body fields;
Coding result obtaining unit, the coding result of sip message is obtained for the binary data in marker bit, protocol header fields and message body fields to be combined according to predefined procedure.
Another aspect, the embodiments of the invention provide a kind of decoding apparatus of sip message, including:
Marker bit decoding unit, for determining marker bit from the binary data stream of SIP message to be decoded according to predefined procedure, the binary data stream is obtained by the binary data in marker bit, protocol header fields and message body fields;
Know unit, the label information for knowing SIP message from marker bit according to the first corresponding relation, the label information includes type of message;
Field acquiring unit, for obtaining protocol header fields and message body fields from binary data stream;
Protocol header fields decoding unit, for to each protocol header fields, protocol header guidance information and protocol header content are extracted from protocol header fields according to the second corresponding relation, and protocol header guidance information and protocol header content are carried out decoding the protocol header for obtaining sip message;Message body fields decoding unit, for message body fields, extracting message body guidance information and message body from message body fields according to the 3rd corresponding relation, and carry out decoding the message body for obtaining sip message to message body guidance information and message body;
Decoded result obtaining unit, for according to type of message, decoded sip message to be obtained by the protocol header of sip message and the message body of sip message;
Wherein, bit and label information corresponding numerical value of the first corresponding relation cue mark information in marker bit;Second corresponding relation indicates bit and protocol header guidance information corresponding numerical value of the protocol header guidance information in protocol header fields, and indicates bit of the protocol header content in protocol header fields;3rd corresponding relation indicates bit and message body guidance information corresponding numerical value of the message body guidance information in message body fields, and indicates bit of the message body in message body fields.
The coding method of SIP message provided in an embodiment of the present invention and code device, by marker bit, protocol header fields and message body fields constitute the transformat of sip message, the label information of sip message is converted to based on the first corresponding relation and write after binary data in marker bit, each protocol header of SIP message is converted to based on the second corresponding relation and write after binary data in protocol header fields, the sip message body of sip message is converted to based on the 3rd corresponding relation and write after binary data in message body fields, it is achieved thereby that sip message is encoded into binary data stream by text message, significantly reduce the data volume transmitted during SIP message communicatings, shorten propagation delay time, quick set up is contributed to call and lifting call quality.
The coding/decoding method and decoding apparatus of sip message provided in an embodiment of the present invention, according to marker bit, the transformat that protocol header fields and message body fields constitute SIP message obtains marker bit from binary data stream and determines protocol header fields and message body fields, then it is based respectively on the first corresponding relation, second corresponding relation and the 3rd corresponding relation are to marker bit, protocol header fields and message body fields are decoded, sip message is reduced by the result decoded, so as to while data communication efficiency and quality is ensured, preferably compatible existing system, it is with strong applicability.Brief description of the drawings Fig. 1 shows a kind of coding method flow chart of sip message according to an embodiment of the invention;
Fig. 2 shows a kind of compression method flow chart according to another embodiment of the invention;
Fig. 3 shows a kind of coding method flow chart of sip message according to another embodiment of the invention;
Fig. 4 shows a kind of coding/decoding method flow chart of sip message according to another embodiment of the invention;
Fig. 5 shows a kind of code device structural representation of sip message according to another embodiment of the invention;
Fig. 6 shows a kind of decoding apparatus structural representation of sip message according to another embodiment of the invention.
Embodiment
To make the object, technical solutions and advantages of the present invention clearer, below in conjunction with accompanying drawing, embodiment of the present invention is described further in detail.
In order that the technical scheme of various embodiments of the present invention is clearer, first to SIP (Session Initiation Protocol, Session initiation Protocol)The transformat that the embodiment of the present invention is used during message communicating is illustrated.A kind of transformat provided in an embodiment of the present invention is referring to table 1:
Table 1
With 1 byte in the transformat of above-mentioned table 1(Byte) show the bit of information in marker bit and each field for unit, but be not limited to this, can also double byte or multibyte be unit to set bit of each information in transformat.The bit that various information take in table 1 can also be adjusted according to demand.
The corresponding transformat of one SIP message can be made up of a marker bit, one or more protocol header fields and a message body fields.
Bit 0 represents compression configured information in 1 Byte marker bit, and whether the formation indication message is compressed, for example, when the numerical value for compressing configured information is 1, represent that message is compressed, when the numerical value for compressing configured information is 0, represent that message is not compressed.
Bit 1 to bit 3 in marker bit retains, and bit 4 to bit 7 represents type of message, and the type of message and the relation of corresponding numerical value that the embodiment of the present invention is set can be with as shown in table 2 below:
Table 2
The bit of configured information and type of message in marker bit will be compressed, and compression configured information and the corresponding numerical value of type of message are all recorded in the first corresponding relation.
Each protocol header fields include a protocol header guiding position() and a protocol header content position Header-leader(Header-body), protocol header guidance information is set in protocol header guiding position, and protocol header content sets protocol header content in position.Protocol header guidance information includes the data type of protocol header type, protocol header fields encryption indication information and protocol header content.The present embodiment uses variable(Varint) mode is encoded to protocol header guidance information, with UTF-8 (8-bit Unicode Transformation Format, Unicode)Form or Varint modes are encoded to protocol header content, then the form of each protocol header fields can be expressed as follows:
Header-leader(Varint) | Header-body In scene shown in table 1, the data type of the presentation protocol head contents of bit 0 to bit 2, the presentation protocol head field encryption configured informations of bit 3, the presentation protocol head types of bit 4 to bit 7.By protocol header curriculum offering in one or more bytes after the byte of protocol header guidance information.
The relation of the data type of protocol header content and corresponding numerical value is referring to Table 3 below:
Table 3
When the numerical value of protocol header fields encryption indication information is 1 in protocol header fields, instruction is needed to the protocol header content-encrypt in protocol header fields;When the numerical value of protocol header fields encryption indication information is 0 in protocol header fields, instruction need not be to the protocol header content-encrypt in protocol header fields.
Protocol header type and corresponding numerical value(Be expressed as ID) relation referring to table 4 below:
Table 4
Numerical value (ID) protocol header type and message body type
0 sip message body (SipBody)
1 calling parameter (Call-ID)
2 command sequences(CSeq )
3 initiator addresses(From )
4 recipient address( To )
5 contact addresses (Contact)
6 content-lengths (Content-Length)
7 content types(Content-Type )
8 max-forwards (Max-Forwards)
9 routes(Route )
10 route records (Record-Route)
11 by path (Via)
12 demands (Require)
13 support (Supported)
14 do not support (Unsupported)
15 exceed the time limit the time(Expires )
16 recievers (Accept)
17 recievers decode (Accept-Encoding)
18 reciever language (Accept-Language)
19 transitional informations(Alert-Info )
20 allow(Allow )
21 authorization messages (Authentication-Info)
22 certifications (Authorization)
23 call informations(Call-Info )
Setting (Content-Disposition) is answered in 24
25 content decodings( Content-Encoding )
Language (Content-Language) is answered in 26
27 dates(Date )
28 error messages(Error-Info )
29 reply( In-Reply-To )
30 most ' J, exceed the time limit the time (Min-Expires) 31 MIME versions (MIME-Version)
32 tissues(Organization )
33 priority( Priority )
34 proxy authentications (Proxy- Authenticate)
35 agent authorizations (Proxy-Authorization)
36 agent demands(Proxy-Require )
37 reply (Reply-To)
38 reply(Retry-After )
39 servers (Server)
40 themes( Subject )
41 timestamps (Timestamp)
42 user agents(User-Agent )
43 warnings(Warning )
44 WWW certifications (WWW-Authenticate)
45 references(Refer-To )
46 are referenced( Referred-By )
47 events (Event)
48 allow event( Allow-Events )
49 subscription status( Subscription-State )
50 call requests send address (RequestUri)
51 SIP versions (Sip Version)
52 state codes(StatusCode) the bit and the corresponding numerical value of protocol header guidance information by protocol header guidance information in protocol header fields, and bit of the protocol header content in protocol header fields are all recorded in the second corresponding relation.
Each message body fields include a message body guiding position() and a message position Body-leader(Body-body ) .
Guide to set in message body guidance information, message position in position and message body is set.Message body guidance information include message body type,;Field encryption configured information and the data type of message body.The present embodiment is encoded using Varint modes to message body guiding position, and UTF-8 forms or Varint modes are encoded to message body, then the form of each message body fields can be expressed as follows:
Body -leader(Varint) | Body -body
In scene shown in table 1, bit 0 to bit 2 represents message body data type, and bit 3 represents message body fields encryption indication information, and bit 4 to bit 7 represents message body type.Message body is arranged in one or more bytes after the byte of protocol header guidance information.
Message body data type may refer to above-mentioned table 3 with the relation of corresponding numerical value.When the numerical value for adopting breath breath body body message body fields encryption indication information is 1, indicate to need the message body encryption in message body fields;When the numerical value of message body fields encryption indication information is 0, indicate that the message body in message body fields need not be encrypted.
The relation of message body type and corresponding numerical value referring to table 4, wherein, the corresponding numerical value of message body type is set to 0.
Bit and message body guidance information corresponding numerical value of the message body guidance information in message body fields, and bit of the message body in protocol header fields are all recorded in the 3rd corresponding relation.
A kind of coding method for sip message that one embodiment of the invention is provided, referring to Fig. 1, comprises the following steps:
S 100:The label information of sip message to be encoded is obtained, label information is converted to according to the first corresponding relation and write after binary data in marker bit, into step S 101.
Bit and label information corresponding numerical value of the first corresponding relation cue mark information in marker bit.Above-mentioned label information includes type of message.
In this step after type of message in obtaining label information, the compression configured information of SIP message can also be obtained, the compression configured information indicates whether to need to compress sip message.Then above-mentioned label information includes type of message and compression configured information.
For example, a sip message to be encoded can be as follows:
OPTIONS sip: [email protected]
Via: SIP/2.0/UDP pc33.atlanta. com;branch =z9Hg4bKhjhs8ass877
Max-Forwards: 70
To: <sip:[email protected]> From: Alice <sip:[email protected]> ;tag= 1928301774
Call-ID: a84b4c76e66710
Cseq: 63104 OPTIONS
Contact: <sip:[email protected]>
Accept: application/sdp
Content-Length:The type of message of 0 above-mentioned SIP message is " OPTIONS ", it is 6 according to the corresponding numerical value of table 2 " OPTIONS ", if the compression configured information of the SIP message indicates to compress, the marker bit that above-mentioned sip message encodes generation is expressed as follows:
/* *Marker**/
0x60 〃 marker bits:One Byte, high four expressions type of message, four expressions of family name are not compressed
S 101 :To each protocol header in sip message, obtain the protocol header guidance information and protocol header content of protocol header, protocol header guidance information is converted to according to the second corresponding relation and write after binary data in protocol header fields, and by protocol header Content Transformation to be write after binary data in protocol header fields, into step S 102.
Second corresponding relation indicates bit and protocol header guidance information corresponding numerical value of the protocol header guidance information in protocol header fields, and indicates bit of the protocol header content in protocol header fields.
Protocol header guidance information includes the data type of protocol header type, protocol header fields encryption indication information and protocol header content.The data type of the protocol header type in protocol header guidance information, protocol header fields encryption indication information and protocol header content is carried out being converted to three groups of binary data according to the second corresponding relation, by three groups of binary data combinations, the binary data after combination is encoded in Varint modes, the protocol header that encoded radio is write into protocol header fields guides position.
Example:Mouthful, view head sip is done to ten:[email protected], ten to do the ten of view head to do view head type be RequestUri for this, it is just blunt can ^ according to table 4!The corresponding numerical value of RequestUri is 50, i.e. ID (RequestUri)=50 (binary one 10010);Protocol header fields encryption indication information is indicated need not be to the protocol header content-encrypt in this protocol header fields, then ENCRYPTED=0 (Binary Zero 000);The data type of protocol header content is String, it is just blunt to be understood according to table 3, above-mentioned three groups of binary data, then be combined, the binary data after being combined by String (LENGTH-DELIMITED)=2 (Binary Zero 10) by equation below:
Header-leader = 1 10010«4 | 0000 | 010 = 1 10010,0,010.
Wherein, symbol "<<" expression is shifted left, and symbol T' is represented or operated.
According to Varint modes to the binary data after combination(1 10010,0,010) encoded, specifically included:Take low 7 010,0,010 above to mend 1 and obtain 1010,0010=0xA2, draw 0x06 by remaining high-order 1 10, then obtain to protocol header sip:The coding result of [email protected] protocol header guidance information is:0xA2 0x06, write the protocol header in the corresponding protocol header fields of the protocol header by the coding result and guide in position, be expressed as follows:
/* * S egment(Reque s Jr =sip: cam l@ch icago .com)**/
0xA2 0X06 //RequestlJri=sip:[email protected] protocol header guides the coding result of position
View head sip is done to ten:The ten of [email protected] do view head content (i.e. sip:[email protected]), ten data type for doing view head content is character string type, then according to UTF-8 said shanks, obtaining coding result is:0x73 0x69 0x70 0x3A 0x63 0x61 0x72 0x6F 0x6C 0x40 0x63 0x68 0x69 0x63 0x61 0x67 0x6F 0x2E 0x63 0x6F 0x6D, the coding result is write in the protocol header content position in the corresponding protocol header fields of the protocol header.
In another example, to protocol header Via: SIP/2.0/UDP pc33.atlanta. com; branch =z9Hg4bKhjhs8ass877 ,
The protocol header type of the protocol header is Via, understands that the corresponding numerical value of Via is 11, i.e. ID (Via)=l 1 (binary one 01 1) according to table 4;Protocol header fields encryption indication information is indicated need not be to the protocol header content-encrypt in this protocol header fields, then ENCRYPTED=0 (Binary Zero 000);The data type of protocol header content is String, it can be seen from table 3, above-mentioned three groups of binary data, then be combined, the binary data after being combined by String (LENGTH-DELIMITED)=2 (Binary Zero 10) by equation below:
Header-leader = 101 1«4 | 0000 | 010 =101 1 ,0,010.
According to Varint modes to the binary data after combination(101 1,0,010) encoded, specifically included:Take low 7 01 1,0,010 above to mend 1 and obtain 101 10010=0xB2, draw 0x01 by remaining high-order 1, then obtain to protocol header
Via: SIP/2.0/UDP pc33.atlanta. com;branch=z9HgThe coding result of 4bKhjhs8ass877 protocol header guidance information is:0xB2 0x01, write the protocol header in the corresponding protocol header fields of the protocol header by the coding result and guide in position.
To protocol header Via: SIP/2.0/UDP pc33.atlanta. com; branch =z9Hg4bKhjhs8ass877 protocol header content (i.e. SIP/2.0/UDP pc33.atlanta. com;branch =z9Hg4bKhjhs8ass877), the data type of the protocol header content is character string type, then according to UTF-8 said shanks, obtaining coding result is:0x73 0x69 0x70 0x3A 0x63 0x61 0x72 0x6F 0x6C 0x40 0x63 0x68 0x69 0x63 0x61 0x67 0x6F 0x2E 0x63 0x6F 0x6D, the coding result is write in the protocol header content position in the corresponding protocol header fields of the protocol header. In another example, to protocol header Max-Forwards:70, the protocol header type of the protocol header is Max-Forwards, understands that the corresponding numerical value of Max-Forwards is 8, i.e. ID (Max-Forwards)=8 (Binary Zero 100) according to table 4;Protocol header fields encryption indication information is indicated need not be to the protocol header content-encrypt in this protocol header fields, then ENCRYPTED=0 (Binary Zero 000);The data type of protocol header content is int, and it can be seen from table 3, above-mentioned three groups of binary data are then combined, the binary data after being combined by int (Varint)=l (Binary Zero 01) by equation below:
Header-leader =0100«4 | 0000 | 001 =0100,0,001。
According to Varint modes to the binary data after combination(0100,0,001) encoded, specifically included:Because the binary data length after combination is not above 7, immediately arrive at 0x81, then obtain be to the coding result of the protocol header guidance information of protocol header 70:0x81, writes the protocol header in the corresponding protocol header fields of the protocol header by the coding result and guides in position.
To protocol header Max-Forwards:70 protocol header content(I.e. 70), the data type of the protocol header content is integer, then according to Varint said shanks, obtaining coding result is:0x44, the coding result is write in the protocol header content position in the corresponding protocol header fields of the protocol header.
Above-mentioned coding method is repeated, until being finished to all agreement header encoders in sip message to be encoded.
Therefore, the present embodiment is used after binary coding, and a protocol header in sip message can be represented using one or two byte, significantly reduces the data volume for needing to transmit.
S 102:When sip message includes sip message body, obtain message body guidance information and the message body of sip message body, message body guidance information is converted to according to the 3rd corresponding relation and write after binary data in message body fields, and be converted to message body after binary data in write-in message body fields, into step S 103.
3rd corresponding relation indicates bit and message body guidance information corresponding numerical value of the message body guidance information in message body fields, and indicates bit of the message body in message body fields.
Message body fields include message body guiding position and message position.Message body guidance information includes the data type of message body type, message body fields encryption indication information and message body, wherein, message body fields encryption indication information indicates whether to need to message body field encryption.
For message body guidance information, message body type, message body fields encryption indication information and the data type of message body of message body guidance information according to the 3rd corresponding relation to getting carry out being converted to three groups of binary data, by three groups of binary data combinations, the binary data after combination is encoded in Varint modes, the message body that encoded radio is write into message body fields guides position.The specific coding mode that position is guided to message body is identical with the coded system that protocol header guides position, will not be repeated here.
For message body, when the data type of message body is character string type, message body is converted into binary data according to UTF-8 forms;When the data type of message body is integer, message body is converted into binary data according to Varint modes, in the message position that the binary data after conversion is write to message body fields.
It is appreciated that when sip message body is not present in sip message to be encoded, step S 102 can be omitted.
S 103 :Binary data in marker bit, protocol header fields and message body fields is combined according to predefined procedure and obtains the coding result of sip message.
Above-mentioned predefined procedure can be that the transformat for providing marker bit, protocol header fields and message body fields according to the order arranged from front to back, i.e. the present embodiment can be expressed as follows:
Marker bit I protocol header fields I message body fields
It is appreciated that when sip message body is not present in sip message to be encoded, only the binary data in marker bit and protocol header fields can be combined according to predefined procedure and obtain the coding result of SIP message;Or, by marker bit, protocol header fields and message body fields according to the sequential combination arranged from front to back, but data in message body fields are sky.In transmitting SIP message all it is to use plaintext transmission in existing scheme, cause the security of data transfer poor, for this problem, the coding method for the sip message that another embodiment of the invention is provided, sip message can be encrypted, improve the security of data transfer.The other embodiment of the present invention is may refer to the other guide in the coding method of sip message.
Before the operation for the coding result for obtaining SIP message that marker bit, protocol header fields and message body fields combine according to predefined procedure is performed, the encryption method that the present embodiment is provided includes following operation:
For protocol header fields, protocol header fields encryption indication information according to being write in protocol header fields judges whether to need to encrypt protocol header fields, for example, when the numerical value of the encryption indication information in protocol header fields is 1, judgement needs to encrypt protocol header fields, that is, needs that the protocol header content position in protocol header fields is encrypted.When needing to encrypt protocol header fields, the original binary data in protocol header content position is encrypted using the AES of selection, the protocol header content after encryption uses array(Such as array byte []) storage, the original binary data in protocol header content position is replaced with the binary data after encryption, and the data type of the protocol header content in protocol header fields is revised as array.
The present embodiment is that each protocol header fields set a protocol header fields encryption indication information respectively, so as to be encrypted for specific protocol head field, the operation only to area protocol head field encryption is realized, so as to avoid due to being added to whole protocol header fields It is close, the problem of causing sip message bust this etc..
For message body fields, message body fields encryption indication information according to being write in message body fields judges whether to need to message body field encryption, for example, when the numerical value of the encryption indication information in message body fields is 1, judgement is needed to message body field encryption, that is, needs that the message position in message body fields is encrypted.When needing to message body field encryption, the original binary data in message position is encrypted using the AES of selection, message body after encryption uses storage of array, the original binary data in message position is replaced with the binary data after encryption, and the data type of the message body in message body fields is revised as array.
Whether need that protocol header fields and/or message body fields encryption can be determined by the application-level logic of communication system, and the AES of above-mentioned selection can also be consulted to decide by communicating pair.In existing scheme when being compressed to SIP message, can only be using fixed compression algorithm, it can not be changed according to the demand of communicating pair, and compression effectiveness is extremely limited, for this problem, the coding method for the SIP message that another embodiment of the invention is provided, the compression method used can flexibly be chosen, SIP message is compressed according to the compression method of selection, the data volume for needing to transmit further is reduced, and the compression method that the present embodiment is provided can obtain preferably compression effectiveness.The other embodiment of the present invention is may refer to the other guide in the coding method of SIP message.
Referring to Fig. 2, in the operation that marker bit, protocol header fields and message body fields are combined into the coding result for obtaining sip message according to predefined procedure, the compression method that the present embodiment is provided includes following operation:
S200:According to the compression configured information write in marker bit, judge whether to need to be compressed SIP message, if so, into step S201, if it is not, end operation.
For example, when the numerical value of the compression configured information in marker bit is 1, judging that needs are compressed.
S201 :When needing to be compressed SIP message, the binary data in protocol header fields and message body fields is compressed using the compression algorithm of selection, compressed data is obtained, into step S202
The compression algorithm of above-mentioned selection can consult determination by communicating pair, and different communication scenes can select different compression algorithms.
S202:The data length of compressed data is obtained, and the data length binary data is converted into, data length is converted to after binary data into step S203 this step, the binary data can again be encoded, obtained in Varint modes
The data length of Varint types, so that in decoding process, it is that can obtain data length to read a Varint numerical value after marker bit, the data for then reading follow-up correspondence byte according to the data length are used as compressed data.
S203 :Binary data in marker bit, the corresponding binary data of data length and compressed data are combined according to predefined procedure and obtain the coding result of sip message.
For the scene for needing to compress, the transformat used can be expressed as follows:
Marker bit I datum length(Varint) I compressed datas
It should be noted that for there is the scene of cryptographic operation and squeeze operation simultaneously, in an encoding process, it should first carry out cryptographic operation, then perform squeeze operation.In decoding process, it should first carry out decompression operation, then perform decryption oprerations.
The coding method for the sip message that another embodiment of the invention is provided, referring to Fig. 3, comprises the following steps:
S300:According to the type of message of sip message to be encoded and compression configured information(Whether message is compressed)Coding generation marker bit, into step S301
S301 :Each protocol header of sip message is handled successively, is that each protocol header generates a protocol header fields, into step S302
S302:According to the data type of the protocol header type, protocol header fields encryption indication information and protocol header content of the protocol header guidance information of each protocol header, generate the protocol header guiding position of this protocol header, and the protocol header content position of this protocol header is generated according to the protocol header content of each protocol header, into step S303
If necessary to be encrypted to protocol header, the data type of protocol header content can use array after encryption.For example, the protocol header content in protocol header is encrypted the AES consulted according to communicating pair, the protocol header content after encryption is stored with byte [] type.
S303 :Judge whether all protocol headers are disposed, if so, into step S304, return to step S301 if not
S304:The sip message body of sip message is converted to message body fields are write after binary data, into step S305.If message body guidance information indicates to need to encrypt message body, the message body then first encoded according to the AES of selection to binary format is encrypted, the array formats message body after encryption is write into message body fields again, and the data type of the message body in message body fields is revised as array.
S305:Judge whether that needs are compressed, if so, into step S306, if it is not, into step S307.Compression configured information in marker bit judges whether to need to be compressed sip message.
S306:The binary data in protocol header fields and message body fields is compressed according to the compression algorithm of selection, compressed data is obtained.The data length of compressed data is obtained, and the data length is converted to binary data.Binary data in marker bit, the corresponding binary data of data length and compressed data are got up to obtain the coding result of sip message according to following sequential combinations:
Marker bit I datum length I compressed datas S307:Binary data in marker bit, protocol header fields and message body fields is got up to obtain to the coding result of SIP message according to following sequential combinations:Marker bit I protocol header fields I message body fields.Another embodiment of the invention provides a kind of coding/decoding method of sip message, and referring to Fig. 4, this method comprises the following steps: S400:Marker bit is determined from the binary data stream of SIP message to be decoded according to predefined procedure, the binary data stream is obtained by the binary data in marker bit, protocol header fields and message body fields.Above-mentioned predefined procedure can be:Marker bit I protocol header fields I message body fields, or:Marker bit I datum length I compressed datas, the data for reading first character section from binary data stream according to predefined procedure are marker bit.
S401 :The label information of SIP message is known from marker bit according to the first corresponding relation, the label information includes type of message, into step S402.Bit and label information corresponding numerical value of the first corresponding relation cue mark information in marker bit.Type of message according to being recorded in marker bit knows that sip message is SIP request(SipRequest) message or sip response(SipResponse) message.
In the label information got in this step in addition to including type of message, compression configured information can also be included, can know whether sip message is compressed from compression configured information.
S402:Protocol header fields and message body fields are obtained from binary data stream, into step S403.
When sip message is compressed, the data length that a Varint numerical value obtains compressed data is read after marker bit, the data for then proceeding to read data length correspondence size obtain compressed data.Protocol header fields and message body fields are obtained according to the decompression algorithm decompression of selection to compressed data.
When sip message is not compressed, the data after marker bit are protocol header fields and message body fields.
S403 :To each protocol header fields, protocol header guidance information and protocol header content are extracted from protocol header fields according to the second corresponding relation, and protocol header guidance information and protocol header content are carried out decoding the protocol header for obtaining sip message.Into step S404.
Second corresponding relation indicates bit and protocol header guidance information corresponding numerical value of the protocol header guidance information in protocol header fields, and indicates bit of the protocol header content in protocol header fields.
To each protocol header fields, first read a Varint numerical value according to Varint modes and obtain protocol header guiding position.Protocol header guidance information is obtained from protocol header guiding position.
Protocol header fields encryption indication information in position is guided according to protocol header and knows whether protocol header content encrypts, if, continue to read the protocol header content of encryption according to byte [] form, then, the protocol header content of encryption is decrypted according to the decipherment algorithm of selection, protocol header content is obtained;If it is not, guiding the data type continuation reading data that the protocol header data type in position is specified according to protocol header, protocol header content is obtained.
Protocol header guidance information and protocol header content are carried out decoding the protocol header for obtaining the corresponding SIP message of the protocol header fields according to the second corresponding relation.
S404 :To message body fields, message body guidance information and message body are extracted from message body fields according to the 3rd corresponding relation, and message body guidance information and message body are carried out decoding the message body for obtaining sip message.Into step S405.
3rd corresponding relation indicates bit and message body guidance information corresponding numerical value of the message body guidance information in message body fields, and indicates bit of the message body in message body fields.
To each message body fields, first read a Varint numerical value according to Varint modes and obtain message body guiding position.Message body guidance information is obtained from message body guiding position.
Message body fields encryption indication information in position is guided according to message body and knows whether message body encrypts, if so, continuing to read the message body of encryption according to byte [] form, then, the message body of encryption is decrypted according to the decipherment algorithm of selection, message body is obtained;If it is not, guiding the data type continuation reading data that the message body data type in position is specified according to message body, message body is obtained.
Message body guidance information and message body decode obtaining the corresponding sip message body of the message body fields according to the 3rd corresponding relation.
S405 :According to type of message, decoded sip message is obtained by the protocol header of sip message and the sip message body of sip message.When type of message is sip request message, according to the form of sip request message, decoded sip message is obtained by the protocol header of sip message and the sip message body of sip message.
When type of message is sip response message, according to the form of sip response message, decoded sip message is obtained by the protocol header of sip message and the sip message body of sip message.
Another embodiment of the invention provides a kind of code device 500 of sip message, and referring to Fig. 5, the device 500 includes:Marker bit coding unit 510, the label information of sip message to be encoded for obtaining, label information is converted to according to the first corresponding relation and write after binary data in marker bit, bit and label information corresponding numerical value of the first corresponding relation cue mark information in marker bit, the label information include type of message.Specifically, marker bit coding unit 510, type of message and compression configured information for obtaining sip message, and be converted to type of message and compression configured information after binary data in write-in marker bit according to the first corresponding relation, wherein, label information includes type of message and compression configured information, and compression configured information indicates whether to need to SIP message compressions. Wherein, bit and label information corresponding numerical value of the above-mentioned first corresponding relation cue mark information in marker bit.Protocol header fields coding unit 51 1, for to each protocol header in sip message, obtain the protocol header guidance information and protocol header content of protocol header, protocol header guidance information is converted to according to the second corresponding relation and write after binary data in protocol header fields, and by protocol header Content Transformation in write-in protocol header fields after binary data, second corresponding relation indicates bit and protocol header guidance information corresponding numerical value of the protocol header guidance information in protocol header fields, and indicates bit of the protocol header content in protocol header fields.Wherein, protocol header fields coding unit 51 1, for the data type of the protocol header type, protocol header fields encryption indication information and protocol header content that obtain protocol header guidance information, the data type of protocol header type, protocol header fields encryption indication information and protocol header content is carried out being converted to three groups of binary data according to the second corresponding relation, by three groups of binary data combinations, the binary data after combination is encoded in Varint modes, the protocol header that encoded radio is write into protocol header fields guides position;And, the protocol header content encoded in a binary format is write to the protocol header content position of protocol header fields according to the second corresponding relation;Wherein, protocol header fields include protocol header guiding position and protocol header content position, protocol header guidance information includes the data type of protocol header type, protocol header fields encryption indication information and protocol header content, and protocol header fields encryption indication information indicates whether to need to encrypt protocol header fields.Specifically, protocol header fields coding unit 51 1, it is additionally operable to when the data type of protocol header content is character string type, by protocol header Content Transformation is binary data according to Unicode UTF-8 forms;When protocol header content data type be integer when, according to Varint modes by protocol header Content Transformation be binary data;
Wherein, the second corresponding relation indicates bit and protocol header guidance information corresponding numerical value of the protocol header guidance information in protocol header fields, and indicates bit of the protocol header content in protocol header fields;
Message body fields coding unit 512, for when sip message includes sip message body, obtain message body guidance information and the message body of sip message body, message body guidance information is converted to according to the 3rd corresponding relation and write after binary data in message body fields, and be converted to message body after binary data in write-in message body fields, 3rd corresponding relation indicates bit and message body guidance information corresponding numerical value of the message body guidance information in message body fields, and indicates bit of the message body in message body fields.Wherein, message body fields coding unit 512, message body type, message body fields encryption indication information and the data type of message body for the message body guidance information according to the 3rd corresponding relation to getting carry out being converted to three groups of binary data, by three groups of binary data combinations, the binary data after combination is encoded in Varint modes, the message body that encoded radio is write into message body fields guides position;And, the message body encoded in a binary format is write to the message position of message body fields according to the 3rd corresponding relation;Wherein, message body fields include message body guiding position and message position, message body guidance information includes the data type of message body type, message body fields encryption indication information and message body, and message body fields encryption indication information indicates whether to need to message body field encryption.Message body fields coding unit 512, for when the data type of message body is character string type, message body to be converted into binary data according to UTF-8 forms;When the data type of message body is integer, message body is converted into binary data according to Varint modes.
Wherein, the 3rd corresponding relation indicates bit and message body guidance information corresponding numerical value of the message body guidance information in message body fields, and indicates bit of the message body in message body fields.
Coding result obtaining unit 513, the coding result of sip message is obtained for the binary data in marker bit, protocol header fields and message body fields to be combined according to predefined procedure.Optionally, coding result obtaining unit 513, is additionally operable to combine and obtain the coding result of sip message the binary data in marker bit, the corresponding binary data of data length and compressed data according to predefined procedure.
Optionally, device 500 also includes ciphering unit 514, for being judged whether to need to encrypt protocol header fields according to the protocol header fields encryption indication information write in protocol header fields;When needing to encrypt protocol header fields, the original binary data in protocol header content position is encrypted using the AES of selection, the original binary data in protocol header content position is replaced with the binary data of the array formats after encryption, and the data type of the protocol header content in protocol header fields is revised as array;And, judge whether to need to message body field encryption according to the message body fields encryption indication information write in message body fields;When needing to message body field encryption, the original binary data in message position is encrypted using the AES of selection, the original binary data in message position is replaced with the binary data of the array formats after encryption, and the data type of the message body in message body fields is revised as array.
Optionally, device 500 also includes compression unit 515, for according to the compression configured information write in marker bit, judging whether to need to be compressed sip message;When needing to be compressed sip message, the binary data in protocol header fields and message body fields is compressed using the compression algorithm of selection, compressed data is obtained;The data length of compressed data is obtained, and the data length is converted to binary data.The specific works mode of each unit, may refer to the related content in coding method provided in an embodiment of the present invention, will not be repeated here in code device provided in an embodiment of the present invention.Another embodiment of the invention provides a kind of decoding apparatus 600 of sip message, and referring to Fig. 6, device 600 includes:Marker bit decoding unit 610, for determining marker bit from the binary data stream of sip message to be decoded according to predefined procedure, the binary data stream is obtained by the binary data in marker bit, protocol header fields and message body fields.
Know unit 61 1, the label information for knowing sip message from marker bit according to the first corresponding relation, the label information includes disappearing Cease type.Wherein, unit 61 1 is known, type of message and compression configured information for knowing sip message from marker bit according to the first corresponding relation.
Field acquiring unit 612, for obtaining protocol header fields and message body fields from binary data stream.Specifically, field acquiring unit 612, for when compression configured information indicates that sip message is uncompressed, protocol header fields and message body fields to be obtained from the binary data stream of sip message to be decoded according to predefined procedure;When compression configured information indicates that SIP message is compressed, the data length of compressed data is obtained, compressed data is extracted from binary data stream according to the data length;Compressed data is decompressed using the decompression algorithm of selection, protocol header fields and message body fields are obtained.
Protocol header fields decoding unit 613, for to each protocol header fields, protocol header guidance information and protocol header content are extracted from protocol header fields according to the second corresponding relation, and protocol header guidance information and protocol header content are carried out decoding the protocol header for obtaining SIP message.Wherein, protocol header fields decoding unit 613, for the protocol header guidance information and protocol header content being pointed in same protocol header fields, when protocol header guidance information indicates that protocol header fields are encrypted, read the protocol header content after the encryption of array formats in protocol header fields, the protocol header content after encryption is decrypted using the decipherment algorithm of selection, then the protocol header content after protocol header guidance information and decryption is carried out according to the second corresponding relation to decode the protocol header for obtaining the corresponding sip message of the protocol header fields.
Message body fields decoding unit 614, for to message body fields, message body guidance information and message body are extracted from message body fields according to the 3rd corresponding relation, and message body guidance information and message body are carried out decoding the sip message body for obtaining sip message.Wherein, message body fields decoding unit 614, for message body guidance information and the message body being pointed in same message body fields, when message body guidance information indicates that message body fields are encrypted, read the message body after the encryption of array formats in message body fields, the message body after encryption is decrypted using the decipherment algorithm of selection, then the message body after message body guidance information and decryption is carried out according to the 3rd corresponding relation to decode the protocol header for obtaining the corresponding sip message of the protocol header fields.
Decoded result obtaining unit 615, for according to type of message, decoded sip message to be obtained by the protocol header of sip message and the sip message body of sip message.
The specific works mode of each unit, may refer to the related content in coding/decoding method provided in an embodiment of the present invention, will not be repeated here in decoding apparatus provided in an embodiment of the present invention.
From the above mentioned, the coding method of SIP message provided in an embodiment of the present invention and code device, by marker bit, protocol header fields and message body fields constitute the transformat of sip message, the label information of sip message is converted to based on the first corresponding relation and write after binary data in marker bit, each protocol header of SIP message is converted to based on the second corresponding relation and write after binary data in protocol header fields, the sip message body of sip message is converted to based on the 3rd corresponding relation and write after binary data in message body fields, it is achieved thereby that SIP message is encoded into binary data stream by text message, significantly reduce the data volume transmitted during sip message communication, shorten propagation delay time, quick set up is contributed to call and lifting call quality.
The coding/decoding method and decoding apparatus of sip message provided in an embodiment of the present invention, according to marker bit, the transformat that protocol header fields and message body fields constitute SIP message obtains marker bit from binary data stream and determines protocol header fields and message body fields, then it is based respectively on the first corresponding relation, second corresponding relation and the 3rd corresponding relation are to marker bit, protocol header fields and message body fields are decoded, sip message is reduced by the result decoded, so as to while data communication efficiency and quality is ensured, preferably compatible existing system, it is with strong applicability.For the ease of clearly describing the technical scheme of the embodiment of the present invention, in the embodiment of invention, employ " first ", " second;; wait printed words to function and act on essentially identical identical entry or similar item and make a distinction; it will be appreciated by those skilled in the art that " first ", " second, wait printed words not to be defined to quantity and execution order.
The foregoing is merely illustrative of the preferred embodiments of the present invention, is not intended to limit the scope of the present invention.Any modification, equivalent substitution and improvements made within the spirit and principles of the invention etc., are all contained in protection scope of the present invention.

Claims (1)

  1. Claims
    1st, a kind of coding method of sip message, including:
    Obtain the label information of Session initiation Protocol SIP message to be encoded, the label information is converted to according to the first corresponding relation and write after binary data in marker bit, first corresponding relation indicates bit and the label information corresponding numerical value of the label information in marker bit, and the label information includes type of message;
    To each protocol header in the SIP message, obtain the protocol header guidance information and protocol header content of the protocol header, the protocol header guidance information is converted to according to the second corresponding relation and write after binary data in protocol header fields, and by the protocol header Content Transformation in write-in protocol header fields after binary data, second corresponding relation indicates bit and the protocol header guidance information corresponding numerical value of the protocol header guidance information in protocol header fields, and indicates bit of the protocol header content in protocol header fields;When the sip message includes sip message body, obtain message body guidance information and the message body of the sip message body, the message body guidance information is converted to according to the 3rd corresponding relation and write after binary data in message body fields, and be converted to the message body after binary data in write-in message body fields, 3rd corresponding relation indicates bit and the message body guidance information corresponding numerical value of the message body guidance information in message body fields, and indicates bit of the message body in message body fields;
    Binary data in the marker bit, protocol header fields and message body fields is combined according to predefined procedure and obtains the coding result of the SIP message.
    2nd, according to the method described in claim 1, wherein, the label information is converted to and marker bit is write after binary data includes by the label information for obtaining sip message to be encoded according to the first corresponding relation:
    The type of message and compression configured information of the SIP message are obtained, and is converted to the type of message and compression configured information after binary data in write-in marker bit according to the first corresponding relation;Wherein, the compression configured information indicates whether to need to compress sip message.
    3rd, according to the method described in claim 1, wherein, described be converted to the protocol header guidance information according to the second corresponding relation is write in protocol header fields after binary data, and the protocol header Content Transformation is included for write-in protocol header fields after binary data:Obtain the data type of the protocol header type, protocol header fields encryption indication information and protocol header content of the protocol header guidance information, the data type of the protocol header type, protocol header fields encryption indication information and protocol header content is carried out being converted to three groups of binary data according to the second corresponding relation, by three groups of binary data combination, the binary data after combination is encoded in variable V arint modes, the protocol header that encoded radio is write into protocol header fields guides position;And,
    The protocol header content encoded in a binary format is write to the protocol header content position of protocol header fields according to the second corresponding relation;Wherein, the protocol header fields encryption indication information indicates whether to need to encrypt protocol header fields.
    4th, according to the method described in claim 1, wherein, it is described according to the 3rd corresponding relation by the message body guidance information be converted to after binary data write message body fields in, and by the message body be converted to after binary data write message body fields include:
    Message body type, message body fields encryption indication information and the data type of message body of message body guidance information according to the 3rd corresponding relation to getting carry out being converted to three groups of binary data, by three groups of binary data combination, the binary data after combination is encoded in Varint modes, the message body that encoded radio is write into message body fields guides position;And,
    The message body encoded in a binary format is write to the message position of message body fields according to the 3rd corresponding relation;
    Wherein, the message body fields encryption indication information indicates whether to need to message body field encryption.
    5th, method according to claim 2, wherein, before the coding result for obtaining the sip message that the marker bit, protocol header fields and message body fields combine according to predefined procedure, methods described also includes:
    Protocol header fields encryption indication information according to being write in protocol header fields judges whether to need to encrypt the protocol header fields;When needing to encrypt the protocol header fields, the original binary data in protocol header content position is encrypted using the AES of selection, the original binary data in protocol header content position is replaced with the binary data of the array formats after encryption, and the data type of the protocol header content in protocol header fields is revised as array;And,
    Message body fields encryption indication information according to being write in message body fields judges whether to need to encrypt the message body fields;When needing to encrypt the message body fields, the original binary data in message position is encrypted using the AES of selection, the original binary data in message position is replaced with the binary data of the array formats after encryption, and the data type of the message body in message body fields is revised as array.
    6th, method according to claim 5, wherein, the marker bit, protocol header fields and message body fields are combined according to predefined procedure to be obtained the coding result of the sip message and includes: According to the compression configured information write in marker bit, judge whether to need to be compressed the sip message;
    When needing to be compressed the SIP message, the binary data in the protocol header fields and message body fields is compressed using the compression algorithm of selection, compressed data is obtained;
    The data length of the compressed data is obtained, and the data length is converted into binary data;
    Binary data in marker bit, the corresponding binary data of data length and compressed data are combined according to predefined procedure and obtain the coding result of the sip message.
    7th, according to the method described in claim 1, wherein,
    It is described to include the protocol header Content Transformation for binary data:
    When protocol header content data type be character string type when, according to Unicode UTF-8 forms by protocol header Content Transformation be binary data;
    When protocol header content data type be integer when, according to Varint modes by protocol header Content Transformation be binary data;It is described the message body is converted into binary data to include:
    When the data type of message body is character string type, message body is converted into binary data according to UTF-8 forms;When the data type of message body is integer, message body is converted into binary data according to Varint modes.
    8th, a kind of coding/decoding method of sip message, including:
    Marker bit is determined from the binary data stream of sip message to be decoded according to predefined procedure, the binary data stream is obtained by the binary data in marker bit, protocol header fields and message body fields;
    The label information of the sip message is known from the marker bit according to the first corresponding relation, the label information includes type of message;From the binary data stream obtain protocol header fields and;Xiao ceases body field;
    To each protocol header fields, protocol header guidance information and protocol header content are extracted from protocol header fields according to the second corresponding relation, and the protocol header guidance information and protocol header content are carried out decoding the protocol header for obtaining sip message;
    To message body fields, message body guidance information and message body are extracted from message body fields according to the 3rd corresponding relation, and the message body guidance information and message body are carried out decoding the sip message body for obtaining sip message;
    According to the type of message, decoded sip message is obtained by the protocol header of the sip message and the sip message body of sip message;Wherein, first corresponding relation indicates bit and the label information corresponding numerical value of the label information in marker bit;Second corresponding relation indicates bit and the protocol header guidance information corresponding numerical value of the protocol header guidance information in protocol header fields, and indicates bit of the protocol header content in protocol header fields;3rd corresponding relation indicates bit and the message body guidance information corresponding numerical value of the message body guidance information in message body fields, and indicates bit of the message body in message body fields.
    9th, method according to claim 8, wherein, it is described to know that the label information of the sip message includes from the marker bit according to the first corresponding relation:The type of message and compression configured information of sip message are known from the marker bit according to the first corresponding relation;Then the protocol header fields and message body fields of being obtained from the binary data stream include:
    When the compression configured information indicates that the sip message is uncompressed, protocol header fields and message body fields are obtained from the binary data stream of sip message to be decoded according to the predefined procedure;
    When the compression configured information indicates that the SIP message is compressed, the data length of compressed data is obtained, compressed data is extracted from binary data stream according to the data length;The compressed data is decompressed using the decompression algorithm of selection, protocol header fields and message body fields are obtained.
    10th, the method according to claim 8, wherein, it is described to extract protocol header guidance information and protocol header content from protocol header fields according to the second corresponding relation, and the protocol header guidance information and protocol header content are carried out decoding the protocol header for obtaining SIP message included:
    The protocol header guidance information and protocol header content being pointed in same protocol header fields, when protocol header guidance information indicates that protocol header fields are encrypted, read the protocol header content after the encryption of array formats in protocol header fields, the protocol header content after encryption is decrypted using the decipherment algorithm of selection, then the protocol header content after protocol header guidance information and decryption is carried out according to the second corresponding relation to decode the protocol header for obtaining the corresponding sip message of the protocol header fields.
    11, the method according to claim 8, wherein, it is described to extract message body guidance information and message body from message body fields according to the 3rd corresponding relation, and the message body guidance information and message body are carried out decoding the message body for obtaining sip message included:
    Message body guidance information and message body in same message body fields are pointed to, when message body guidance information indicates that message body fields are added When close, read the message body after the encryption of array formats in message body fields, the message body after encryption is decrypted using the decipherment algorithm of selection, then the message body after message body guidance information and decryption is carried out according to the 3rd corresponding relation to decode the protocol header for obtaining the corresponding sip message of the protocol header fields.
    12nd, a kind of code device of sip message, including:
    Marker bit coding unit, the label information of the SIP message to be encoded for obtaining, the label information is converted to according to the first corresponding relation and write after binary data in marker bit, first corresponding relation indicates bit and the label information corresponding numerical value of the label information in marker bit, and the label information includes type of message;
    Protocol header fields coding unit, for to each protocol header in the SIP message, obtain the protocol header guidance information and protocol header content of the protocol header, the protocol header guidance information is converted to according to the second corresponding relation and write after binary data in protocol header fields, and by the protocol header Content Transformation in write-in protocol header fields after binary data, second corresponding relation indicates that the protocol header is led
    Bit and the protocol header guidance information corresponding numerical value of 51 information in protocol header fields, and indicate bit of the protocol header content in protocol header fields;
    Message body fields coding unit, for when the sip message includes sip message body, obtain message body guidance information and the message body of the sip message body, the message body guidance information is converted to according to the 3rd corresponding relation and write after binary data in message body fields, and be converted to the message body after binary data in write-in message body fields, the 3rd corresponding relation indicates that the message body is led
    Bit and the message body guidance information corresponding numerical value of 51 information in message body fields, and indicate bit of the message body in message body fields;
    Coding result obtaining unit, the coding result of the sip message is obtained for the binary data in the marker bit, protocol header fields and message body fields to be combined according to predefined procedure.
    13rd, device according to claim 12, wherein, the marker bit coding unit, type of message and compression configured information for obtaining the sip message, and be converted to the type of message and compression configured information after binary data in write-in marker bit according to the first corresponding relation;Wherein, the compression configured information indicates whether to need to compress sip message.
    14, device according to claim 12, wherein, the protocol header fields coding unit, protocol header type for obtaining the protocol header guidance information, the data type of protocol header fields encryption indication information and protocol header content, according to the second corresponding relation to the protocol header type, the data type of protocol header fields encryption indication information and protocol header content carries out being converted to three groups of binary data, by three groups of binary data combination, the binary data after combination is encoded in Varint modes, the protocol header that encoded radio is write into protocol header fields guides position;And, the protocol header content encoded in a binary format is write to the protocol header content position of protocol header fields according to the second corresponding relation;Wherein, the protocol header fields encryption indication information indicates whether to need to encrypt protocol header fields.
    15th, device according to claim 13, wherein, the message body fields coding unit, message body type, message body fields encryption indication information and the data type of message body for the message body guidance information according to the 3rd corresponding relation to getting carry out being converted to three groups of binary data, by three groups of binary data combination, the binary data after combination is encoded in Varint modes, the message body that encoded radio is write into message body fields guides position;And, the message body encoded in a binary format is write to the message position of message body fields according to the 3rd corresponding relation;Wherein, the message body fields encryption indication information indicates whether to need close to message body fields power mouthful.
    16th, device according to claim 13, wherein, described device also includes ciphering unit, for being judged whether to need to encrypt the protocol header fields according to the protocol header fields encryption indication information write in protocol header fields;When needing to encrypt the protocol header fields, the original binary data in protocol header content position is encrypted using the AES of selection, the original binary data in protocol header content position is replaced with the binary data of the array formats after encryption, and the data type of the protocol header content in protocol header fields is revised as array;And, judged whether to need to encrypt the message body fields according to the message body fields encryption indication information write in message body fields;When needing to encrypt the message body fields, the original binary data in message position is encrypted using the AES of selection, the original binary data in message position is replaced with the binary data of the array formats after encryption, and the data type of the message body in message body fields is revised as array.
    17th, device according to claim 16, wherein, described device also includes compression unit, for according to the compression configured information write in marker bit, judging whether to need to be compressed the sip message;When needing to be compressed the sip message, the binary data in the protocol header fields and message body fields is compressed using the compression algorithm of selection, compressed data is obtained;The data length of the compressed data is obtained, and the data length is converted to binary data; The coding result obtaining unit, for combining and obtaining the coding result of the sip message binary data in marker bit, the corresponding binary data of data length and compressed data according to predefined procedure.
    18th, device according to claim 16, wherein,
    The protocol header fields coding unit, for when protocol header content data type be character string type when, according to UTF-8 forms by protocol header Content Transformation be binary data;When protocol header content data type be integer when, according to Varint modes by protocol header Content Transformation be binary data;
    The message body fields coding unit, for when the data type of message body is character string type, message body to be converted into binary data according to UTF-8 forms;When the data type of message body is integer, message body is converted into binary data according to Varint modes.
    19th, a kind of decoding apparatus of sip message, including:
    Marker bit decoding unit, for determining marker bit from the binary data stream of SIP message to be decoded according to predefined procedure, the binary data stream is obtained by the binary data in marker bit, protocol header fields and message body fields;
    Know unit, the label information for knowing the SIP message from the marker bit according to the first corresponding relation, the label information includes type of message;
    Field acquiring unit, for obtaining protocol header fields and message body fields from the binary data stream;
    Protocol header fields decoding unit, for to each protocol header fields, protocol header guidance information and protocol header content are extracted from protocol header fields according to the second corresponding relation, and the protocol header guidance information and protocol header content are carried out decoding the protocol header for obtaining sip message;Message body fields decoding unit, for to message body fields, message body guidance information and message body are extracted from message body fields according to the 3rd corresponding relation, and the message body guidance information and message body are carried out decoding the sip message body for obtaining sip message;
    Decoded result obtaining unit, for according to the type of message, decoded sip message to be obtained by the protocol header of the sip message and the sip message body of sip message,
    Wherein, first corresponding relation indicates bit and the label information corresponding numerical value of the label information in marker bit;Second corresponding relation indicates bit and the protocol header guidance information corresponding numerical value of the protocol header guidance information in protocol header fields, and indicates bit of the protocol header content in protocol header fields;3rd corresponding relation indicates bit and the message body guidance information corresponding numerical value of the message body guidance information in message body fields, and indicates bit of the message body in message body fields.
    20th, device according to claim 19, wherein, described to know unit, type of message and compression configured information for knowing sip message from the marker bit according to the first corresponding relation;
    The field acquiring unit, for when the compression configured information indicates that the SIP message is uncompressed, protocol header fields and message body fields to be obtained from the binary data stream of SIP message to be decoded according to the predefined procedure;When the compression configured information indicates that the SIP message is compressed, the data length of compressed data is obtained, compressed data is extracted from binary data stream according to the data length;The compressed data is decompressed using the decompression algorithm of selection, protocol header fields and message body fields are obtained.
    21, device according to claim 19, wherein, the protocol header fields decoding unit, for the protocol header guidance information and protocol header content being pointed in same protocol header fields, when protocol header guidance information indicates that protocol header fields are encrypted, read the protocol header content after the encryption of array formats in protocol header fields, the protocol header content after encryption is decrypted using the decipherment algorithm of selection, then the protocol header content after protocol header guidance information and decryption is carried out according to the second corresponding relation decoding the protocol header for obtaining the corresponding sip message of the protocol header fields.
    22, device according to claim 19, wherein, the message body fields decoding unit, for message body guidance information and the message body being pointed in same message body fields, when message body guidance information indicates that message body fields are encrypted, read the message body after the encryption of array formats in message body fields, the message body after encryption is decrypted using the decipherment algorithm of selection, then the message body after message body guidance information and decryption is carried out according to the 3rd corresponding relation decoding the protocol header for obtaining the corresponding sip message of the protocol header fields.
CN201380081228.1A 2013-12-31 2013-12-31 Method and apparatus for coding and decoding SIP message Pending CN105765917A (en)

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2013/091080 WO2015100605A1 (en) 2013-12-31 2013-12-31 Method and apparatus for coding and decoding sip message

Publications (1)

Publication Number Publication Date
CN105765917A true CN105765917A (en) 2016-07-13

Family

ID=53492957

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201380081228.1A Pending CN105765917A (en) 2013-12-31 2013-12-31 Method and apparatus for coding and decoding SIP message

Country Status (2)

Country Link
CN (1) CN105765917A (en)
WO (1) WO2015100605A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111130616A (en) * 2018-11-01 2020-05-08 中兴通讯股份有限公司 Session control method and satellite ground station

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101227432A (en) * 2008-02-04 2008-07-23 ***通信集团公司 Method for message conversion, system, apparatus and method of access
US7889760B2 (en) * 2004-04-30 2011-02-15 Microsoft Corporation Systems and methods for sending binary, file contents, and other information, across SIP info and text communication channels
JP4976109B2 (en) * 2006-11-09 2012-07-18 三菱電機株式会社 SIP message compression / decompression module generation device, communication device, and SIP message compression / decompression method

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1976348A (en) * 2006-12-28 2007-06-06 傅海波 Method for carrying 'formatted information' in SIP protocol 'display name' field

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7889760B2 (en) * 2004-04-30 2011-02-15 Microsoft Corporation Systems and methods for sending binary, file contents, and other information, across SIP info and text communication channels
JP4976109B2 (en) * 2006-11-09 2012-07-18 三菱電機株式会社 SIP message compression / decompression module generation device, communication device, and SIP message compression / decompression method
CN101227432A (en) * 2008-02-04 2008-07-23 ***通信集团公司 Method for message conversion, system, apparatus and method of access

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111130616A (en) * 2018-11-01 2020-05-08 中兴通讯股份有限公司 Session control method and satellite ground station

Also Published As

Publication number Publication date
WO2015100605A1 (en) 2015-07-09

Similar Documents

Publication Publication Date Title
AU755792B2 (en) Methods and apparatus for transmitting, receiving, and processing secure voice over internet protocol
CN101379802B (en) Method and device for the encoded transmission of media data between the media server and the subscriber terminal
US6865681B2 (en) VoIP terminal security module, SIP stack with security manager, system and security methods
CN101635823B (en) Method and system of terminal for encrypting videoconference data
Sjoberg et al. RTP payload format and file storage format for the Adaptive Multi-Rate (AMR) and Adaptive Multi-Rate Wideband (AMR-WB) audio codecs
CN104980395B (en) The method and system and Media Gateway of the first system and second system media intercommunication
CN102204303B (en) For utilizing the system and method for IMS data safety mechanism in a circuit switched network
US7324443B2 (en) Binary protocol for session initiation in a wireless communications system
US7383435B2 (en) Method for encoding and decoding communication data
CN101141251B (en) Method, system and equipment of message encryption signature in communication system
CN114630290A (en) Key agreement method, device, equipment and storage medium for voice encryption communication
CN102594794B (en) Access method and device of media encryption conference
CN106713308B (en) Method and device for transmitting media stream in real time
CN105376236A (en) Information transfer method of mobile equipment
CN105765917A (en) Method and apparatus for coding and decoding SIP message
CN109996025B (en) Quantum communication-based adaptive audio and video communication method, device and system
CN113163400A (en) Voice communication method, terminal and TF card
JP2005295468A (en) Communication device and communication system
CN114978485B (en) Voice data transmission method, system, electronic equipment and storage medium
CN102624741A (en) TLV (Threshold Limit Value) based data transmission method and system thereof
CN105430430A (en) Smart terminal network communication method
CN101247221A (en) Signal watermarking in the presence of encryption
CN112953963B (en) System and method for encrypting media stream content
CN101494644A (en) Transmission method for session initiation protocol message
JP6729901B1 (en) Telephone conference system, telephone terminal, and program

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20160713

RJ01 Rejection of invention patent application after publication