Issue with incoming calls (chan_dongle)

Hi!

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                   192.168.0.10                             D  No         Yes            5060     OK (5 ms)
1 sip peers [Monitored: 1 online, 0 offline Unmonitored: 0 online, 0 offline]

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

[from-internal]
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 ***
[general]
dtmfmode=auto
relaxdtmf=yes
port=5060
bindaddr=0.0.0.0
tcpenable = no
context=dongle-incoming
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.
nat=comedia
callcounter=yes
notifyhold=yes
srvlookup=yes
allow=g722,alaw,ulaw,gsm

[foo]
type=friend
host=dynamic
context=from-internal
secret=foo
dtmfmode=rfc2833
callerid=Foo <10>
qualify=yes
busylevel=1

*** dongle.conf ***
[general]

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".
;-----------------------------------------------------------------------------------

[defaults]
; 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
[dongle0]
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
;imei=123456789012345
;imsi=123456789012345

; 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/asterisk.pid
  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      11.126.03.09.00   354232**********  262072**********  +0049173******

*** modules ***
Module                         Description                              Use Count
app_dial.so                    Dialing Application                      0
app_echo.so                    Simple Echo Application                  0
app_macro.so                   Extension Macros                         0
app_milliwatt.so               Digital Milliwatt (mu-law) Test Applicat 0
app_playback.so                Sound File Playback Application          0
app_transfer.so                Transfers a caller to another extension  0
app_verbose.so                 Send verbose output                      0
chan_alsa.so                   ALSA Console Channel Driver              0
chan_dongle.so                 Huawei 3G Dongle Channel Driver          0
chan_local.so                  Local Proxy Channel (Note: used internal 0
chan_sip.so                    Session Initiation Protocol (SIP)        0
codec_alaw.so                  A-law Coder/Decoder                      0
codec_g722.so                  ITU G.722-64kbps G722 Transcoder         0
codec_gsm.so                   GSM Coder/Decoder                        0
codec_ulaw.so                  mu-Law Coder/Decoder                     0
format_gsm.so                  Raw GSM data                             0
format_h263.so                 Raw H.263 data                           0
format_pcm.so                  Raw/Sun uLaw/ALaw 8KHz (PCM,PCMA,AU), G. 0
format_sln.so                  Raw Signed Linear Audio support (SLN) 8k 0
format_wav.so                  Microsoft WAV/WAV16 format (8kHz/16kHz S 0
format_wav_gsm.so              Microsoft WAV format (Proprietary GSM)   0
func_callerid.so               Party ID related dialplan functions (Cal 0
func_global.so                 Variable dialplan functions              0
pbx_config.so                  Text Extension Configuration             0
res_adsi.so                    ADSI Resource                            0
res_convert.so                 File format conversion CLI command       0
res_crypto.so                  Cryptographic Digital Signatures         0
res_http_websocket.so          HTTP WebSocket Support                   0
res_musiconhold.so             Music On Hold Resource                   0
res_rtp_asterisk.so            Asterisk RTP Stack                       0
res_timing_timerfd.so          Timerfd Timing Interface                 0
31 modules loaded


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

[modules]
autoload=no

; Resources —
load => res_http_websocket.so
load => res_adsi.so ; ADSI Resource
load => res_crypto.so ; Cryptographic Digital Signatures
load => res_musiconhold.so ; Music On Hold Resource
load => res_rtp_asterisk.so
load => res_convert.so
load => res_timing_timerfd.so

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

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

; Channels —
load => chan_dongle.so
;load => chan_iax2.so ; IAX (Ver 2) - Requires res_crypto.so, res_features.so
load => chan_local.so ; Show status of local channels- Requires N/A
load => chan_sip.so ; Session Initiation Protocol (SIP) - Requires res_features.so
load => chan_alsa.so

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

; Formats —
load => format_gsm.so ; Raw GSM data - Requires N/A
load => format_h263.so ; Raw h263 data - Requires N/A
load => format_pcm.so ; Raw uLaw 8khz Audio support (PCM) - Requires N/A
load => format_wav_gsm.so ; Microsoft WAV format (Proprietary GSM) - Requires N/A
load => format_wav.so ; Microsoft WAV format (8000hz Signed Linear) - Requires N/A
load => format_sln.so

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

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 ***
[dongle-incoming]
exten => +491732******,1,NoOp()
exten => +491732******,2,Dial(SIP/foo)
exten => +491732******,n,Hangup()

[from-internal]
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.

Br,

JV