Issue with incoming calls (chan_dongle)


I’m new to asterisk and trying to build a gsm gateway with chan_dongle. I’ve got the system up and running so far and can make outgoing calls from my SIP client but when I try to call the SIP client from a PSTN Network I get the following warning:

[Jun 17 20:07:34] WARNING[2328][C-00000000]: pbx.c:6646 __ast_pbx_run: Channel ‘Dongle/dongle0-0100000000’ sent to invalid extension but no invalid handler: context,exten,priority=dongle-incoming,+00491732******,1

I must admit that although I’ve read a lot of documentation (official and blog posts) I’m still not really familiar with the extension/context system.

However, the context of dongle-incoming defines that it should dial foo via sip, doesn’t it. So what’s the problem?

I’ve attached my configuration below. If I’ve forgotten something important please request it.

Thanks in advance

*** version ***
Asterisk 11.13.1~dfsg-2+deb8u2 built by buildd @ hoiby on a armv7l running Linux on 2017-01-07 03:25:05 UTC

*** sip peers ***
Name/username             Host                                    Dyn Forcerport Comedia    ACL Port     Status      Description
foo/foo                                      D  No         Yes            5060     OK (5 ms)
1 sip peers [Monitored: 1 online, 0 offline Unmonitored: 0 online, 0 offline]

*** extensions.conf ***
exten => s,1,NoOp()
exten => s,2,Dial(SIP/foo)
exten => s,n,Hangup()

exten => _X.,1,NoOp()
exten => _X.,2,Dial(Dongle/dongle0/${EXTEN},,r)
exten => _X.,n,Hangup
exten => _+49X.,1,NoOp()
exten => _+49X.,2,Dial(Dongle/dongle0/${EXTEN},,r)
exten => _+49X.,n,Hangup

*** sip.conf ***
tcpenable = no
tos_sip=cs3                    ; Sets TOS for SIP packets.
tos_audio=ef                   ; Sets TOS for RTP audio packets.
tos_video=af41                 ; Sets TOS for RTP video packets.

callerid=Foo <10>

*** dongle.conf ***

interval=15                     ; Number of seconds between trying to connect to devices

;------------------------------ JITTER BUFFER CONFIGURATION --------------------------
;jbenable = yes                 ; Enables the use of a jitterbuffer on the receiving side of a
                                ; Dongle channel. Defaults to "no". An enabled jitterbuffer will
                                ; be used only if the sending side can create and the receiving
                                ; side can not accept jitter. The Dongle channel can't accept jitter,
                                ; thus an enabled jitterbuffer on the receive Dongle side will always
                                ; be used if the sending side can create jitter.

;jbforce = no                   ; Forces the use of a jitterbuffer on the receive side of a Dongle
                                ; channel. Defaults to "no".

;jbmaxsize = 200                ; Max length of the jitterbuffer in milliseconds.

;jbresyncthreshold = 1000       ; Jump in the frame timestamps over which the jitterbuffer is
                                ; resynchronized. Useful to improve the quality of the voice, with
                                ; big jumps in/broken timestamps, usually sent from exotic devices
                                ; and programs. Defaults to 1000.

;jbimpl = fixed                 ; Jitterbuffer implementation, used on the receiving side of a Dongle
                                ; channel. Two implementations are currently available - "fixed"
                                ; (with size always equals to jbmaxsize) and "adaptive" (with
                                ; variable size, actually the new jb of IAX2). Defaults to fixed.

;jbtargetextra = 40             ; This option only affects the jb when 'jbimpl = adaptive' is set.
                                ; The option represents the number of milliseconds by which the new jitter buffer
                                ; will pad its size. the default is 40, so without modification, the new
                                ; jitter buffer will set its size to the jitter value plus 40 milliseconds.
                                ; increasing this value may help if your network normally has low jitter,
                                ; but occasionally has spikes.

;jblog = no                     ; Enables jitterbuffer frame logging. Defaults to "no".

; now you can set here any not required device settings as template
;   sure you can overwrite in any [device] section this default values

context=dongle-incoming         ; context for incoming calls
group=0                         ; calling group
rxgain=0                        ; increase the incoming volume; may be negative
txgain=0                        ; increase the outgoint volume; may be negative
autodeletesms=yes               ; auto delete incoming sms
resetdongle=yes                 ; reset dongle during initialization with ATZ command
u2diag=-1                       ; set ^U2DIAG parameter on device (0 = disable everything except modem function) ; -1 not use ^U2DIAG command
usecallingpres=yes              ; use the caller ID presentation or not
callingpres=allowed_passed_screen ; set caller ID presentation          by default use default network settings
disablesms=yes                   ; disable of SMS reading from device when received
                                ;  chan_dongle has currently a bug with SMS reception. When a SMS gets in during a
                                ;  call chan_dongle might crash. Enable this option to disable sms reception.
                                ;  default = no

language=en                     ; set channel default language
smsaspdu=yes                    ; if 'yes' send SMS in PDU mode, feature implementation incomplete and we strongly recommend say 'yes'
mindtmfgap=45                   ; minimal interval from end of previews DTMF from begining of next in ms
mindtmfduration=80              ; minimal DTMF tone duration in ms
mindtmfinterval=200             ; minimal interval between ends of DTMF of same digits in ms

callwaiting=auto                ; if 'yes' allow incoming calls waiting; by default use network settings
                                ; if 'no' waiting calls just ignored
disable=no                      ; OBSOLETED by initstate: if 'yes' no load this device and just ignore this section

initstate=start                 ; specified initial state of device, must be one of 'stop' 'start' 'remote'
                                ;   'remove' same as 'disable=yes'

;exten=				            ; exten for start incoming calls, only in case of Subscriber Number not available!, also set to CALLERID(ndid)

dtmf=relax                      ; control of incoming DTMF detection, possible values:
                                ;   off    - off DTMF tones detection, voice data passed to asterisk unaltered
                                ;              use this value for gateways or if not use DTMF for AVR or inside dialplan
                                ;   inband - do DTMF tones detection
                                ;   relax  - like inband but with relaxdtmf option
                                ;  default is 'relax' by compatibility reason

; dongle required settings
audio=/dev/ttyUSB1              ; tty port for audio connection;        no default value
data=/dev/ttyUSB2               ; tty port for AT commands;             no default value

; or you can omit both audio and data together and use imei=123456789012345 and/or imsi=123456789012345
;  imei and imsi must contain exactly 15 digits !
;  imei/imsi discovery is available on Linux only

; if audio and data set together with imei and/or imsi audio and data has precedence
;   you can use both imei and imsi together in this case exact match by imei and imsi required

*** settings ***
PBX Core settings
  Version:                     11.13.1~dfsg-2+deb8u2
  Build Options:               LOADABLE_MODULES
  Maximum calls:               Not set
  Maximum open file handles:   Not set
  Root console verbosity:      0
  Current console verbosity:   9
  Debug level:                 9
  Maximum load average:        0.000000
  Minimum free memory:         0 MB
  Startup time:                19:57:41
  Last reload time:            19:57:54
  System:                      Linux/3.16.0-4-armmp-lpae built by buildd on armv7l 2017-01-07 03:25:05 UTC
  System name:
  Entity ID:                   06:cf:77:b1:3a:e6
  Default language:            en
  Language prefix:             Enabled
  User name and group:         /
  Executable includes:         Disabled
  Transcode via SLIN:          Enabled
  Transmit silence during rec: Disabled
  Generic PLC:                 Enabled
  Min DTMF duration::          80

* Subsystems
  Manager (AMI):               Enabled
  Web Manager (AMI/HTTP):      Disabled
  Call data records:           Enabled
  Realtime Architecture (ARA): Disabled

* Directories
  Configuration file:
  Configuration directory:     /etc/asterisk
  Module directory:            /usr/lib/asterisk/modules
  Spool directory:             /var/spool/asterisk
  Log directory:               /var/log/asterisk
  Run/Sockets directory:       /var/run/asterisk
  PID file:                    /var/run/asterisk/
  VarLib directory:            /var/lib/asterisk
  Data directory:              /usr/share/asterisk
  ASTDB:                       /var/lib/asterisk/astdb
  IAX2 Keys directory:         /usr/share/asterisk/keys
  AGI Scripts directory:       /usr/share/asterisk/agi-bin

*** peer foo ***

  * Name       : foo
  Description  :
  Secret       : <Set>
  MD5Secret    : <Not set>
  Remote Secret: <Not set>
  Context      : from-internal
  Record On feature : automon
  Record Off feature : automon
  Subscr.Cont. : <Not set>
  Language     :
  Tonezone     : <Not set>
  AMA flags    : Unknown
  Transfer mode: open
  CallingPres  : Presentation Allowed, Not Screened
  Callgroup    :
  Pickupgroup  :
  Named Callgr :
  Nam. Pickupgr:
  MOH Suggest  :
  Mailbox      :
  VM Extension : asterisk
  LastMsgsSent : 0/0
  Call limit   : 2147483647
  Max forwards : 0
  Busy level   : 1
  Dynamic      : Yes
  Callerid     : "Foo" <10>
  MaxCallBR    : 384 kbps
  Expire       : -1
  Insecure     : no
  Force rport  : No
  Symmetric RTP: Yes
  ACL          : No
  DirectMedACL : No
  T.38 support : No
  T.38 EC mode : Unknown
  T.38 MaxDtgrm: 4294967295
  DirectMedia  : Yes
  PromiscRedir : No
  User=Phone   : No
  Video Support: No
  Text Support : No
  Ign SDP ver  : No
  Trust RPID   : No
  Send RPID    : No
  TrustIDOutbnd: Legacy
  Subscriptions: Yes
  Overlap dial : Yes
  DTMFmode     : rfc2833
  Timer T1     : 500
  Timer B      : 32000
  ToHost       :
  Addr->IP     : (null)
  Defaddr->IP  : (null)
  Prim.Transp. : UDP
  Allowed.Trsp : UDP
  Def. Username:
  SIP Options  : (none)
  Codecs       : (gsm|ulaw|alaw|g722|h263|testlaw)
  Codec Order  : (g722:20,alaw:20,ulaw:20,gsm:20)
  Auto-Framing : No
  Status       : UNKNOWN
  Useragent    :
  Reg. Contact :
  Qualify Freq : 60000 ms
  Keepalive    : 0 ms
  Sess-Timers  : Accept
  Sess-Refresh : uas
  Sess-Expires : 1800 secs
  Min-Sess     : 90 secs
  RTP Engine   : asterisk
  Parkinglot   :
  Use Reason   : No
  Encryption   : No

*** dongle ***
ID           Group State      RSSI Mode Submode Provider Name  Model      Firmware          IMEI             IMSI             Number
dongle0      0     Free       14   0    0       E-Plus         K3765   354232**********  262072**********  +0049173******

*** modules ***
Module                         Description                              Use Count                    Dialing Application                      0                    Simple Echo Application                  0                   Extension Macros                         0               Digital Milliwatt (mu-law) Test Applicat 0                Sound File Playback Application          0                Transfers a caller to another extension  0                 Send verbose output                      0                   ALSA Console Channel Driver              0                 Huawei 3G Dongle Channel Driver          0                  Local Proxy Channel (Note: used internal 0                    Session Initiation Protocol (SIP)        0                  A-law Coder/Decoder                      0                  ITU G.722-64kbps G722 Transcoder         0                   GSM Coder/Decoder                        0                  mu-Law Coder/Decoder                     0                  Raw GSM data                             0                 Raw H.263 data                           0                  Raw/Sun uLaw/ALaw 8KHz (PCM,PCMA,AU), G. 0                  Raw Signed Linear Audio support (SLN) 8k 0                  Microsoft WAV/WAV16 format (8kHz/16kHz S 0              Microsoft WAV format (Proprietary GSM)   0               Party ID related dialplan functions (Cal 0                 Variable dialplan functions              0                  Text Extension Configuration             0                    ADSI Resource                            0                 File format conversion CLI command       0                  Cryptographic Digital Signatures         0          HTTP WebSocket Support                   0             Music On Hold Resource                   0            Asterisk RTP Stack                       0          Timerfd Timing Interface                 0
31 modules loaded

*** modules.conf ***
; Asterisk configuration file
; Module Loader configuration file


; Resources —
load =>
load => ; ADSI Resource
load => ; Cryptographic Digital Signatures
load => ; Music On Hold Resource
load =>
load =>
load =>

; PBX —
load => ; Text Extension Configuration Requires N/A

; Functions —
load => ; Gets or sets Caller*ID data on the channel. - Requires ?
load => ; Variable dialplan functions

; Channels —
load =>
;load => ; IAX (Ver 2) - Requires,
load => ; Show status of local channels- Requires N/A
load => ; Session Initiation Protocol (SIP) - Requires
load =>

; Codecs —
load => ; ITU G.722-64kbps G722 Transcoder
load => ; A-law Coder/Decoder - Requires N/A
load => ; Mu-law Coder/Decoder - Requires N/A
load => ; GSM/PCM16 (signed linear) Codec Translat - Requires N/A

; Formats —
load => ; Raw GSM data - Requires N/A
load => ; Raw h263 data - Requires N/A
load => ; Raw uLaw 8khz Audio support (PCM) - Requires N/A
load => ; Microsoft WAV format (Proprietary GSM) - Requires N/A
load => ; Microsoft WAV format (8000hz Signed Linear) - Requires N/A
load =>

; Applications —
load => ; Dialing Application - Requires,
load => ; Echo audio read from channel back to the channel - Requires N/A
load => ; Macro Handling Application - Requires N/A
load => ; Generate a Constant 1000Hz tone at 0dbm (mu-law) - Requires N/A
load => ; Transfer caller to remote extension - Requires N/A
load => ; Send arbitrary text to verbose output - Requires N/A
load =>

Replace s in your dongle-incoming context with +00491732****** but without the redaction. I assume this is a malformed version of the SIM’s MSISDN (malformed, because it should have +49 or 0049, but not +0049.

Thanks for your help david.

I’ve changed the subscriber number on the SIM card to the correct format but it didn’t solve the issue.

[Jun 18 10:05:52] WARNING[2072][C-00000000]: pbx.c:6646 __ast_pbx_run: Channel ‘Dongle/dongle0-0100000000’ sent to invalid extension but no invalid handler: context,exten,priority=dongle-incoming,+491732******,1

Edit: Omg, shortly after I’ve submitted the post I did understand the meaning of your post so I’ve replaced the context setting to my number and now it works for incoming calls from the dongle, too,

*** extensions.conf ***
exten => +491732******,1,NoOp()
exten => +491732******,2,Dial(SIP/foo)
exten => +491732******,n,Hangup()

exten => _X.,1,NoOp()
exten => _X.,2,Dial(Dongle/dongle0/${EXTEN},,r)
exten => _X.,n,Hangup
exten => _+49X.,1,NoOp()
exten => _+49X.,2,Dial(Dongle/dongle0/${EXTEN},,r)
exten => _+49X.,n,Hangup

I guess I have to read a lot more documentation…

Did you change the s in the dialplan?

Se my edited post.

Thanks again!

Hi Minion 89. Did you manage to solve the problem you describe? I have exactly the same problem and I don’t know what else to do.
Please let me know if you found any solution.