Giter Club home page Giter Club logo

Comments (8)

pmarti avatar pmarti commented on July 20, 2024

Thanks for the report will have a look
On Dec 16, 2011 6:50 PM, "Vitaly Greck" <
[email protected]>
wrote:

According to SMIL, src attribute value should contain attachment name not
the text itself. Please fix. :)


Reply to this email directly or view it on GitHub:
#21

from python-messaging.

vintozver avatar vintozver commented on July 20, 2024

Real message sniffed by tshark on Samsung Galaxy S II (text message)

Hypertext Transfer Protocol
    POST http://mmsc HTTP/1.1\r\n
        [Expert Info (Chat/Sequence): POST http://mmsc HTTP/1.1\r\n]
            [Message: POST http://mmsc HTTP/1.1\r\n]
            [Severity level: Chat]
            [Group: Sequence]
        Request Method: POST
        Request URI: http://mmsc
        Request Version: HTTP/1.1
    Accept: */*, application/vnd.wap.mms-message, application/vnd.wap.sic\r\n
    x-wap-profile: http://wap.samsungmobile.com/uaprof/GT-I9100.xml\r\n
    Accept-Language: ru-RU, en-US\r\n
    Content-Length: 449\r\n
        [Content length: 449]
    Content-Type: application/vnd.wap.mms-message\r\n
    Host: mmsc\r\n
    Connection: Keep-Alive\r\n
    User-Agent: SAMSUNG-GT-I9100-Mms/2.0\r\n
    \r\n
MMS Message Encapsulation, Type: m-send-req
    X-Mms-Message-Type: m-send-req (0x80)
    X-Mms-Transaction-ID: T134439908ce
    X-Mms-MMS-Version: 1.2
    From: <insert address>
    To: +375296637480/TYPE=PLMN
    Subject: \177\320\242\320\265\320\272\321\201\321\202
    X-Mms-Delivery-Report: Yes (0x80)
    X-Mms-Read-Report: Yes (0x80)
    Content-Type: application/vnd.wap.multipart.related; start=<smil>; type=application/smil
        Start: <smil>
        Type: application/smil
    Data (Post)
        Multipart body
            Part: 1, content-type: application/smil
                Content-Type: application/smil; name=smil.xml
                    Name: smil.xml
                Headers
                    Content-Id: "<smil>"
                    Content-Location: smil.xml
                Synchronized Multimedia Integration Language
                    <smil>
                        <head>
                            <layout>
                                <root-layout/>
                                    width="320px"
                                    height="480px"
                                <region/>
                                    id="Text"
                                    left="0"
                                    top="320"
                                    width="320px"
                                    height="160px"
                                    fit="meet"
                                </layout>
                            </head>
                        <body>
                            <par>
                                dur="5000ms"
                                <text/>
                                    src="cid:text_0.txt"
                                    region="Text"
                                </par>
                            </body>
                        </smil>
            Part: 2, content-type: text/plain
                Content-Type: text/plain; name=cid:text_0.txt; charset=utf-8
                    Name: cid:text_0.txt
                    Charset: utf-8
                Headers
                    Content-Id: "<text_0.txt>"
                    Content-Location: text_0.txt
                Line-based text data: text/plain
                    \320\242\320\265\320\272\321\201\321\202

Also, it's good idea to change mms/message.py

   areas = (('Image', '0', '0', '176', '144'),
             ('Text', '176', '144', '176', '76'))

for methods with allow to change the smil layout, as some MMSCs do not accept layouts with empty content.

Also, if I use

@staticmethod
def encode_content_general_form(media_type, parameters):

to pass parameters (I modified the lib to conform W3C SMIL 2.0 spec), I get

Traceback (most recent call last):
  File "test_mms.py", line 20, in <module>
    payload = mms.encode().tostring()
  File "/usr/local/lib/python2.7/dist-packages/python_messaging-0.5.10-py2.7.egg/messaging/mms/message.py", line 224, in encode
    return encoder.encode(self)
  File "/usr/local/lib/python2.7/dist-packages/python_messaging-0.5.10-py2.7.egg/messaging/mms/mms_pdu.py", line 607, in encode
    msg_data.extend(self.encode_message_body())
  File "/usr/local/lib/python2.7/dist-packages/python_messaging-0.5.10-py2.7.egg/messaging/mms/mms_pdu.py", line 798, in encode_message_body
    message_body.extend(part_content_type)

Mofidications:

==mms/message.py
            if page.text is not None:
                part, begin, end = page.text
*               src = part.headers['Content-Type'][1]['name']
                text_node = smil_doc.createElement('text')
                text_node.setAttribute('src', src)
                text_node.setAttribute('region', 'Text')

    def set_text(self, text, content_type='text/plain', ct_parameters=None):
        """
        Convenience wrapper method for set_data()

        This method sets the :class:`DataPart` object to hold the
        specified text string, with MIME content type "text/plain".

        @param text: The text to hold
        @type text: str
        """


        self.set_data(text, content_type, ct_parameters)
        time_data = DataPart()
        time_data.set_text(text, 'text/plain', {'charset': 'utf-8', 'name': 'cid:text_0.txt'})
        self.text = (time_data, time_begin, time_end)
#!/usr/bin/env python

from messaging.mms.message import MMSMessage, MMSMessagePage

mms = MMSMessage()
mms.headers['To'] = '+375296637480/TYPE=PLMN'
mms.headers['Message-Type'] = 'm-send-req'
mms.headers['Subject'] = 'Test python-messaging.mms'

slide1 = MMSMessagePage()
slide1.add_text('This is the first slide, with a static image and some text.')

slide2 = MMSMessagePage()
slide2.set_duration(4500)
slide2.add_text('This second slide has some timing effects.', 500, 3500)

mms.add_page(slide1)
mms.add_page(slide2)

payload = mms.encode().tostring()

print payload

vint@vgreck:~$ python test_mms.py
enconded_content_general_form: [3, [131], [99, 104, 97, 114, 115, 101, 116, 0, 117, 116, 102, 45, 56, 0], [110, 97, 109, 101, 0, 99, 105, 100, 58, 116, 101, 120, 116, 95, 48, 46, 116, 120, 116, 0]]

from python-messaging.

pmarti avatar pmarti commented on July 20, 2024

Vitaly, if you have a fix for the problem, why don't you create a fork, do your thing there and send a pull request back? If it comes with tests and pep8 compliant we'll gladly accept it :)

from python-messaging.

vintozver avatar vintozver commented on July 20, 2024

Pablo, thanks for comments ;)
Already forked, working ...

from python-messaging.

andrewbird avatar andrewbird commented on July 20, 2024

Hi Vitaly,
Did you ever get the changes finished, it would be good to get them back upstream?

Thanks,

Andrew

from python-messaging.

andrewbird avatar andrewbird commented on July 20, 2024

Ping?

from python-messaging.

TeddJohnson avatar TeddJohnson commented on July 20, 2024

@vintozver how were you able to capture the SMS using tshark?

When I try with tcpdump on my android phone, I don't see any packets related to MMS or SMS. I've checked both the rmnet0 and wlan0 interfaces

from python-messaging.

vintozver avatar vintozver commented on July 20, 2024

rmnet1
MMS APN may be different depending on the carrier settings

from python-messaging.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.