I have RealTime asterisk setup. When the number is stored in database and I call the extension everything is okay.
The problem is when the number doesn’t exist. I want if number which is not existing to hear message like “number not exist” or some other action.
So, I have added this in func_odbc.conf
[HASVOICEMAIL]
dsn=asterisk
readsql=SELECT name FROM sipfriends WHERE name='${SQL_ESC(${ARG1})}'
and this in extensions.conf
[general]
static=yes
writeprotect=no
autofallthrough=no
clearglobalvars=no
priorityjumping=no
[lookupdundi]
switch => DUNDi/priv
[internal]
exten => 119,1,NoOp()
exten => 119,2,WaitExten(1)
exten => 119,3,Set(COUNT=${ODBC_HASVOICEMAIL(${CALLERID(num)})})
exten => 119,4,GotoIf($["${COUNT}" > "0"]?internal,5:no-voicemail,1)
exten => 119,5,VoicemailMain(${CALLERID(num)}@VoiceMail)
[no-voicemail]
exten => noVoiceMail,1,Handup()
include => dundiextens
include => lookupdundi
switch => Realtime
[incomingdundi]
exten => 119,1,NoOp(internal)
exten => 119,2,Playback(hello-world)
When I make a call in CLI I see this
[Dec 7 12:01:38] NOTICE[9133][C-00000031]: chan_sip.c:26449 handle_request_invite: Call from ‘’ (xxx.yyy.zzz.www:5060) to extension ‘119’ rejected because extension not found in context ‘default’.
parts of the /var/log/asterisk/full
log
[Dec 7 12:00:53] DEBUG[9133] chan_sip.c: = Looking for Call ID: 2mdIf8lexOTBIMg2pPgKOBdDB3SowCcf (Checking From) --From tag PKcMBzp6yhIZQG-du1TsYkW1MPmX6L5V --To-tag
[Dec 7 12:00:53] DEBUG[9133] acl.c: For destination ‘xxx.yyy.zzz.www’, our source address is ‘xxx.yyy.zzz.www’.
[Dec 7 12:00:53] DEBUG[9133] chan_sip.c: Setting AST_TRANSPORT_UDP with address xxx.yyy.zzz.www:5060
[Dec 7 12:00:53] DEBUG[9133] netsock2.c: Splitting ‘xxx.yyy.zzz.www:5060’ into…
[Dec 7 12:00:53] DEBUG[9133] netsock2.c: …host ‘xxx.yyy.zzz.www’ and port ‘5060’.
[Dec 7 12:00:53] DEBUG[9133] chan_sip.c: Allocating new SIP dialog for 2mdIf8lexOTBIMg2pPgKOBdDB3SowCcf - INVITE (No RTP)
[Dec 7 12:00:53] DEBUG[9133][C-00000030] chan_sip.c: **** Received INVITE (5) - Command in SIP INVITE
[Dec 7 12:00:53] DEBUG[9133][C-00000030] netsock2.c: Splitting ‘xxx.yyy.zzz.www:5060’ into…
[Dec 7 12:00:53] DEBUG[9133][C-00000030] netsock2.c: …host ‘xxx.yyy.zzz.www’ and port ‘5060’.
[Dec 7 12:00:53] DEBUG[9133][C-00000030] netsock2.c: Splitting ‘xxx.yyy.zzz.www’ into…
[Dec 7 12:00:53] DEBUG[9133][C-00000030] netsock2.c: …host ‘xxx.yyy.zzz.www’ and port ‘’.
[Dec 7 12:00:53] DEBUG[9133][C-00000030] res_config_mysql.c: MySQL RealTime: Connection okay.
[Dec 7 12:00:53] DEBUG[9133][C-00000030] res_config_mysql.c: MySQL RealTime: Retrieve SQL: SELECT * FROM sipfriends WHERE name = ‘1002’ AND host = ‘dynamic’
[Dec 7 12:00:53] DEBUG[9133][C-00000030] res_config_mysql.c: MySQL RealTime: Connection okay.
[Dec 7 12:00:53] DEBUG[9133][C-00000030] res_config_mysql.c: MySQL RealTime: Retrieve SQL: SELECT * FROM sipfriends WHERE name = ‘1002’
[Dec 7 12:00:53] DEBUG[9133][C-00000030] chan_sip.c: We’re settling with these formats: (alaw)
[Dec 7 12:00:53] DEBUG[9133][C-00000030] chan_sip.c: Checking SIP call limits for device
[Dec 7 12:00:53] DEBUG[9133][C-00000030] chan_sip.c: Updating call counter for incoming call
[Dec 7 12:00:53] DEBUG[9133][C-00000030] netsock2.c: Splitting ‘xxx.yyy.zzz.www:5060’ into…
[Dec 7 12:00:53] DEBUG[9133][C-00000030] netsock2.c: …host ‘xxx.yyy.zzz.www’ and port ‘’.
[Dec 7 12:00:53] DEBUG[9133][C-00000030] netsock2.c: Splitting ‘xxx.yyy.zzz.www’ into…
[Dec 7 12:00:53] DEBUG[9133][C-00000030] netsock2.c: …host ‘xxx.yyy.zzz.www’ and port ‘’.
[Dec 7 12:00:53] DEBUG[9133][C-00000030] chan_sip.c: Trying to put ‘SIP/2.0 404’ onto UDP socket destined for xxx.yyy.zzz.www:5060
[Dec 7 12:00:53] DEBUG[9133][C-00000030] chan_sip.c: Updating call counter for incoming call
[Dec 7 12:00:53] DEBUG[9133] chan_sip.c: = Looking for Call ID: 2mdIf8lexOTBIMg2pPgKOBdDB3SowCcf (Checking From) --From tag PKcMBzp6yhIZQG-du1TsYkW1MPmX6L5V --To-tag as2f1e4b11
[Dec 7 12:00:53] DEBUG[9133][C-00000030] chan_sip.c: **** Received ACK (6) - Command in SIP ACK
[Dec 7 12:00:53] DEBUG[9133][C-00000030] chan_sip.c: Stopping retransmission on ‘2mdIf8lexOTBIMg2pPgKOBdDB3SowCcf’ of Response 124: Match Found
[Dec 7 12:00:53] DEBUG[9133] chan_sip.c: Destroying SIP dialog 2mdIf8lexOTBIMg2pPgKOBdDB3SowCcf
[Dec 7 12:00:53] DEBUG[9133] rtp_engine.c: Destroyed RTP instance ‘0x7f7abc00e8a8’
The error in wireshark is 404 Not Found
. Is this how the incoming calls are handled?