h1. Message billing {{>toc}} Message billing has much in common with [[Billing|Telephony billing]]. However there are several differences. h2. Billing unit Unlike [[Telephony]], not a call duration is billed, but a quantity of *billing units*. *Billing unit* is a text block of size 140 bytes. In case if message size is greater than 140 bytes, each 140-byte block is billed separately. Depending on codec, a 140-byte block may contain different count of symbols. Below is the data for the most widely used codecs. |*codec*|*size of 1 symbol*|*max. count of symbols in 140-byte block*| |GSM|7-14 bit (regular symbols occupy 7 bit, special symbols like £ occupy 14 bit (7 bit for symbol + 7 bit for escape symbol)|80-160| |UTF-16 (UCS2)|2 bytes|70| |UTF-8|1-2 bytes|70-140| |Binary data|1 byte|140| h2. Price-list format Unlike [[Telephony]], where price-lists contain prices for E.164 destination codes, for messaging in inter-operator price-lists prices for *billing unit* are specified per *E.212 code*, also known as [[MCC-MNC codes]]. [[MCC-MNC codes]] are used for messaging, because more than 50% of mobile subscribers in the world use [[Number portability]] service, and E.164 phone number no longer identifies operator, to which subscriber is connected. As far as price of termination to E.164 number depends on to which operator subscriber number is connected, historically has established, that inter-operator billing is based on [[MCC-MNC codes]]. Billing system supports [[Transformation of E.164 number to MCC-MNC code]] to perform correct billing of messages. h2. Billing event. Unlike [[Telephony]], where billing event is phone pickup, in messaging billing event is acceptance of message to handling by peer. For [[SMPP protocol|SMPP]] - this is acceptance from peer a Response message with code ROK (0). For [[SIP SIMPLE protocol|SIP SIMPLE]] - this is acceptance from partner a 200 OK message. After accepting message from Smartswitch, partner has choice - either to decline message, or to accept for forwarding. In case if peer accepts message for forwarding and sending corresponding response, the cost of message is written off *Smartswitch*'s balance. The same way *Smartswitch* behaves: in case if some provider accepts message for forwarding, *Smartswitch* tells, that message is taken into handling to his customer and writes off it from customer's balance. Real message delivery to end user could occur during following 3 days (depends on subscriber's availablility). [[Биллинг сообщений|Русский перевод]]