Asterisk RealTime + MySQL

Hello !!!

I’m trying to configure my Asterisk to load configurations from my MySQL I followed these articles:
https://wiki.asterisk.org/wiki/display/AST/Getting+Asterisk+Connected+to+MySQL+via+ODBC
https://wiki.asterisk.org/wiki/display/AST/Configuring+res_odbc
https://wiki.asterisk.org/wiki/display/AST/SIP+Realtime%2C+MySQL+table+structure

and now the connection part seems ok.

srv*CLI> odbc show

ODBC DSN Settings

Name: asterisk
DSN: asterisk-connector
Last connection attempt: 1969-12-31 21:00:00
Number of active connections: 1 (out of 1)

cat /var/log/asterisk/messages

[Jul 27 16:29:54] NOTICE[3391] res_odbc.c: Registered ODBC class ‘asterisk’ dsn->[asterisk-connector]
[Jul 27 16:29:54] WARNING[3391] res_phoneprov.c: Unable to find a valid server address or name.
[Jul 27 16:29:54] ERROR[3391] ari/config.c: No configured users for ARI
[Jul 27 16:29:54] NOTICE[3391] chan_skinny.c: Configuring skinny from skinny.conf
[Jul 27 16:29:54] NOTICE[3391] cel_custom.c: No mappings found in cel_custom.conf. Not logging CEL to custom CSVs.
[Jul 27 16:29:54] NOTICE[3391] app_queue.c: queuerules.conf has not changed since it was last loaded. Not taking any action.

srv*CLI> reload
[Jul 27 16:29:54] NOTICE[3391]: cdr.c:4462 cdr_toggle_runtime_options: CDR simple logging enabled.
– CEL logging disabled.
== Binding sippeers to odbc/asterisk/sipfriends
== Binding sipusers to odbc/asterisk/sipfriends
Asterisk Queue Logger restarted
– Reloading module ‘res_odbc.so’ (ODBC resource)
[Jul 27 16:29:54] NOTICE[3391]: res_odbc.c:616 load_odbc_config: Registered ODBC class ‘asterisk’ dsn->[asterisk-connector]
– Reloading module ‘res_config_odbc.so’ (Realtime ODBC configuration)
– Reloading module ‘res_statsd.so’ (Statsd client support)
– Reloading module ‘res_smdi.so’ (Simplified Message Desk Interface (SMDI) Resource)
– Reloading module ‘res_stun_monitor.so’ (STUN Network Monitor)
– Reloading module ‘res_crypto.so’ (Cryptographic Digital Signatures)
– Reloading module ‘res_phoneprov.so’ (HTTP Phone Provisioning)
[Jul 27 16:29:54] WARNING[3391]: res_phoneprov.c:1231 get_defaults: Unable to find a valid server address or name.
– Reloading module ‘res_ari.so’ (Asterisk RESTful Interface)
[Jul 27 16:29:54] ERROR[3391]: ari/config.c:312 process_config: No configured users for ARI
– Reloading module ‘res_fax.so’ (Generic FAX Applications)
– Reloading module ‘res_hep.so’ (HEPv3 API)
– Reloading module ‘res_calendar.so’ (Asterisk Calendar integration)
– Reloading module ‘res_parking.so’ (Call Parking Resource)
– Reloading module ‘res_config_sqlite3.so’ (SQLite 3 realtime config engine)
– Reloading module ‘res_musiconhold.so’ (Music On Hold Resource)
– Reloading module ‘res_rtp_asterisk.so’ (Asterisk RTP Stack)
– Reloading module ‘chan_iax2.so’ (Inter Asterisk eXchange (Ver 2))
– Reloading module ‘chan_mgcp.so’ (Media Gateway Control Protocol (MGCP))
– Reloading module ‘chan_skinny.so’ (Skinny Client Control Protocol (Skinny))
Reloading MGCP
[Jul 27 16:29:54] NOTICE[3391]: chan_skinny.c:8448 config_load: Configuring skinny from skinny.conf
– Reloading module ‘chan_sip.so’ (Session Initiation Protocol (SIP))
– Reloading module ‘res_adsi.so’ (ADSI Resource)
Reloading SIP
– Reloading module ‘app_confbridge.so’ (Conference Bridge Application)
– Reloading module ‘app_agent_pool.so’ (Call center agent pool applications)
– Reloading module ‘cdr_csv.so’ (Comma Separated Values CDR Backend)
– Reloading module ‘cdr_custom.so’ (Customizable Comma Separated Values CDR Backend)
– Reloading module ‘cdr_manager.so’ (Asterisk Manager Interface CDR Backend)
– Reloading module ‘cdr_odbc.so’ (ODBC CDR Backend)
– Reloading module ‘cdr_adaptive_odbc.so’ (Adaptive ODBC CDR backend)
– Reloading module ‘cel_custom.so’ (Customizable Comma Separated Values CEL Backend)
[Jul 27 16:29:54] NOTICE[3391]: cel_custom.c:97 load_config: No mappings found in cel_custom.conf. Not logging CEL to custom CSVs.
Added CEL CSV mapping for 0 files.
– Reloading module ‘cel_odbc.so’ (ODBC CEL backend)
– Reloading module ‘cel_manager.so’ (Asterisk Manager Interface CEL Backend)
– Reloading module ‘chan_unistim.so’ (UNISTIM Protocol (USTM))
– Reloading module ‘pbx_ael.so’ (Asterisk Extension Language Compiler)
== Setting global variable ‘CONSOLE-AEL’ to ‘“Console/dsp”’
== Setting global variable ‘IAXINFO-AEL’ to ‘guest’
== Setting global variable ‘OUTBOUND-TRUNK’ to ‘“Zap/g2”’
== Setting global variable ‘OUTBOUND-TRUNKMSD’ to ‘1’
– Including switch ‘DUNDi/e164’ in context ‘ael-dundi-e164-switch’
– Time to scan old dialplan and merge leftovers back into the new: 0.000102 sec
– Time to restore hints and swap in new dialplan: 0.000002 sec
– Time to delete the old dialplan: 0.000036 sec
– Total time merge_contexts_delete: 0.000140 sec
– pbx_ael successfully loaded 24 contexts (enable debug for details).
– Reloading module ‘pbx_dundi.so’ (Distributed Universal Number Discovery (DUNDi))
Reloading unistim.conf…
– Reloading module ‘pbx_config.so’ (Text Extension Configuration)
– Including switch ‘DUNDi/e164’ in context ‘ael-dundi-e164-switch’
– Time to scan old dialplan and merge leftovers back into the new: 0.000123 sec
– Time to restore hints and swap in new dialplan: 0.000002 sec
– Time to delete the old dialplan: 0.000030 sec
– Total time merge_contexts_delete: 0.000155 sec
– pbx_config successfully loaded 24 contexts (enable debug for details).
– Reloading module ‘app_voicemail.so’ (Comedian Mail (Voicemail System))
– Reloading module ‘app_minivm.so’ (Mini VoiceMail (A minimal Voicemail e-mail System))
– Reloading module ‘app_followme.so’ (Find-Me/Follow-Me Application)
– Reloading module ‘app_amd.so’ (Answering Machine Detection Application)
– Reloading module ‘app_playback.so’ (Sound File Playback Application)
– Reloading module ‘app_alarmreceiver.so’ (Alarm Receiver for Asterisk)
– Reloading module ‘func_odbc.so’ (ODBC lookups)
– Reloading module ‘res_clialiases.so’ (CLI Aliases)
– Reloading module ‘app_queue.so’ (True Call Queueing)
[Jul 27 16:29:54] NOTICE[3391]: app_queue.c:8732 reload_queue_rules: queuerules.conf has not changed since it was last loaded. Not taking any action.

I tried to configure my extensions as:

INSERT INTO sipfriends (name,host,secret,defaultuser,type,context,allow) values (‘1000’,‘dynamic’,‘1000’,‘1000’,‘peer’,‘default’,‘alaw’);

But when I reload my Asterisk and try to see my peer I’m not able to see it, it seems that is not loading or missing some basic parameters.

srv*CLI> sip show peers
It doesn’t show 1000

Any suggestion that I can do ? Thanks !!!

“sip show peers” doesn’t list entries in the database. You can do a “sip show peer load” and it should load it from the database.

1 Like

Hi jcolp !!! Thank you for your reply, however when I try to use “srv*CLI> sip show peer load” I get:
Peer load not found.

I tried to tail my Asterisk log message but it doesn’t thrown any message ?

Any other suggestion about what can I do ?

Thank you so much !

You have to replace “peer” with the name of the peer you want to load.

Sorry I’m new but trying to learn hard !!!

It works with:
sip show peer 1000 load

Just to know… Is there a way to see all loaded extensions at once ? Now I configured to load my sippeers and sipusers… I’m planning to load other configurations… All configurations that I load from database I should use load in front of the command to see my parameters loaded from the database ?

Thankss !

You would have to individually use “sip show peer” to show them. The chan_sip module doesn’t have any mechanism to show everything from the database like using “sip show peers”.

Ok ! Thank you very much about your time !

Not sure if this is what you’re asking for, but if you add:

rtcachefriends=yes

to the sip.conf file, if will show the extensions when you run “sip show peers”. You can also use “sip prune realtime peer {ext}” and “sip show peer {ext} load” to prune and reload them.

1 Like