UBports Robot Logo UBports Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login
    1. Home
    2. kjhg84j9
    K
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 3
    • Posts 13
    • Groups 0

    kjhg84j9

    @kjhg84j9

    8
    Reputation
    10
    Profile views
    13
    Posts
    0
    Followers
    0
    Following
    Joined
    Last Online

    kjhg84j9 Unfollow Follow

    Best posts made by kjhg84j9

    • RE: How to send MMS over DUBS to ofono?

      Alright, so, I got it.

      I'm going put some notes here to help others should they need it. telepathy-ofono is a middle man for the ubuntu message app. I'm not using that here, my goal is to build something for the PinePhone no matter what OS they choose. With that, I'm talking directly to ofono.

      Here is the dbus call you need to replicate. This is a group MMS message sent with text.

      method call time=1580999265.497178 sender=:1.19 -> destination=org.ofono.mms serial=407 path=/org/ofono/mms/302220546062670; interface=org.ofono.mms.Service; member=SendMessage
         array [
            string "613xxxyyyy"
            string "613xxxzzzz"
         ]
         array [
            struct {
               string "text_0.txt"
               string "text/plain"
               string "/home/phablet/.local/share/telepathy-ofono/attachments/attachmentLh3156"
            }
            struct {
               string "smil.xml"
               string "application/smil"
               string "/home/phablet/.local/share/telepathy-ofono/attachments/attachmentnS3156"
            }
         ]
      

      the path (/home/phablet/.local/share/telepathy-ofono/attachments/) does not matter. The directory above is from telepathy-ofono so you can put it anywhere.

      The plaintext file (attachmentLh3156) is just that, the text of the message you want to send.

      MMS message testing
      

      The smil.xml (attachmentnS3156) will change depending on the amount of attachments (not recipents). If you're just sending text, like above your smil file will look like

      <smil>   <head>     <layout>         <region id="Text" width="100%" height="100%" fit="scroll" />     </layout>   </head>   <body>       <par dur="3s">       <text src="text_0.txt" region="Text" />     </par>   </body> </smil>
      

      As an example, if you want to send a picture in this group chat you'd have to change the smil file to:

      <smil>   <head>     <layout>         <region id="Image" width="100%" height="100%" fit="meet" />     </layout>   </head>   <body>       <par dur="5000ms">       <img src="pic.jpg" region="Image" />     </par>   </body> </smil>
      

      and of course you'd need to attach a picture. Pictures are limited in their size for me, I can only send pictures under 300KB. This is just the jpg file you're sending you dont have to do anything fancy.

      The code I used is VERY lazily modified from the python script I posted in my question. There are errors and some of the code isn't use. my only goal was to test it, not make it look pretty 🙂 I'm going to spend my weekend translating this to C and cleaning it up.

       phablet@ubuntu-phablet:~$ cat ./sendmms.py
      #!/home/phablet/.cache/libertine-container/learning/rootfs/usr/bin/python
      import sys
      import dbus
      import csv
      if (len(sys.argv) < 4):
              print "Usage: %s"\
                      " <recipient>,..."\
                      " <smil-file-path>"\
                      " <<content-id>,<content-type>,<file-path>>,..."\
                      % (sys.argv[0])
              print "Sample(Related): %s"\
                      " \"+33611111111,+33622222222\""\
                      " \"smil.txt\""\
                      " \"cid-1,text/plain,text.txt\""\
                      " \"cid-2,image/jpeg,image.jpg\""\
                      % (sys.argv[0])
              print "Sample(Mixed): %s"\
                      " \"+33611111111,+33622222222\""\
                      " \"\""\
                      " \"cid-1,text/plain,text.txt\""\
                      " \"cid-2,image/jpeg,image.jpg\""\
                      % (sys.argv[0])
              sys.exit(1)
      bus = dbus.SessionBus()
      manager = dbus.Interface(bus.get_object('org.ofono.mms', '/org/ofono/mms'),
                                              'org.ofono.mms.Manager')
      
      print bus
      print manager
      
      #services = manager.GetServices()
      services = "org.ofono.mms.Service"
      #path = services[0][0]
      path = "/org/ofono/mms/302220546062670"
      service = dbus.Interface(bus.get_object('org.ofono.mms', path),
                                                      'org.ofono.mms.Service')
      recipients = dbus.Array([],signature=dbus.Signature('s'))
      reader = csv.reader([sys.argv[1]])
      for r in reader:
              print "Recipient list: %s" % r
              for i in r:
                      recipients.append(dbus.String(i))
      if sys.argv[2] == "":
              print "Send MMS as Mixed"
              smil = ""
      else:
              print "Send MMS as Related"
              print "Smil path: %s" % (sys.argv[2])
              file = open(sys.argv[2],"r")
              smil = dbus.String(file.read())
      attachments = dbus.Array([],signature=dbus.Signature('(sss)'))
      for a in sys.argv[3:]:
              print "Attachment: (%s)" % a
              reader = csv.reader([a])
              for r in reader:
                      attachments.append(dbus.Struct((dbus.String(r[0]),
                                                      dbus.String(r[1]),
                                                      dbus.String(r[2])
                                                      ), signature=None))
      
      print "hello"
      path = service.SendMessage(recipients, attachments)
      print "hello2"
      print path
      phablet@ubuntu-phablet:~$ 
      

      and finally the command I used to send it:

      phablet@ubuntu-phablet:~$ ./sendmms.py "613xxxyyyy,613xxxzzz" "" "smil.xml,application/smil,/pic.smil" "pic.jpg,image/jpeg,/pic.jpg" 
      <dbus._dbus.SessionBus (session) at 0xb66ba090>
      <Interface <ProxyObject wrapping <dbus._dbus.SessionBus (session) at 0xb66ba090> :1.4 /org/ofono/mms at 0xb66b4410> implementing 'org.ofono.mms.Manager' at 0xb66bc6b0>
      Recipient list: ['613xxxyyyy', '613xxxzzz']
      Send MMS as Mixed
      Attachment: (smil.xml,application/smil,/pic.smil)
      Attachment: (pic.jpg,image/jpeg,/pic.jpg)
      hello
      ERROR:dbus.proxies:Introspect error on :1.4:/org/ofono/mms/302220546062670: dbus.exceptions.DBusException: org.freedesktop.DBus.Error.NoReply: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.
      hello2
      /org/ofono/mms/302220546062670/3c49e41edd7b06b4d51eaf3b28d1fd3b
      phablet@ubuntu-phablet:~$ 
      

      EDIT:

      here is the smil for a picture and some text in an MMS. the filenames inside the smil dont matter.

      <smil>   <head>     <layout>         <region id="Image" width="100%" height="100%" fit="meet" /><region id="Text" width="100%" height="100%" fit="scroll" />     </layout>   </head>   <body>       <par dur="5000ms">       <img src="5129919622724107199.jpg" region="Image" />     </par><par dur="3s">       <text src="text_0.txt" region="Text" />     </par>   </body> </smil>
      

      Edit2: very rough C code from someone whos just learning.... Back to building my app! thanks everyone!

      #include <stdio.h>
      #include <stdlib.h>
      #include <gio/gio.h>
      #include <string.h>
      
      static gchar *object_name       = "org.ofono.mms";
      static gchar *object_path       = "/org/ofono/mms/302220546062670";
      static gchar *object_interface  = "org.ofono.mms.Service";
      
      
      int main(  ) {
      
      
        GOptionContext *opt_context;
        opt_context = g_option_context_new ("Web-Messages-send_mms");
      
        GError *error;
        GDBusProxy *proxy;
      
        proxy = NULL;
        error = NULL;
      
      
        proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION,
                                               G_DBUS_PROXY_FLAGS_NONE,
                                               NULL, /* GDBusInterfaceInfo */
                                               object_name,
                                               object_path,
                                               object_interface,
                                               NULL, /* GCancellable */
                                               &error);
      
      
      
      
        GVariant *variant;
        GVariantBuilder *builder;
        builder = g_variant_builder_new(G_VARIANT_TYPE("as"));
        g_variant_builder_add(builder, "s", "613xxxyyyy");
        g_variant_builder_add(builder, "s", "613xxxzzzz");
        variant = g_variant_new("as", builder);
        g_variant_builder_unref(builder);
      
      
      
        GVariant *value1;
        GVariant *value2;
      
        value1 = g_variant_new ("(sss)", "smil.xml", "application/smil", "/text.smil");
        value2 = g_variant_new ("(sss)", "text_0.txt", "text/plain", "/text_0.txt");
      
      
        GVariant *variant2;
        GVariantBuilder *builder2;
        builder2 = g_variant_builder_new(G_VARIANT_TYPE("a*"));
        g_variant_builder_add(builder2, "*", value1);
        g_variant_builder_add(builder2, "*", value2);
        variant2 = g_variant_new("a*", builder2);
        g_variant_builder_unref(builder2);
      
        GVariant *package;
      
        package = g_variant_new ("(**)", variant, variant2);
      
      
        gchar *parameters_str;
        parameters_str = g_variant_print (package, TRUE);
        g_print ("parameters_str: \"%s\" \n", parameters_str);
        g_free (parameters_str);
      
      
      
      
      if (proxy == NULL) {
          g_printerr ("Error creating proxy: %s\n", error->message);
          g_error_free (error);
        }
        else {
          g_dbus_proxy_call_sync (proxy,
                                  "SendMessage",
                                  package,
                                  G_DBUS_CALL_FLAGS_NONE,
                                  -1,
                                  NULL,
                                  &error);
        }
      
      
      
      
      
      
          if (proxy != NULL)
            g_object_unref (proxy);
          g_option_context_free (opt_context);
      
      
      
      
      
      
      
      
      
      
      
      
          return 0;
      }
      
      

      Edit again:

      For people here from google, I decided to go with Python. My script to bridge to matrix is here. There is a send SMS and a send MMS function that should be helpful.

      posted in App Development
      K
      kjhg84j9
    • I wrote a Python3 script to Bridge SMS/MMS to matrix/riot.im

      First, Please know that I'm not a developer so the code you're about to look at is.. well... probably very ugly.

      This script I wrote will bridge SMS and MMS messages with matrix.org synapse server. Everything works in both directions and I've been using it for about a week now. Think of it as texting from the web with Google Messages just without the google 🙂 I still have to catch some more errors and clean up some stuff but overall I think its ready to share.

      Also, its not an "app", its just a Python cli script I keep running in a screen session. My goal here is to have a 'server cell phone' that I leave at home, plugged in, and bridging messages 24/7. I'll never touch it other than to do some updates and fix any problems. I'll use a matrix app such as riot on my desktop and any other device I want. I'll be able to send and receive messages from any where any deivce as long as it has internet.

      How I got it to work is a little hacky. I'm not sure if there's a better way to do it but I'll note it here. Eventually I'll be moving this over to my PinePhone.

      I created a libertine-container,
      Connect to the container as root
      apt install python3/pip3 and then pip install some packages.
      apt install screen
      https://docs.ubports.com/en/latest/userguide/dailyuse/libertine.html#shell-access

      Then I got out of the container and added all of this stuff to my path. Python3 in a container called "learning" is

      /home/phablet/.cache/libertine-container/learning/rootfs/usr/bin/python3

      and screen would be something like
      /home/phablet/.cache/libertine-container/learning/rootfs/usr/bin/screen

      So you just run the app as the normal phablet user but using the containers python3 binary. if you want to leave it running like I do you use the screen binary from the same container.

      If anyone wants to turn this into a real app or really do anything with it, I'm happy to help! I also have some poorly written C code to do the same thing. I got SMS/MMS sending/receiving working and I got SMSes bridged to matrix but when I started to look into dealing with html and json I decided that I'd just use python.

      posted in General
      K
      kjhg84j9
    • RE: How to send MMS over DUBS to ofono?

      I have not seen that github repo before. I'll need to have a better look at it but it looks like it has an function to send MMS messages. Thanks!

      I have seen that other link. however, I read it when I was just getting started with my project and forgot all about it. Looking at my code now I'm listening on org.ofono.mms.Service for MMSes. I remember seeing telepathy interfaces but I ignored them. I'll have to take another look and see, I might have done this the hard way.

      I'm thinking the python script above is trying to send a message on the wrong interface now. I'm also reading about smil files and trying to understand what they do. I just ignored them when I was receiving the MMS because I didn't need the data.

      I plan to have everything up on gitlab when I'm done and it will be heavily documented mostly because I'm learning and I have no idea what I'm doing. Commenting code helps me learn and remember what I'm doing.

      Cheers!

      posted in App Development
      K
      kjhg84j9
    • RE: How to send MMS over DUBS to ofono?

      Receiving MMSes are only consistent on the interface I'm using so I guess I have the right one.

      sending seems to follow the spec. Later this weekend I'll write something to toss the same data at the interface and see what happens.

      method call time=1580999265.470354 sender=:1.152 -> destination=com.canonical.TelephonyServiceHandler serial=903 path=/com/canonical/TelephonyServiceHandler; interface=com.canonical.TelephonyServiceHandler; member=SendMessage
         string "ofono/ofono/account0"
         string "This is an outbound mms message."
         array [
         ]
         array [
            dict entry(
               string "chatType"
               variant             int32 2
            )
            dict entry(
               string "participantIds"
               variant             array [
                     string "613xxxyyyy"
                     string "613xxxzzzz"
                  ]
            )
            dict entry(
               string "threadId"
               variant             string "mms:a389e2a7ac4ef7055304eab4f57c27f9"
            )
         ]
      
      
      
      
      method call time=1581001468.154282 sender=:1.152 -> destination=com.canonical.TelephonyServiceHandler serial=980 path=/com/canonical/TelephonyServiceHandler; interface=com.canonical.TelephonyServiceHandler; member=SendMessage                                               
         string "ofono/ofono/account0"                                    
         string "Small out mms"                                                                                                               
         array [                                                          
         ]                                                                
         array [                                                                                                                              
            dict entry(                                                                                                                                                                                                                                                               
               string "chatType"                                                                                                              
               variant             int32 2                                
            )                                                                                                                                                                                                                                                                         
            dict entry(                                                                                                                       
               string "participantIds"                                                                                                        
               variant             array [                                                                                                                                                                                                                                            
                     string "613xxxyyyy"                                                                                                      
                     string "613xxxzzzz"                                  
                  ]                                                       
            )                                                             
            dict entry(                                                   
               string "threadId"                                          
               variant             string "mms:a389e2a7ac4ef7055304eab4f57c27f9"                                                              
            )                                                                                                                                                                                                                                                                         
         ]
      
      
      posted in App Development
      K
      kjhg84j9
    • RE: How to send MMS over DUBS to ofono?

      @Giiba said in How to send MMS over DUBS to ofono?:

      How does your app handle this?

      I'm completely separate from the ubuntu messages app and all my stuff is cli only right now. messages I send dont even show up in the messages app.

      You can run dbus-monitor on the phone and watch everything sent over the dbus. my app watches this for messages from org.ofono.mms and then unpacks them.

      I have a long road ahead of me before I understand enough to help out with any of this.Also, I want to get the first version of my app up and out of the way before I start doing other things.

      posted in App Development
      K
      kjhg84j9

    Latest posts made by kjhg84j9

    • I wrote a Python3 script to Bridge SMS/MMS to matrix/riot.im

      First, Please know that I'm not a developer so the code you're about to look at is.. well... probably very ugly.

      This script I wrote will bridge SMS and MMS messages with matrix.org synapse server. Everything works in both directions and I've been using it for about a week now. Think of it as texting from the web with Google Messages just without the google 🙂 I still have to catch some more errors and clean up some stuff but overall I think its ready to share.

      Also, its not an "app", its just a Python cli script I keep running in a screen session. My goal here is to have a 'server cell phone' that I leave at home, plugged in, and bridging messages 24/7. I'll never touch it other than to do some updates and fix any problems. I'll use a matrix app such as riot on my desktop and any other device I want. I'll be able to send and receive messages from any where any deivce as long as it has internet.

      How I got it to work is a little hacky. I'm not sure if there's a better way to do it but I'll note it here. Eventually I'll be moving this over to my PinePhone.

      I created a libertine-container,
      Connect to the container as root
      apt install python3/pip3 and then pip install some packages.
      apt install screen
      https://docs.ubports.com/en/latest/userguide/dailyuse/libertine.html#shell-access

      Then I got out of the container and added all of this stuff to my path. Python3 in a container called "learning" is

      /home/phablet/.cache/libertine-container/learning/rootfs/usr/bin/python3

      and screen would be something like
      /home/phablet/.cache/libertine-container/learning/rootfs/usr/bin/screen

      So you just run the app as the normal phablet user but using the containers python3 binary. if you want to leave it running like I do you use the screen binary from the same container.

      If anyone wants to turn this into a real app or really do anything with it, I'm happy to help! I also have some poorly written C code to do the same thing. I got SMS/MMS sending/receiving working and I got SMSes bridged to matrix but when I started to look into dealing with html and json I decided that I'd just use python.

      posted in General
      K
      kjhg84j9
    • RE: How to send MMS over DUBS to ofono?

      @Giiba said in How to send MMS over DUBS to ofono?:

      How does your app handle this?

      I'm completely separate from the ubuntu messages app and all my stuff is cli only right now. messages I send dont even show up in the messages app.

      You can run dbus-monitor on the phone and watch everything sent over the dbus. my app watches this for messages from org.ofono.mms and then unpacks them.

      I have a long road ahead of me before I understand enough to help out with any of this.Also, I want to get the first version of my app up and out of the way before I start doing other things.

      posted in App Development
      K
      kjhg84j9
    • RE: How to send MMS over DUBS to ofono?

      @Giiba I must be going mad but I'm sure there was something in the dbus log under phablets home dir. Tail the dbus log and you can watch every MMS arrive and if its a new group it says something like no room found. I found this building my app so I just made a room with the same numbers and I started getting mmses.

      I'm not at home so I can't support any of this.

      as a side note, my app receives every MMS I toss at it so I dont think there are any big problems with ofono.

      Edit: on mobile

      posted in App Development
      K
      kjhg84j9
    • RE: How to send MMS over DUBS to ofono?

      Alright, so, I got it.

      I'm going put some notes here to help others should they need it. telepathy-ofono is a middle man for the ubuntu message app. I'm not using that here, my goal is to build something for the PinePhone no matter what OS they choose. With that, I'm talking directly to ofono.

      Here is the dbus call you need to replicate. This is a group MMS message sent with text.

      method call time=1580999265.497178 sender=:1.19 -> destination=org.ofono.mms serial=407 path=/org/ofono/mms/302220546062670; interface=org.ofono.mms.Service; member=SendMessage
         array [
            string "613xxxyyyy"
            string "613xxxzzzz"
         ]
         array [
            struct {
               string "text_0.txt"
               string "text/plain"
               string "/home/phablet/.local/share/telepathy-ofono/attachments/attachmentLh3156"
            }
            struct {
               string "smil.xml"
               string "application/smil"
               string "/home/phablet/.local/share/telepathy-ofono/attachments/attachmentnS3156"
            }
         ]
      

      the path (/home/phablet/.local/share/telepathy-ofono/attachments/) does not matter. The directory above is from telepathy-ofono so you can put it anywhere.

      The plaintext file (attachmentLh3156) is just that, the text of the message you want to send.

      MMS message testing
      

      The smil.xml (attachmentnS3156) will change depending on the amount of attachments (not recipents). If you're just sending text, like above your smil file will look like

      <smil>   <head>     <layout>         <region id="Text" width="100%" height="100%" fit="scroll" />     </layout>   </head>   <body>       <par dur="3s">       <text src="text_0.txt" region="Text" />     </par>   </body> </smil>
      

      As an example, if you want to send a picture in this group chat you'd have to change the smil file to:

      <smil>   <head>     <layout>         <region id="Image" width="100%" height="100%" fit="meet" />     </layout>   </head>   <body>       <par dur="5000ms">       <img src="pic.jpg" region="Image" />     </par>   </body> </smil>
      

      and of course you'd need to attach a picture. Pictures are limited in their size for me, I can only send pictures under 300KB. This is just the jpg file you're sending you dont have to do anything fancy.

      The code I used is VERY lazily modified from the python script I posted in my question. There are errors and some of the code isn't use. my only goal was to test it, not make it look pretty 🙂 I'm going to spend my weekend translating this to C and cleaning it up.

       phablet@ubuntu-phablet:~$ cat ./sendmms.py
      #!/home/phablet/.cache/libertine-container/learning/rootfs/usr/bin/python
      import sys
      import dbus
      import csv
      if (len(sys.argv) < 4):
              print "Usage: %s"\
                      " <recipient>,..."\
                      " <smil-file-path>"\
                      " <<content-id>,<content-type>,<file-path>>,..."\
                      % (sys.argv[0])
              print "Sample(Related): %s"\
                      " \"+33611111111,+33622222222\""\
                      " \"smil.txt\""\
                      " \"cid-1,text/plain,text.txt\""\
                      " \"cid-2,image/jpeg,image.jpg\""\
                      % (sys.argv[0])
              print "Sample(Mixed): %s"\
                      " \"+33611111111,+33622222222\""\
                      " \"\""\
                      " \"cid-1,text/plain,text.txt\""\
                      " \"cid-2,image/jpeg,image.jpg\""\
                      % (sys.argv[0])
              sys.exit(1)
      bus = dbus.SessionBus()
      manager = dbus.Interface(bus.get_object('org.ofono.mms', '/org/ofono/mms'),
                                              'org.ofono.mms.Manager')
      
      print bus
      print manager
      
      #services = manager.GetServices()
      services = "org.ofono.mms.Service"
      #path = services[0][0]
      path = "/org/ofono/mms/302220546062670"
      service = dbus.Interface(bus.get_object('org.ofono.mms', path),
                                                      'org.ofono.mms.Service')
      recipients = dbus.Array([],signature=dbus.Signature('s'))
      reader = csv.reader([sys.argv[1]])
      for r in reader:
              print "Recipient list: %s" % r
              for i in r:
                      recipients.append(dbus.String(i))
      if sys.argv[2] == "":
              print "Send MMS as Mixed"
              smil = ""
      else:
              print "Send MMS as Related"
              print "Smil path: %s" % (sys.argv[2])
              file = open(sys.argv[2],"r")
              smil = dbus.String(file.read())
      attachments = dbus.Array([],signature=dbus.Signature('(sss)'))
      for a in sys.argv[3:]:
              print "Attachment: (%s)" % a
              reader = csv.reader([a])
              for r in reader:
                      attachments.append(dbus.Struct((dbus.String(r[0]),
                                                      dbus.String(r[1]),
                                                      dbus.String(r[2])
                                                      ), signature=None))
      
      print "hello"
      path = service.SendMessage(recipients, attachments)
      print "hello2"
      print path
      phablet@ubuntu-phablet:~$ 
      

      and finally the command I used to send it:

      phablet@ubuntu-phablet:~$ ./sendmms.py "613xxxyyyy,613xxxzzz" "" "smil.xml,application/smil,/pic.smil" "pic.jpg,image/jpeg,/pic.jpg" 
      <dbus._dbus.SessionBus (session) at 0xb66ba090>
      <Interface <ProxyObject wrapping <dbus._dbus.SessionBus (session) at 0xb66ba090> :1.4 /org/ofono/mms at 0xb66b4410> implementing 'org.ofono.mms.Manager' at 0xb66bc6b0>
      Recipient list: ['613xxxyyyy', '613xxxzzz']
      Send MMS as Mixed
      Attachment: (smil.xml,application/smil,/pic.smil)
      Attachment: (pic.jpg,image/jpeg,/pic.jpg)
      hello
      ERROR:dbus.proxies:Introspect error on :1.4:/org/ofono/mms/302220546062670: dbus.exceptions.DBusException: org.freedesktop.DBus.Error.NoReply: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.
      hello2
      /org/ofono/mms/302220546062670/3c49e41edd7b06b4d51eaf3b28d1fd3b
      phablet@ubuntu-phablet:~$ 
      

      EDIT:

      here is the smil for a picture and some text in an MMS. the filenames inside the smil dont matter.

      <smil>   <head>     <layout>         <region id="Image" width="100%" height="100%" fit="meet" /><region id="Text" width="100%" height="100%" fit="scroll" />     </layout>   </head>   <body>       <par dur="5000ms">       <img src="5129919622724107199.jpg" region="Image" />     </par><par dur="3s">       <text src="text_0.txt" region="Text" />     </par>   </body> </smil>
      

      Edit2: very rough C code from someone whos just learning.... Back to building my app! thanks everyone!

      #include <stdio.h>
      #include <stdlib.h>
      #include <gio/gio.h>
      #include <string.h>
      
      static gchar *object_name       = "org.ofono.mms";
      static gchar *object_path       = "/org/ofono/mms/302220546062670";
      static gchar *object_interface  = "org.ofono.mms.Service";
      
      
      int main(  ) {
      
      
        GOptionContext *opt_context;
        opt_context = g_option_context_new ("Web-Messages-send_mms");
      
        GError *error;
        GDBusProxy *proxy;
      
        proxy = NULL;
        error = NULL;
      
      
        proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION,
                                               G_DBUS_PROXY_FLAGS_NONE,
                                               NULL, /* GDBusInterfaceInfo */
                                               object_name,
                                               object_path,
                                               object_interface,
                                               NULL, /* GCancellable */
                                               &error);
      
      
      
      
        GVariant *variant;
        GVariantBuilder *builder;
        builder = g_variant_builder_new(G_VARIANT_TYPE("as"));
        g_variant_builder_add(builder, "s", "613xxxyyyy");
        g_variant_builder_add(builder, "s", "613xxxzzzz");
        variant = g_variant_new("as", builder);
        g_variant_builder_unref(builder);
      
      
      
        GVariant *value1;
        GVariant *value2;
      
        value1 = g_variant_new ("(sss)", "smil.xml", "application/smil", "/text.smil");
        value2 = g_variant_new ("(sss)", "text_0.txt", "text/plain", "/text_0.txt");
      
      
        GVariant *variant2;
        GVariantBuilder *builder2;
        builder2 = g_variant_builder_new(G_VARIANT_TYPE("a*"));
        g_variant_builder_add(builder2, "*", value1);
        g_variant_builder_add(builder2, "*", value2);
        variant2 = g_variant_new("a*", builder2);
        g_variant_builder_unref(builder2);
      
        GVariant *package;
      
        package = g_variant_new ("(**)", variant, variant2);
      
      
        gchar *parameters_str;
        parameters_str = g_variant_print (package, TRUE);
        g_print ("parameters_str: \"%s\" \n", parameters_str);
        g_free (parameters_str);
      
      
      
      
      if (proxy == NULL) {
          g_printerr ("Error creating proxy: %s\n", error->message);
          g_error_free (error);
        }
        else {
          g_dbus_proxy_call_sync (proxy,
                                  "SendMessage",
                                  package,
                                  G_DBUS_CALL_FLAGS_NONE,
                                  -1,
                                  NULL,
                                  &error);
        }
      
      
      
      
      
      
          if (proxy != NULL)
            g_object_unref (proxy);
          g_option_context_free (opt_context);
      
      
      
      
      
      
      
      
      
      
      
      
          return 0;
      }
      
      

      Edit again:

      For people here from google, I decided to go with Python. My script to bridge to matrix is here. There is a send SMS and a send MMS function that should be helpful.

      posted in App Development
      K
      kjhg84j9
    • RE: How to send MMS over DUBS to ofono?

      @lduboeuf I will definitely take a look after my app is done.

      I haven't looked into it yet but there's also a bug with the messages app. if you receive a group MMS and you don't already have the room created it will fail silently. There's info in the logs but basically the Messages app cant find the room and fails, it doesn't try to create it. everything else seems fine it just doesn't build the room. if you do this yourself you'll receive future messages to that group chat but you need to know who to add without any sort of notification.

      I'm just getting into coding and the open source community so everything is all very new to me. I'm not sure of the process to look for bugs and open one if none exist but I'll get there 🙂

      Thank you again!

      posted in App Development
      K
      kjhg84j9
    • RE: How to send MMS over DUBS to ofono?

      Receiving MMSes are only consistent on the interface I'm using so I guess I have the right one.

      sending seems to follow the spec. Later this weekend I'll write something to toss the same data at the interface and see what happens.

      method call time=1580999265.470354 sender=:1.152 -> destination=com.canonical.TelephonyServiceHandler serial=903 path=/com/canonical/TelephonyServiceHandler; interface=com.canonical.TelephonyServiceHandler; member=SendMessage
         string "ofono/ofono/account0"
         string "This is an outbound mms message."
         array [
         ]
         array [
            dict entry(
               string "chatType"
               variant             int32 2
            )
            dict entry(
               string "participantIds"
               variant             array [
                     string "613xxxyyyy"
                     string "613xxxzzzz"
                  ]
            )
            dict entry(
               string "threadId"
               variant             string "mms:a389e2a7ac4ef7055304eab4f57c27f9"
            )
         ]
      
      
      
      
      method call time=1581001468.154282 sender=:1.152 -> destination=com.canonical.TelephonyServiceHandler serial=980 path=/com/canonical/TelephonyServiceHandler; interface=com.canonical.TelephonyServiceHandler; member=SendMessage                                               
         string "ofono/ofono/account0"                                    
         string "Small out mms"                                                                                                               
         array [                                                          
         ]                                                                
         array [                                                                                                                              
            dict entry(                                                                                                                                                                                                                                                               
               string "chatType"                                                                                                              
               variant             int32 2                                
            )                                                                                                                                                                                                                                                                         
            dict entry(                                                                                                                       
               string "participantIds"                                                                                                        
               variant             array [                                                                                                                                                                                                                                            
                     string "613xxxyyyy"                                                                                                      
                     string "613xxxzzzz"                                  
                  ]                                                       
            )                                                             
            dict entry(                                                   
               string "threadId"                                          
               variant             string "mms:a389e2a7ac4ef7055304eab4f57c27f9"                                                              
            )                                                                                                                                                                                                                                                                         
         ]
      
      
      posted in App Development
      K
      kjhg84j9
    • RE: How to send MMS over DUBS to ofono?

      I have not seen that github repo before. I'll need to have a better look at it but it looks like it has an function to send MMS messages. Thanks!

      I have seen that other link. however, I read it when I was just getting started with my project and forgot all about it. Looking at my code now I'm listening on org.ofono.mms.Service for MMSes. I remember seeing telepathy interfaces but I ignored them. I'll have to take another look and see, I might have done this the hard way.

      I'm thinking the python script above is trying to send a message on the wrong interface now. I'm also reading about smil files and trying to understand what they do. I just ignored them when I was receiving the MMS because I didn't need the data.

      I plan to have everything up on gitlab when I'm done and it will be heavily documented mostly because I'm learning and I have no idea what I'm doing. Commenting code helps me learn and remember what I'm doing.

      Cheers!

      posted in App Development
      K
      kjhg84j9
    • How to send MMS over DUBS to ofono?

      Hey guys,

      I'm just looking for an example on how to send MMS messages via DBUS to ofono. I've found one example online but I'm unable to get it working. There are lots of test details in the ofono git but they dont really help me in figuring out how to send MMS messages, just eveything else.. Is anyone able to provide an example in python or another language or help me get this one working?

      I was able to receive MMS by monitoring the dbus with GVariant and just working backwards from the data it sends. I could do the same thing for sending.... Monitor everything, slowly work down the name, interface, etc, and try and duplicate what the messaging app is sending but there has to be a better way, right?

      I'm doing all my testing on a nexus 5.

      Cheers!

      posted in App Development
      K
      kjhg84j9
    • RE: Compile C++ on phone

      @dobey - Thank you!!! this was enough to get me on the right path. I have complied my highlow c++ game on my PineBook and it runs without any issue on the phone.

      You guys are very helpful! It would have taken me ages to figure this out on my own. thank you all!

      Next I'm Just going to finish my book, look into libdbus and libcurl. Then I'll start reading up on how to build Ubuntu Touch apps. I'll have everything up on gitlab eventually. cheers!

      posted in General
      K
      kjhg84j9
    • RE: Compile C++ on phone

      @dobey - I thought you meant I could do it on the phone or libertine container. Either way, it works! Thank you!

      @Flohack - Thank you for your concern. I don't plan to compile everything on the phone, I just wanted to make sure it works and what to expect. I believe it's possible to compile it on my desktop for my phone then move the binary over. I haven't looked into this yet, still working my way though the C++ book.

      My goal is to build something like Google Messages (text from a web page) for my PinePhone that's on its way here. I strongly dislike picking up my cellphone when I'm already on my computer.

      Cheers!

      posted in General
      K
      kjhg84j9