Module Skype :: Class Sms |

# Class Sms

source code

         object --+
                  |
    skypekit.Cached --+
                      |
        skypekit.Object --+
                          |
                         Sms

Wrapper class that includes SMS-specific properties and methods, such as P_BODY and GetTargetPrice. Instantiate SMS instances using Skype::CreateOutgoingSms; post SMS messages to a Conversation using Conversation::PostSMS.

Each SMS can have multiple targets (normalized phone numbers). Note that in a Conversation context, every SMS instance has a corresponding Message instance. Once you've posted an SMS, you can retrieve its corresponding Message instance using Sms::GetPropChatmsgId. That Message instance's P_BODY_XML property contains the SMS message data, such as price, target phone number(s), failure codes, and so forth, which you can parsed out and display in the UI. To put it another way, the object chain goes like this:

:

     Conversation->Message->SMS

Note that SkypeKit SDK supports outgoing SMS messages only. SkypeKit clients, even when logged in with accounts that have SkypeIn numbers, cannot receive SMS messages.

Instance Methods
_sk_init_(self, object_id, transport) actual constructor | source code
__str__(self) str(x) | source code
OnPropertyChange(self, property_name) notifies from a property change | source code
GetTargetStatus(self, target) Retrieves the send status of this SMS to a particular recipient (P_TARGET_STATUSES) either prior to or after invoking Conversation::PostSMS. | source code
GetTargetPrice(self, target) Retrieves the amount of Skype credit necessary to send the SMS to a particular recipient. | source code
SetTargets(self, numbers) Sets the recipient(s) of this SMS. | source code
SetBody(self, text) -The- method for setting the body text of this SMS. | source code
GetBodyChunks(self) Retrieves string list of SMS text chunks in first argument, while the second argument contains the number of available characters until creation of the next chunk becomes necessary. | source code
Inherited from `skypekit.Object`: `multiget` Inherited from `skypekit.Cached`: `__copy__` Inherited from `object`: `__delattr__`, `__format__`, `__getattribute__`, `__hash__`, `__init__`, `__reduce__`, `__reduce_ex__`, `__repr__`, `__setattr__`, `__sizeof__`, `__subclasshook__`

Static Methods
propid(propname) convert a property name to the enum of the property | source code
Inherited from `skypekit.Cached`: `__new__`, `sk_exists`

Class Variables
| event_handlers = ``{``}``
| propid2label = ``{`48`:` `'``is_failed_unseen``'``,` 49`:` `'``price_precision``'``,``...``
| module_id = `12`
| TYPE = ``{`2`:` `'``OUTGOING``'``,` 3`:` `'``CONFIRMATION_CODE_REQUEST``'``,` 4`:` `'``CON``...`` OUTGOING - a normal outgoing SMS message
| STATUS = ``{`3`:` `'``COMPOSING``'``,` 4`:` `'``SENDING_TO_SERVER``'``,` 5`:` `'``SENT_TO_``...`` COMPOSING
| FAILUREREASON = ``{`1`:` `'``MISC_ERROR``'``,` 2`:` `'``SERVER_CONNECT_FAILED``'``,` `...`` MISC_ERROR
| TARGETSTATUS = ``{`1`:` `'``TARGET_ANALYZING``'``,` 2`:` `'``TARGET_UNDEFINED``'``,` `...`` TARGET_ANALYZING
| SETBODYRESULT = ``{`0`:` `'``BODY_INVALID``'``,` 1`:` `'``BODY_TRUNCATED``'``,` 2`:` `'``B``...`` BODY_INVALID - body not set.
| CONFIRM_TYPE = ``{`1`:` `'``ID_SMS``'``,` 2`:` `'``ID_MOBILE``'``,` 3`:` `'``ID_SKYPEIN``'``,` `...`` ID_SMS - Confirm mobile number as SMS sender number
| P_TYPE = `190`
| P_STATUS = `191`
| P_FAILUREREASON = `192`
| P_IS_FAILED_UNSEEN = `48`
| P_TIMESTAMP = `198`
| P_PRICE = `193`
| P_PRICE_PRECISION = `49`
| P_PRICE_CURRENCY = `194`
| P_REPLY_TO_NUMBER = `199`
| P_TARGET_NUMBERS = `195`
| P_TARGET_STATUSES = `196`
| P_BODY = `197`
| P_CHATMSG_ID = `840`
Inherited from `skypekit.Object`: `rwlock`

Instance Variables
Inherited from `skypekit.Object`: `properties`

Properties
| type
| status
| failurereason Set asynchronously and meaningful only after invoking Conversation::PostSMS and detecting Sms::STATUS of SOME_TARGETS_FAILED or FAILED.
| is_failed_unseen set to 1 when status goes to FAILED.
| timestamp unix timestamp of message submission
| price The total price of sending this SMS message (sum of the individual prices to send to each recipient).
| price_precision The decimal precision of the SMS price values, both individual and total.
| price_currency should be same as account currency at the time of composing/sending
| reply_to_number number that should receive the replies
| target_numbers space-separated normalised pstn numbers
| target_statuses binary blob.
| body actual payload
| chatmsg_id reference to Message
Inherited from `object`: `__class__`

Method Details

### _sk_init_(self, object_id, transport) | source code
actual constructor Overrides: skypekit.Object._sk_init_

### __str__(self) (Informal representation operator) | source code
str(x) Overrides: object.__str__ (inherited documentation)

### GetTargetStatus(self, target) | source code
Retrieves the send status of this SMS to a particular recipient (P_TARGET_STATUSES) either prior to or after invoking Conversation::PostSMS. Arguments: target - The normalized phone number of the target recipient. Return values: status - The send status of the target recipient, for example, TARGET_ANALYZING, TARGET_DELIVERY_PENDING, TARGET_DELIVERY_SUCCESSFUL, TARGET_DELIVERY_FAILED, and so forth. TARGET_UNDEFINED implies that the specified target is not a recipient of this SMS.

### GetTargetPrice(self, target) | source code
Retrieves the amount of Skype credit necessary to send the SMS to a particular recipient. Defaults to -1 on instantiation and set only when that recipient's status reflects TARGET_ACCEPTABLE. Use Sms::GetPropPrice to retrieve the total cost of this SMS. Note that the target price is an integer value. Calculate the actual price (in units specified by P_PRICE_CURRENCY) using P_PRICE_PRECISION as: :
     actualTargetPrice = targetPrice / 10^pricePrecision;
Arguments: target - The normalized phone number of the target recipient. Return values: price - The price of sending this SMS message to the target recipient.

### SetTargets(self, numbers) | source code
Sets the recipient(s) of this SMS. Note that each invocation replaces the target list and re-calculates all prices - they are not additive! Arguments: numbers - Normalized phone number(s) of the intended recipient(s). Return values: success - Set to true if the target list appears to contain valid, normalized telephone numbers. Note that this check is not very reliable. Actual target validity checking occurs asynchronously in the background, and manifests itself as a series of Sms::P_TARGET_STATUSES property change events.

### SetBody(self, text) | source code
-The- method for setting the body text of this SMS. While Conversation::PostSMS does have a body argument, that argument is currently unused. Arguments: text - Message body text. Return values: result - Whether the Message body was successfully set and if not, why not. chunks - The Message body as a list of individual chunks. chars_until_next_chunk - Number of available characters until creation of the next chunk becomes necessary.

### GetBodyChunks(self) | source code
Retrieves string list of SMS text chunks in first argument, while the second argument contains the number of available characters until creation of the next chunk becomes necessary. Return values: text_chunks - List of text chunk strings chars_until_next_chunk - Number of available characters until creation of the next chunk becomes necessary.

Class Variable Details

  ### propid2label Value:
      {48: 'is_failed_unseen',
       49: 'price_precision',
       190: 'type',
       191: 'status',
       192: 'failurereason',
       193: 'price',
       194: 'price_currency',
       195: 'target_numbers',
      ...

  ### TYPE OUTGOING - a normal outgoing SMS message CONFIRMATION_CODE_REQUEST - a message requesting a SMS confirmation code be sent to the number provided CONFIRMATION_CODE_SUBMIT - a message returning the SMS confirmation code received as a result of a CONFIRMATION_CODE_REQUEST to authorize it Value:
      {2: 'OUTGOING',
       3: 'CONFIRMATION_CODE_REQUEST',
       4: 'CONFIRMATION_CODE_SUBMIT',
       'CONFIRMATION_CODE_REQUEST': 3,
       'CONFIRMATION_CODE_SUBMIT': 4,
       'OUTGOING': 2}

  ### STATUS COMPOSING SENDING_TO_SERVER SENT_TO_SERVER DELIVERED SOME_TARGETS_FAILED FAILED Value:
      {3: 'COMPOSING',
       4: 'SENDING_TO_SERVER',
       5: 'SENT_TO_SERVER',
       6: 'DELIVERED',
       7: 'SOME_TARGETS_FAILED',
       8: 'FAILED',
       'COMPOSING': 3,
       'DELIVERED': 6,
      ...

  ### FAILUREREASON MISC_ERROR SERVER_CONNECT_FAILED NO_SMS_CAPABILITY INSUFFICIENT_FUNDS INVALID_CONFIRMATION_CODE USER_BLOCKED IP_BLOCKED NODE_BLOCKED NO_SENDERID_CAPABILITY Value:
      {1: 'MISC_ERROR',
       2: 'SERVER_CONNECT_FAILED',
       3: 'NO_SMS_CAPABILITY',
       4: 'INSUFFICIENT_FUNDS',
       5: 'INVALID_CONFIRMATION_CODE',
       6: 'USER_BLOCKED',
       7: 'IP_BLOCKED',
       8: 'NODE_BLOCKED',
      ...

  ### TARGETSTATUS TARGET_ANALYZING TARGET_UNDEFINED TARGET_ACCEPTABLE TARGET_NOT_ROUTABLE TARGET_DELIVERY_PENDING TARGET_DELIVERY_SUCCESSFUL TARGET_DELIVERY_FAILED Value:
      {1: 'TARGET_ANALYZING',
       2: 'TARGET_UNDEFINED',
       3: 'TARGET_ACCEPTABLE',
       4: 'TARGET_NOT_ROUTABLE',
       5: 'TARGET_DELIVERY_PENDING',
       6: 'TARGET_DELIVERY_SUCCESSFUL',
       7: 'TARGET_DELIVERY_FAILED',
       'TARGET_ACCEPTABLE': 3,
      ...

  ### SETBODYRESULT BODY_INVALID - body not set. message status wrong or invalid, or body not valid utf8 string BODY_TRUNCATED - body too long. set, but truncated. charsUntilNextChunk contains maxChunks value BODY_OK - body was set OK BODY_LASTCHAR_IGNORED - last unicode char was ignored, as some of the text would be deleted due to conversion Value:
      {0: 'BODY_INVALID',
       1: 'BODY_TRUNCATED',
       2: 'BODY_OK',
       3: 'BODY_LASTCHAR_IGNORED',
       'BODY_INVALID': 0,
       'BODY_LASTCHAR_IGNORED': 3,
       'BODY_OK': 2,
       'BODY_TRUNCATED': 1}

  ### CONFIRM_TYPE ID_SMS - Confirm mobile number as SMS sender number ID_MOBILE - Confirm mobile number as CLI for SkypeOut calls ID_SKYPEIN - unused currently Value:
      {1: 'ID_SMS',
       2: 'ID_MOBILE',
       3: 'ID_SKYPEIN',
       'ID_MOBILE': 2,
       'ID_SKYPEIN': 3,
       'ID_SMS': 1}

Property Details

### type Get Method: _sk_get_type(self)

### status Get Method: _sk_get_status(self)

### failurereason Set asynchronously and meaningful only after invoking Conversation::PostSMS and detecting Sms::STATUS of SOME_TARGETS_FAILED or FAILED. Get Method: _sk_get_failurereason(self) - Set asynchronously and meaningful only after invoking Conversation::PostSMS and detecting Sms::STATUS of SOME_TARGETS_FAILED or FAILED.

### is_failed_unseen set to 1 when status goes to FAILED. use MarkSeen() to clear Get Method: _sk_get_is_failed_unseen(self) - set to 1 when status goes to FAILED.

### timestamp unix timestamp of message submission Get Method: _sk_get_timestamp(self) - unix timestamp of message submission

### price The total price of sending this SMS message (sum of the individual prices to send to each recipient). Defaults to -1 on instantiation and incremented by the price for each recipient once that recipient's status reflects TARGET_ACCEPTABLE. Use Sms::GetTargetPrice to retrieve individual target prices. A value of MAX_UINT indicates that SkypeKit is actively querying and/or updating the value. Note that P_PRICE is an integer value. Calculate the actual price (in units specified by P_PRICE_CURRENCY) using P_PRICE_PRECISION as: :
     actualPrice = price / 10^pricePrecision;
Get Method: _sk_get_price(self) - The total price of sending this SMS message (sum of the individual prices to send to each recipient).

### price_precision The decimal precision of the SMS price values, both individual and total. For example, a value of 2 indicates that you should divide the price (represented as an integer) by 100 (10^2) to obtain the actual price. Get Method: _sk_get_price_precision(self) - The decimal precision of the SMS price values, both individual and total.

### price_currency should be same as account currency at the time of composing/sending Get Method: _sk_get_price_currency(self) - should be same as account currency at the time of composing/sending

### reply_to_number number that should receive the replies Get Method: _sk_get_reply_to_number(self) - number that should receive the replies

### target_numbers space-separated normalised pstn numbers Get Method: _sk_get_target_numbers(self) - space-separated normalised pstn numbers

### target_statuses binary blob. track with OnPropertyChange(), access with GetTargetStatus(target) Get Method: _sk_get_target_statuses(self) - binary blob.

### body actual payload Get Method: _sk_get_body(self) - actual payload

### chatmsg_id reference to Message Get Method: _sk_get_chatmsg_id(self) - reference to Message