wdoekes / asterisk-chan-dongle

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

Problems on the FreeBSD platform #161

Open ogogon opened 2 years ago

ogogon commented 2 years ago

I'm trying to set up work with a Huawei E1550 3G modem, but I don't quite understand how to connect to it. The modem is unlocked to work with any operator and its voice functionality is unlocked too.

In all HowTo, that wrote linuxoids, it is written that after switching from the drive mode to the modem mode, three com ports should appear, of which the first two are signal port and voice port.

For some reason, I have four com ports. /dev/ttyU0.0 - /dev/ttyU0.3 (/dev/cuaU0.0-/dev/cuaU0.3). Where another com port comes from is not very clear to me.

Com-port ttyU0.0, with all obviousness, is a signal port.

ati
Manufacturer: huawei
Model: E1550
Revision: 11.609.18.00.00
IMEI: **********************
+GCAP: +CGSM,+DS,+ES

OK

The last port, /dev/ttyU0.3, keeps outputting something like this:

^BOOT:42687023,0,0,0,89

^RSSI:14

^RSSI:14

^RSSI:14

^RSSI:14

^RSSI:14

^BOOT:42687023,0,0,0,89

^RSSI:14

^RSSI:10

^RSSI:10

^RSSI:10

^BOOT:42687023,0,0,0,89

^RSSI:10

^BOOT:42687023,0,0,0,89

I tried to declare in the settings chan_dongle ttyU0.0, ttyU0.1 and ttyU0.0, ttyU0.2. Everywhere the result is the same - Asterisk opens port 0.0 and reports the second port opening timeout. I know that both 3G modems I tried worked with Linux in a similar solution.

How do I properly connect my dongle?

VasOleMil commented 1 year ago

FreeBSD uses /dev/cuaUX.X. Here is mine test config with commented "Hellow world" section for Asterisk 18.14.0 FreeBSD 13.1 Huawei E169:

dongle.conf

[general]
interval=15
smsdb=/var/db/asterisk/smsdb
csmsttl=600

[defaults]
context=default                     
group=0                             
rxgain=0                            
txgain=0                            
autodeletesms=yes                   
resetdongle=yes                     
u2diag=-1                           
usecallingpres=yes                  
callingpres=allowed_passed_screen   
disablesms=no   
language=en                         
mindtmfgap=45                       
mindtmfduration=80                  
mindtmfinterval=200                 
callwaiting=auto                    
disable=no                          
initstate=start     
exten=+38095*******                 
dtmf=relax  

[vodafone]
context=vodafone-incoming
exten=+38095*******
audio=/dev/cuaU0.1
data=/dev/cuaU0.2
imei=35963801387****
imsi=25501515034****
group=1
rxgain=0
txgain=0
resetdatacard=yes
u2diag=0
usecallingpres=yes
callingpres=allowed_passed_screen
disablesms=no

pjsip.conf

;===============TRANSPORT================================================================
[transport-udp-nat]
type=transport
protocol=udp
bind=0.0.0.0
local_net=192.168.0.0/24
local_net=127.0.0.0/32
external_media_address=176.36.XXX.XXX
external_signaling_address=176.36.XXX.XXX

;===============ENDPOINT TEMPLATES=======================================================

[endpoint-basic](!)
type=endpoint
context=internal
disallow=all
allow=ulaw
transport=transport-udp-nat
direct_media=no

[auth-userpass](!)
type=auth
auth_type=userpass

[aor-single-reg](!)
type=aor
max_contacts=1
remove_existing=yes
remove_unavailable=yes

;===============EXTENSION 6000

[6000](endpoint-basic)
auth=auth6000
aors=6000

[auth6000](auth-userpass)
password=6000
username=6000

[6000](aor-single-reg)

;===============EXTENSION 6001

[6001](endpoint-basic)
auth=auth6001
aors=6001

[auth6001](auth-userpass)
password=6001
username=6001

[6001](aor-single-reg)

extensions.conf

[vodafone-incoming-sms]
exten => sms,1,Noop(Incoming SMS from ${CALLERID(num)} ${BASE64_DECODE(${SMS_BASE64})})
exten => sms,n,System(echo '${STRFTIME(${EPOCH},,%Y-%m-%d %H:%M:%S)} - ${DONGLENAME} - ${CALLERID(num)}: ${BASE64_DECODE(${SMS_BASE64})}' >> /var/log/asterisk/sms.log)
exten => sms,n,Hangup()

[vodafone-incoming-ussd]
exten => ussd,1,Noop(Incoming USSD: ${BASE64_DECODE(${USSD_BASE64})})
exten => ussd,n,System(echo '${STRFTIME(${EPOCH},,%Y-%m-%d %H:%M:%S)} - ${DONGLENAME} - ${CALLERID(num)}: ${BASE64_DECODE(${USSD_BASE64})}' >> /var/log/asterisk/ussd.log)
exten => ussd,n,Hangup()

[vodafone-incoming]
include => vodafone-incoming-sms
include => vodafone-incoming-ussd

;redirect to internal number
exten => +38095*******,1,Dial(PJSIP/6000,60)

;play hellow world
;exten => +38095*******,1,Answer(500)
;exten => +38095*******,n,Playback(hello-world)
;exten => h,n,Hangup()

[internal]

exten = _6XXX,1,Dial(PJSIP/${EXTEN})

;external number call filter
exten => _38050XXXXXXX,1,Dial(Dongle/vodafone/+${EXTEN},240,tT)
exten => _38066XXXXXXX,1,Dial(Dongle/vodafone/+${EXTEN},240,tT)
exten => _38095XXXXXXX,1,Dial(Dongle/vodafone/+${EXTEN},240,tT)

;gsm provider call
exten => 111,1,Dial(Dongle/vodafone/${EXTEN},240,tT)

CLI check:

CLI> dongle show devices
ID           Group State      RSSI Mode Submode Provider Name  Model      Firmware          IMEI             IMSI             Number        
vodafone     1     Free       2    5    4       Vodafone UA    E169       11.314.17.00.00   35963801387****  25501515034****  Unknown  
CLI> dongle show device settings vodafone
------------- Settings ------------
  Device                  : vodafone
  Audio                   : /dev/cuaU0.1
  Data                    : /dev/cuaU0.2
  IMEI                    : 35963801387****
  IMSI                    : 25501515034****
  Channel Language        : en
  Context                 : vodafone-incoming
  Exten                   : +38095*******
  Group                   : 1
  RX gain                 : 0
  TX gain                 : 0
  U2Diag                  : 0
  Use CallingPres         : Yes
  Default CallingPres     : Presentation Allowed, Passed Screen
  Auto delete SMS         : Yes
  Disable SMS             : No
  Reset Dongle            : Yes
  Call Waiting            : auto
  DTMF                    : relax
  Minimal DTMF Gap        : 45
  Minimal DTMF Duration   : 80
  Minimal DTMF Interval   : 200
  Initial device state    : start
CLI> core show channeltypes
Type             Description                              Devicestate   Presencestate Indications   Transfer     
-------------    -------------                            ------------- ------------- ------------- -------------
Dongle           Huawei 3G Dongle Channel Driver          yes           no            yes           no           
Recorder         Bridge Media Recording Channel Driver    no            no            yes           no           
Announcer        Bridge Media Announcing Channel Driver   no            no            yes           no           
Console          OSS Console Channel Driver               no            no            yes           no           
CBAnn            Conference Bridge Announcing Channel     no            no            yes           no           
CBRec            Conference Bridge Recording Channel      no            no            no            no           
PJSIP            PJSIP Channel Driver                     yes           no            yes           yes          

System check:

# lsusb
Bus /dev/usb Device /dev/ugen2.2: ID 12d1:1001 Huawei Technologies Co., Ltd. E161/E169/E620/E800 HSDPA Modem
# ls -al /dev/ | grep -E "cua"
crw-rw----   1 uucp      dialer    0x9f Nov 12 14:19 cuaU0.0
crw-rw----   1 uucp      dialer    0xa0 Nov 12 14:19 cuaU0.0.init
crw-rw----   1 uucp      dialer    0xa1 Nov 12 14:19 cuaU0.0.lock
crw-rw----   1 uucp      dialer    0xa5 Nov 12 16:21 cuaU0.1
crw-rw----   1 uucp      dialer    0xa6 Nov 12 14:19 cuaU0.1.init
crw-rw----   1 uucp      dialer    0xa7 Nov 12 14:19 cuaU0.1.lock
crw-rw----   1 uucp      dialer    0xab Nov 12 17:44 cuaU0.2
crw-rw----   1 uucp      dialer    0xac Nov 12 14:19 cuaU0.2.init
crw-rw----   1 uucp      dialer    0xad Nov 12 14:19 cuaU0.2.lock