wdoekes / asterisk-chan-dongle

chan_dongle channel driver for Huawei UMTS cards, works with Asterisk 14+
Other
299 stars 105 forks source link

Can Quectel be added? #144

Closed micmac1 closed 3 years ago

micmac1 commented 3 years ago

Hi Walter,

We received a pull request to add a new package "asterisk-chan-quectel". It's a fork of your repo: Link

I compared the two and the difference is only three lines. Can you somehow integrate this into your repo? I'm not a programmer, also not a chan-dongle user, so highlighting the differences is probably the most I can do myself.

Thanks for taking a look!

Kind regards, Seb

wdoekes commented 3 years ago

Hi Seb,

I've created a branch wdoekes/asterisk-chan-dongle@add-quectel-support in which that feature might work.

I'm not a programmer, also not a chan-dongle user, so highlighting the differences is probably the most I can do myself.

:heavy_check_mark: programmer :no_entry_sign: chan-dongle-user

The highlights were definitely useful :+1:

I cannot tell you if this patch works though, nor can I tell you if it breaks support for non-quectel users.

Let me know if this is good to merge.

micmac1 commented 3 years ago

Hi Walter,

Thank you very much!

I know two users I can ask to run-test this. But the compile currently fails like this:

mips-openwrt-linux-musl-gcc -Os -pipe -mno-branch-likely -mips32r2 -mtune=24kc -fno-caller-saves -fno-plt -fhonour-copts -Wno-error=unused-but-set-variable -Wno-error=unused-result -msoft-float -mips16 -minterlink-mips16 -ffile-prefix-map=/home/sk/tmp/sdk/openwrt-sdk-21.02.0-ath79-generic_gcc-8.4.0_musl.Linux-x86_64/build_dir/target-mips_24kc_musl/asterisk-chan-dongle-2021-09-19-6073c91f=asterisk-chan-dongle-2021-09-19-6073c91f -Wformat -Werror=format-security -fstack-protector -D_FORTIFY_SOURCE=1 -Wl,-z,now -Wl,-z,relro -I/home/sk/tmp/sdk/openwrt-sdk-21.02.0-ath79-generic_gcc-8.4.0_musl.Linux-x86_64/staging_dir/target-mips_24kc_musl/usr/lib/libiconv-stub/include -I/home/sk/tmp/sdk/openwrt-sdk-21.02.0-ath79-generic_gcc-8.4.0_musl.Linux-x86_64/staging_dir/target-mips_24kc_musl/usr/lib/libintl-stub/include  -Wno-old-style-declaration -I. -std=gnu99 -DAST_MODULE_SELF_SYM=__internal_chan_dongle_self -I/home/sk/tmp/sdk/openwrt-sdk-21.02.0-ath79-generic_gcc-8.4.0_musl.Linux-x86_64/staging_dir/toolchain-mips_24kc_gcc-8.4.0_musl/usr/include -I/home/sk/tmp/sdk/openwrt-sdk-21.02.0-ath79-generic_gcc-8.4.0_musl.Linux-x86_64/staging_dir/toolchain-mips_24kc_gcc-8.4.0_musl/include/fortify -I/home/sk/tmp/sdk/openwrt-sdk-21.02.0-ath79-generic_gcc-8.4.0_musl.Linux-x86_64/staging_dir/toolchain-mips_24kc_gcc-8.4.0_musl/include -I/home/sk/tmp/sdk/openwrt-sdk-21.02.0-ath79-generic_gcc-8.4.0_musl.Linux-x86_64/staging_dir/target-mips_24kc_musl/usr/lib/libiconv-stub/include -I/home/sk/tmp/sdk/openwrt-sdk-21.02.0-ath79-generic_gcc-8.4.0_musl.Linux-x86_64/staging_dir/target-mips_24kc_musl/usr/lib/libintl-stub/include  -D_GNU_SOURCE -I/home/sk/tmp/sdk/openwrt-sdk-21.02.0-ath79-generic_gcc-8.4.0_musl.Linux-x86_64/staging_dir/target-mips_24kc_musl/usr/include -I/home/sk/tmp/sdk/openwrt-sdk-21.02.0-ath79-generic_gcc-8.4.0_musl.Linux-x86_64/staging_dir/target-mips_24kc_musl/usr/lib/libiconv-stub/include -DHAVE_CONFIG_H  -fvisibility=hidden -fPIC -W
all -Wextra -Werror=all -Werror=extra -Werror=discarded-qualifiers -Wno-error=format-truncation -MD -MT smsdb.o -MF .smsdb.o.d -MP  -o smsdb.o -c smsdb.c
smsdb.c: In function 'smsdb_outgoing_part_status':
smsdb.c:713:18: error: 'uid' may be used uninitialized in this function [-Werror=maybe-uninitialized]
  if (res >= 0 && smsdb_outgoing_clear_nolock(uid) < 0) {
                  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
make[3]: *** [Makefile:76: smsdb.o] Error 1

Is there a way around this?

Kind regards, Seb

wdoekes commented 3 years ago

Is there a way around this?

There certainly is.

Because I'm messing in code that is not clear to me, I added -Werror everywhere, killing compilation for simple warnings.

If you revert 5a0ee5318bc2d0ebce8593387bf4af633a9dad2e you should be able to compile.

But, I can also fix this one issue in smsdb, which my compiler apparently does not warn/complain about...

micmac1 commented 3 years ago

Yeah, I'll just patch out Werror for now. Thanks!

wdoekes commented 3 years ago

.. or you can take the latest and not add --enable-warnings-as-errors to the configure params.

micmac1 commented 3 years ago

Thanks Walter!

@mperic02 asked for the Quectel addition, so can you please test if this works? And @532910 reported issues with empty USSD and receiving SMS on a "normal" dongle, so can you please test this as well and let us know the results?

You can test like this. Go to openwrt.org Downloads, go to the section for your router. If you're running a snapshot on your target go for snapshots. If you run 21.02 go to releases/21.02. In the same directory where you find your sysupgrade file there's an SDK. Download that and use it. Command examples below for ath79 21.02 generic.

wget https://downloads.openwrt.org/releases/21.02.0/targets/ath79/generic/openwrt-sdk-21.02.0-ath79-generic_gcc-8.4.0_musl.Linux-x86_64.tar.xz
tar xJf openwrt-sdk-21.02.0-ath79-generic_gcc-8.4.0_musl.Linux-x86_64.tar.xz
cd openwrt-sdk-21.02.0-ath79-generic_gcc-8.4.0_musl.Linux-x86_64/
./scripts/feeds update -a
./scripts/feeds install asterisk-chan-dongle
make menuconfig

In the menu go to Networking -> Telephony -> Asterisk. Disable all plugins except asterisk-chan-dongle. This will speed up the compile later. Exit menuconfig and save.

Next, open "feeds/telephony/net/asterisk-chan-dongle/Makefile" in an editor. Update the following two variables like so:

PKG_SOURCE_VERSION:=df6e3ed25c120e932f0ff08b4cf30c1005813b55
PKG_SOURCE_DATE=2021-09-19

Save and exit. Then:

make package/asterisk-chan-dongle/download
make package/asterisk-chan-dongle/check V=s FIXUP=1
# if you have more than 2 CPUs feel free to increase the number in "-j" parameter to speed up the compile
make -j2 package/asterisk-chan-dongle/{clean,compile} V=s
ls bin/packages/mips_24kc/telephony/asterisk-chan-dongle_2021-09-19-df6e3ed2-1_mips_24kc.ipk

scp the ipk to your router. On the router:

opkg update
opkg install asterisk-chan-dongle_2021-09-19-df6e3ed2-1_mips_24kc.ipk
micmac1 commented 3 years ago

Hello @mperic02 and @532910

If you have issues generating the package let me know. I can build it for you and should be able to upload it to github. Let me know the version and the target you use in this case.

Regards, Seb

532910 commented 3 years ago

@micmac1 I have no Quectel, only Huawei E1550

wdoekes commented 3 years ago

@532910:

And @532910 reported issues with empty USSD and receiving SMS on a "normal" dongle, so can you please test this as well and let us know the results?

I think @micmac1 wasn't asking you to test the Quectel changes, but whether other issues were resolved.

epipenau commented 2 years ago

I have a Quectel EC25 in a PinePhone here. I can send SMS, and have asterisk Answer calls, but I get no Audio when trying to playback audio files, or Echo, or anything really, I even Dialled a sip extension, still no audio.

Please let me know where to go from here. I want to help in any way I can, would love to have this working.