Need help for Asterisk13 Realtime working with mysql

I tried all things , but asterisk realtime is not loading extensions and throwing below error

console> chan_sip.c:26458 handle_request_invite: Call from ‘2000’ (xxx.xxx.xxx.xxx:57805) to extension ‘1000’ rejected because extension not found in context ‘from-siptrunk’.

Realtime mysql is connected, i checked it
console> realtime mysql status
asterisk connected to testdb@127.0.0.1, port 3306 with username testuser for 19 minutes.

Here is res_config_mysql.conf
[asterisk]
dbhost = 127.0.0.1
dbname = testdb
dbuser = testuser
dbpass = testpass
dbport = 3306
dbsock = /tmp/mysql.sock
dbcharset = latin1

My sip.conf
[2000]
type=friend
host=dynamic
secret=2000
dtmfmode=rfc2833
disallow=all
context=from-siptrunk
allow=ulaw
allow=alaw
transport=udp,tcp
insecure=very,port,invite
qualify=yes
dtmfmode=rfc2833
canreinvite=no
callprogress=yes
nat=yes

extensions.conf
[from-siptrunk]
switch => Realtime/@extensions

[test_context]
exten => s,1,Ringing()
exten => s,n,Answer()
exten => s,n,Playback(goodbye)
exten => s,n,Hangup()

extensions table
mysql> select * from extensions;
±—±--------------±------±---------±-----±------------+
| id | context | exten | priority | app | appdata |
±—±--------------±------±---------±-----±------------+
| 1 | from-siptrunk | 1000 | 1 | Goto | test_context,s,1 |
| 2 | from-siptrunk | 2000 | 1 | Goto | test_context,s,1 |
±—±--------------±------±---------±-----±------------+
2 rows in set (0.00 sec)

Mysql is connected, sip is registered , call is landing on the server, but its not able to load extension, Please help me to resolve this. Thanks in advance.

Does extconfig.conf point to the extensions table?


The switch statment does not contain a context.
The select output shows: from-siptrunk

switch => Realtime/from-siptrunk@extensions

Thanks Poning, Please find below the extconfig.conf file details
I am still getting the same error,

console> chan_sip.c:26458 handle_request_invite: Call from ‘2000’ (xxx.xxx.xxx.xxx:57805) to extension ‘1000’ rejected because extension not found in context ‘from-siptrunk’.

extconfig.conf

extentions => mysql,asterisk
voicemail => mysql,asterisk,voicemail_users

Even I tried with

extentions => mysql,asterisk,extensions
voicemail => mysql,asterisk,voicemail_users

Did you adjust the switch statement?

switch => Realtime/from-siptrunk@extensions

If you want to leave, as-is. Then you need to change the context field content to default

switch => Realtime/@extensions

If the context is not specified, it looks for default.

mysql> select * from extensions;
| 1 | default | 1000 | 1 | Goto | test_context,s,1 |
| 2 | default | 2000 | 1 | Goto | test_context,s,1 |
1 Like

the switch statement is still like below

switch => Realtime/@extensions

And db records are ,

mysql> select * from extensions;

| id | context | exten | priority | app | appdata |

| 1 | from-siptrunk | 1000 | 1 | Goto | test_context,s,1 |
| 2 | from-siptrunk | 2000 | 1 | Goto | test_context,s,1 |

The extensions are loading from this table now,
as i modified the extensions.conf like as below and added default general section

[general]
static=yes
writeprotect=no
;autofallthrough=no
;extenpatternmatchnew=no
clearglobalvars=no
;userscontext=default

[from-siptrunk]
switch => Realtime/@extensions

[test_context]
exten => s,1,Ringing()
exten => s,n,Answer()
exten => s,n,hangup()

You need to specify the context, if it’s not set as default in the DB.
The context from the dial plan is not passed to ARA.

1 Like