Building full image that's supposed to contain asterisk-chan-quectel #2

Merged
PeterSurda merged 6 commits from lee.miller/openwrt:quectel into main 2023-01-17 23:27:23 +01:00
Collaborator

Hi!

You've got a toolchain for aarch64_cortex-a72_gcc-11.2.0_musl and a factory world in the container.

This builds a custom image with config changes in the config.extra (from your make image PACKAGES plus asterisk-chan-quectel), those .gz should appear in the out together with packages.

Hi! You've got a toolchain for `aarch64_cortex-a72_gcc-11.2.0_musl` and a factory world in the container. This builds a custom image with config changes in the `config.extra` (from your `make image` `PACKAGES` plus `asterisk-chan-quectel`), those .gz should appear in the out together with packages.
Author
Collaborator

Final build lasted for 57:40 min.

[Final build](https://buildbot.bitmessage.org/#/builders/33/builds/15351) lasted for 57:40 min.
lee.miller force-pushed quectel from a12dd441ae to 7711e71476 2023-01-12 03:58:03 +01:00 Compare
lee.miller force-pushed quectel from cb4bb41e58 to 1da3e27066 2023-01-12 23:57:58 +01:00 Compare
Author
Collaborator

Well, apparently the SDK builds a package alongside with a large dependencies subtree. Not so fast, but there is no need for three hours of building a toolchain (maybe you need to do docker image prune on one of your servers );

The builder makes an image, which is going to out together with packages dir (maybe I need to copy telephony and quectel with dirs?), now you can check.

Well, apparently the SDK [builds a package](https://buildbot.bitmessage.org/#/builders/33/builds/15398) alongside with a large dependencies subtree. Not so fast, but there is no need for three hours of building a toolchain (maybe you need to do `docker image prune` on one of your servers ); The builder makes an image, which is going to `out` together with packages dir (maybe I need to copy `telephony` and `quectel` with dirs?), now you can check.
PeterSurda reviewed 2023-01-13 02:06:15 +01:00
@ -14,0 +20,4 @@
cat ${pwd}/feeds.conf >> feeds.conf
./scripts/feeds update -a
./scripts/feeds install -a
Owner

I think lines 23 and 25 should be skipped, no? That would just recompile unnecessarily. The documentation doesn't mention these steps, only feeds update and then feeds install packagename.

I think lines 23 and 25 should be skipped, no? That would just recompile unnecessarily. The [documentation](https://openwrt.org/docs/guide-developer/obtain.firmware.sdk#obtain_definitions) doesn't mention these steps, only `feeds update` and then `feeds install packagename`.
Owner

See also from the documentation:

The output of make might contain WARNING: your configuration is out of sync. Please run make menuconfig, oldconfig or defconfig!. That warning is misleading and wrong in the SDK case. Since everything is precompiled you cannot run oldconfig (see Why is the SDK configuration out of sync?).

See also from the documentation: > The output of `make` might contain `WARNING: your configuration is out of sync. Please run make menuconfig, oldconfig or defconfig!`. That warning is misleading and wrong in the SDK case. Since everything is precompiled you cannot run oldconfig (see Why is the SDK configuration out of sync?).
Author
Collaborator

It seems trying to run make menuconfig if I remove make defconfig, see at line 2043.

It seems trying to run `make menuconfig` if I remove `make defconfig`, [see](https://buildbot.bitmessage.org/#/builders/33/builds/15409/steps/3/logs/stdio) at line 2043.
Author
Collaborator

It's not working also without feeds install, see line 1979.

It's [not working](https://buildbot.bitmessage.org/#/builders/33/builds/15410/steps/3/logs/stdio) also without feeds install, see line 1979.
Owner

I'll check the build logs.

I'll check the build logs.
Owner

Ok I don't know how to fix it either, at least it doesn't look like it's compiling everything, only some dependencies, so it's fine. I tried a full build previously and it takes several hours: https://buildbot.bitmessage.org/#/builders/33/builds/14862

I will rarely build this so it's not a big deal if I have to wait an hour.

Ok I don't know how to fix it either, at least it doesn't look like it's compiling everything, only some dependencies, so it's fine. I tried a full build previously and it takes several hours: https://buildbot.bitmessage.org/#/builders/33/builds/14862 I will rarely build this so it's not a big deal if I have to wait an hour.
PeterSurda requested changes 2023-01-13 02:10:45 +01:00
PeterSurda left a comment
Owner

While I think a part of the process can be skipped, it's exactly what I wanted, thanks. I haven't tested it yet but will shortly.

While I think a part of the process can be skipped, it's exactly what I wanted, thanks. I haven't tested it yet but will shortly.
Owner

Test looks good. device state shows among other things

Voice: Yes
SMS: Yes

I was also able to successfully send a SMS from asterisk. I'm having trouble setting up voice and receiving SMS but I think that's due to configuration issues (I'm new to asterisk so I don't know what I'm doing)

Test looks good. `device state` shows among other things ``` Voice: Yes SMS: Yes ``` I was also able to successfully send a SMS from asterisk. I'm having trouble setting up voice and receiving SMS but I think that's due to configuration issues (I'm new to asterisk so I don't know what I'm doing)
Owner

Notes:

  • missing packages to bundle in the image:

    • kmod-usb-audio
    • asterisk-app-sms
    • alsa-lib
  • user asterisk needs to be added to groups audio and dialout

Notes: - missing packages to bundle in the image: - `kmod-usb-audio` - `asterisk-app-sms` - `alsa-lib` - user `asterisk` needs to be added to groups `audio` and `dialout`
lee.miller added 1 commit 2023-01-13 22:03:13 +01:00
lee.miller force-pushed quectel from bd2e3823c7 to ed3791fe1c 2023-01-13 22:15:52 +01:00 Compare
Author
Collaborator

Test looks good. device state shows among other things
...
I was also able to successfully send a SMS from asterisk. I'm having trouble setting up voice and receiving SMS but I think that's due to configuration issues (I'm new to asterisk so I don't know what I'm doing)

Receiving an SMS is even easier, you don't need asterisk for that, gammu-smsd is enough. When I worked at office, I had a simple script for qNAP with a Huawei modem reacting to an SMS (;

#!/usr/bin/env python

import os
import random

import gammu
import gammu.smsd


class SMSDie(object):
    """Main handler class"""
    def __init__(self, passfile):
        with open(passfile, 'rb') as passwords:
            self.passwords = [
                word.strip() for word in passwords
                if not word.startswith('#')]

    def _noop(self):
        pass

    def _offline(self):
        """Go offline"""
        os.system('/etc/init.d/network.sh stop')

    def _feedback(self, number, cmd):
        """Send feedback"""
        # hardcoded config path is bad
        config = '/etc/smsdie/gammu-smsdrc'
        SMS = {
            'Text': 'running command %s' % cmd,
            'Number': number
        }
        try:
            if gammu.Version()[0] <= '1.30':
                sm = gammu.StateMachine()
                sm.ReadConfig(0, 0, '/etc/smsdie/gammu-smsdrc')
                sm.Init()
                SMS.update(SMSC=sm.GetSMSC())
                sm.SendSMS(SMS)
                return

            daemon = gammu.smsd.SMSD(config)
            SMS.update(SMSC={'Location': 1})
            daemon.InjectSMS([SMS])
        except gammu.GSMError as e:
            logwrite('exc %r in feedback' % e)
        except Exception as e:
            logwrite('exc %r in feedback' % e)

    def handle(self, msg, number):
        """Handle SMS message received from number"""
        passwd, cmd = msg.split(' ', 1)
        if passwd not in self.passwords:
            return

        try:
            fun = getattr(self, '_' + cmd)
        except AttributeError:
            return

        self._feedback(number, cmd)

        fun()


if __name__ == "__main__":
    import time
    logwrite('%s INVOKED' % time.time())
    # hardcoded passwords file path is bad
    handler = SMSDie('/etc/smsdie/passwords.txt')
    for i in range(1, int(os.environ['SMS_MESSAGES']) + 1):
        handler.handle(
            os.environ['SMS_%s_TEXT' % i], os.environ['SMS_%s_NUMBER' % i])

Here is a gammu config:

[gammu]
device = /dev/ttyUSB0
connection = at

[smsd]
# service = NULL
# logfile = stderr
# debuglevel = 4
service = files
PIN = 0000
RunOnReceive = /usr/bin/smsdie.py
inboxpath = /tmp/smsd/
outboxpath = /tmp/smsd/
sentsmspath = /tmp/smsd/
errorsmspath = /tmp/smsd/

The gammu is started as /usr/bin/gammu-smsd -c /etc/smsdie/gammu-smsdrc -d --pid=$PIDFILE > $QDK_DIR/smsdie.log.

> Test looks good. `device state` shows among other things ... > I was also able to successfully send a SMS from asterisk. I'm having trouble setting up voice and receiving SMS but I think that's due to configuration issues (I'm new to asterisk so I don't know what I'm doing) Receiving an SMS is even easier, you don't need asterisk for that, gammu-smsd is enough. When I worked at office, I had a simple script for qNAP with a Huawei modem reacting to an SMS (; ```python #!/usr/bin/env python import os import random import gammu import gammu.smsd class SMSDie(object): """Main handler class""" def __init__(self, passfile): with open(passfile, 'rb') as passwords: self.passwords = [ word.strip() for word in passwords if not word.startswith('#')] def _noop(self): pass def _offline(self): """Go offline""" os.system('/etc/init.d/network.sh stop') def _feedback(self, number, cmd): """Send feedback""" # hardcoded config path is bad config = '/etc/smsdie/gammu-smsdrc' SMS = { 'Text': 'running command %s' % cmd, 'Number': number } try: if gammu.Version()[0] <= '1.30': sm = gammu.StateMachine() sm.ReadConfig(0, 0, '/etc/smsdie/gammu-smsdrc') sm.Init() SMS.update(SMSC=sm.GetSMSC()) sm.SendSMS(SMS) return daemon = gammu.smsd.SMSD(config) SMS.update(SMSC={'Location': 1}) daemon.InjectSMS([SMS]) except gammu.GSMError as e: logwrite('exc %r in feedback' % e) except Exception as e: logwrite('exc %r in feedback' % e) def handle(self, msg, number): """Handle SMS message received from number""" passwd, cmd = msg.split(' ', 1) if passwd not in self.passwords: return try: fun = getattr(self, '_' + cmd) except AttributeError: return self._feedback(number, cmd) fun() if __name__ == "__main__": import time logwrite('%s INVOKED' % time.time()) # hardcoded passwords file path is bad handler = SMSDie('/etc/smsdie/passwords.txt') for i in range(1, int(os.environ['SMS_MESSAGES']) + 1): handler.handle( os.environ['SMS_%s_TEXT' % i], os.environ['SMS_%s_NUMBER' % i]) ``` Here is a gammu config: ``` [gammu] device = /dev/ttyUSB0 connection = at [smsd] # service = NULL # logfile = stderr # debuglevel = 4 service = files PIN = 0000 RunOnReceive = /usr/bin/smsdie.py inboxpath = /tmp/smsd/ outboxpath = /tmp/smsd/ sentsmspath = /tmp/smsd/ errorsmspath = /tmp/smsd/ ``` The `gammu` is started as `/usr/bin/gammu-smsd -c /etc/smsdie/gammu-smsdrc -d --pid=$PIDFILE > $QDK_DIR/smsdie.log`.
Owner

Receiving an SMS is even easier, you don't need asterisk for that, gammu-smsd is enough. When I worked at office, I had a simple script for qNAP with a Huawei modem reacting to an SMS (;

Yea I used smsd in the past to receive messages with some USB modem, I just wanted to test asterisk. It did show in the logs that there is an incoming SMS but it couldn't be processed due to missing configuration. It just logged an error and deleted the SMS from the SIM. So I think the code is fine, just missing config. The audio device showed up once I installed the alsa-usb module so I think voice calls will also work.

I tried asterisk with two cards, Quectel EC20 and EC25-EUX, it works with both, I don't need to test with more models, the EC20 is the default one they ship with the device so I'll stick with that.

Also one more thing, I use the uac/quectel.conf file instead of the etc/quectel.conf, Quectel wrote on some forum that the UAC audio mode should be preferred.

> Receiving an SMS is even easier, you don't need asterisk for that, gammu-smsd is enough. When I worked at office, I had a simple script for qNAP with a Huawei modem reacting to an SMS (; Yea I used `smsd` in the past to receive messages with some USB modem, I just wanted to test asterisk. It did show in the logs that there is an incoming SMS but it couldn't be processed due to missing configuration. It just logged an error and deleted the SMS from the SIM. So I think the code is fine, just missing config. The audio device showed up once I installed the alsa-usb module so I think voice calls will also work. I tried asterisk with two cards, Quectel EC20 and EC25-EUX, it works with both, I don't need to test with more models, the EC20 is the default one they ship with the device so I'll stick with that. Also one more thing, I use the `uac/quectel.conf` file instead of the `etc/quectel.conf`, Quectel wrote on some forum that the UAC audio mode should be preferred.
PeterSurda merged commit ed3791fe1c into main 2023-01-17 23:27:23 +01:00
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: Sysdeploy/openwrt#2
No description provided.