PDA

Voir la version complète : ODBC et MySQL realtime extensions et utilisateurs



rheritahiana
15/10/2014, 23h17
Bonjour,
Cela fait quelques jours que je tourne en rond sur ce problème et je vous remercie déja de votre aide
Voici ma configuration :Asterisk 11.13 sous Centos 6.5 avec MySQL et apache fonctionnels
J'essaie de charger les utilisateurs (et/ou extensions) depuis une base MySQL
Voici mes fichiers
Sip.conf:


[general]
context = DLPN_dialplan1 ; Default context for incoming calls
allowoverlap = no ; Disable overlap dialing support. (Default is yes)
udpbindaddr = 0.0.0.0 ; IP address to bind UDP listen socket to (0.0.0.0 binds to all)
tcpenable = yes ; Enable server for incoming TCP connections (default is no)
tcpbindaddr = 0.0.0.0 ; IP address for TCP server to bind to (0.0.0.0 binds to all interfaces)
transport = udp ; Set the default transports. The order determines the primary default transport.
srvlookup = yes ; Enable DNS SRV lookups on outbound calls
language = fr ; Default language setting for all users/peers
videosupport = yes ; Turn on support for SIP video. You need to turn this
subscribecontext = default
localnet=192.168.200.0/255.255.0.0 ; RFC 1918 addresses
rtcachefriends=yes ; Cache realtime friends by adding them to the internal list
rtupdate=yes ; Send registry updates to database using realtime? (yes|no)
rtautoclear=no ; Auto-Expire friends created on the fly on the same schedule
bindport=5060
engine=asterisk
[authentication]

[basic-options](!); a template
dtmfmode = rfc2833
context = from-office
type = friend

[natted-phone](!,basic-options); another template inheriting basic-options
directmedia = no
host = dynamic

[public-phone](!,basic-options); another template inheriting basic-options
directmedia = yes

[my-codecs](!); a template for my preferred codecs
disallow = all
allow = ilbc
allow = g729
allow = gsm
allow = g723
allow = ulaw


[ulaw-phone](!); and another one for ulaw-only
disallow = all
allow = ulaw



users.conf


[general]
dtmfmode = rfc2833
hasvoicemail = yes
hassip = yes
hasiax = yes
callwaiting = yes
threewaycalling = yes
callwaitingcallerid = yes
transfer = yes
canpark = yes
cancallforward = yes
callreturn = yes
callgroup = 1
pickupgroup = 1
nat = force_rport
vmexten = 6999
bindaddr=0.0.0.0
bindport = 5060
videosupport=yes
externhost=rh.ddns.net ; refreshed periodically
externrefresh=180 ; change the refresh interval
disallow=all
allow=gsm
allow=alaw
allow=ulaw
allow=speex
allow=h264
allow=h261
allow=h263
allow=h263p
allowsubscribe=yes
asterisk sip allowoverlap=yes
caninvite=no ; These setting confirm we want the PBX handling the audio
canreinvite=no
jbenable=yes
maxcallbitrate=384
rtpcachefriends=yes
rtupdate=yes


[template](!)
type = friend
host = dynamic
dtmfmode = rfc2833
disallow = all
allow = ulaw
allow = h263

[6000](template)
fullname = Standard
username = tax
secret = 123456
context = DLPN_dialplan1
callcounter = yes
linenumber = 1
cid_number = 6000
hasvoicemail = no
vmsecret =
email =
threewaycalling = no
hasdirectory = yes
callwaiting = no
hasmanager = no
hasagent = yes
hassip = yes
hasiax = yes
nat = force_rport
canreinvite = no
insecure = no
pickupgroup =
call-limit = 100
allow = ulaw,h263
macaddress = 6000
autoprov = yes
label = 6
LINEKEYS = 1

[6001](template)
fullname = tahiana raolona
username = tax
secret = 123456
context = DLPN_dialplan1
callcounter = yes
linenumber = 1
cid_number = 6001
hasvoicemail = no
vmsecret =
email =
threewaycalling = no
hasdirectory = yes
callwaiting = no
hasmanager = no
hasagent = yes
hassip = yes
hasiax = yes
nat = force_rport
canreinvite = no
insecure = no
pickupgroup =
call-limit = 100
allow = ulaw,h263
macaddress = 6001
autoprov = yes
label = 6001
LINEKEYS = 1

[6002](template)
fullname = xperia tax
username = xperia tax
secret = 123456
context = DLPN_dialplan1
callcounter = yes
linenumber = 1
cid_number = 6002
hasvoicemail = no
vmsecret =
email =
threewaycalling = no
hasdirectory = no
callwaiting = no
hasmanager = no
hasagent = no
hassip = yes
hasiax = no
nat = force_rport
canreinvite = no
insecure = no
pickupgroup =
call-limit = 100
allow = ulaw,h263
macaddress = 6002
autoprov = yes
label = 6002
LINEKEYS = 1






Extensions.conf (réduit à l'essentiel)


[CallingRule_work]
switch =>Realtime
exten => _6XXX,1,Dial(SIP/${EXTEN},20,tTkK)
exten => _6XXX,n,Playback(MSG-${EXTEN})
exten => _6XXX,n,VoiceMail(${EXTEN}@CallingRule_work)
exten => 6999,1,VoiceMailMain(${CALLERID(num)}@CallingRule_ work,s)
exten => 9001,1,Answer()
exten => 9001,2,Set(TIMEOUT(response)=10)
exten => 9001,3,agi(googletts.agi,"Bienvenues chez Techmedia!",fr,any)
exten => 9001,4,agi(googletts.agi,"Qui souhaitez vous joindre?",fr,any)
exten => 9001,5,agi(googletts.agi,"Pour Tax Lenovo tapez 1",fr,any)
exten => 9001,6,agi(googletts.agi,"Pour Tax Xperia tapez 2",fr,any)
exten => 9001,7,agi(googletts.agi,"Appuyez sur dièse si vous souhaitez réécouter ce message",fr,any)
exten => 9001,8,WaitExten()
exten => 1,1,Goto(6001,1)
exten => 2,1,Goto(6006,1)
exten => _[3-9#],1,Goto(8001,3)
exten => t,1,Goto(8001,3)
exten => 9000,1,Goto(voicemail-msg,s,1)




[voicemail-msg]
exten => s,1,Answer
exten => s,2,agi(googletts.agi,"Bienvenue dans l'utilitaire de création de messages d'accueil.",fr,any)
exten => s,3,agi(googletts.agi,"Après le bip sonore, veillez annoncer votre message d'accueil, et validez avec dièse.",fr,any)
exten => s,4,Record(MSG-${CALLERID(num)}:ulaw)
exten => s,5,agi(googletts.agi,"Voici votre message d'accueil: ",fr,any)
exten => s,6,Playback(MSG-${CALLERID(num)})
exten => s,7,agi(googletts.agi,"Si vous souhaitez le ré enregistrer appuyez sur 1",fr,any)
exten => s,8,agi(googletts.agi,"Si vous souhaitez garder ce message vous pouvez raccrocher",fr,any)
exten => s,9,Set(TIMEOUT(response)=10)
exten => s,10,WaitExten()
exten => 1,1,Goto(voicemail-msg,s,3)
exten => _[2-9#],1,Goto(voicemail-msg,s,7)
exten => t,1,Goto(voicemail-msg,s,7)



[dongle-incoming]
exten => sms,1,Verbose(Incoming SMS from ${CALLERID(num)} ${BASE64_DECODE(${SMS_BASE64})})
exten => sms,n,System(echo '${STRFTIME(${EPOCH},,%Y-%m-%d %H:%M:%S)} - ${DONGLENAME} - ${CALLERID(num)} - ${BASE64_DECODE(${SMS_BASE64})}' >> /var/log/asterisk/sms.txt) ; be careful this may not be safe if sms/ussd contains shell code
exten => sms,n,System(php /var/www/html/sms.php ${DONGLENAME} ${CALLERID(num)} '${BASE64_DECODE(${SMS_BASE64})}')
exten => sms,n,Hangup()
exten => ussd,1,Verbose(Incoming USSD: ${BASE64_DECODE(${USSD_BASE64})})
exten => ussd,n,System(echo '${STRFTIME(${EPOCH},,%Y-%m-%d %H:%M:%S)} - ${DONGLENAME}: ${BASE64_DECODE(${USSD_BASE64})}' >> /var/log/asterisk/ussd.txt) ; be careful this may not be safe if sms/ussd contains shell code
exten => ussd,n,Hangup()
exten => s,1,NoOp(Appel entrant de: ${CALLERID(all)} to ${EXTEN})
same => n,Dial(SIP/6004,20,tTkK)
same => n,Playback(MSG-${EXTEN})
same => n,VoiceMail(${EXTEN}@CallingRule_work)
same => n,Hangup()



[dongle-outgoing]
exten => _0XXXXXXXXX,1,Dial(SIP/6000,20,tTkK)
exten => _+261XXXXXXXXX,1,Dial(SIP/6000,20,tTkK)
exten => _990XXXXXXXXX,1,Dial(Dongle/appel_externe/${EXTEN:2})



[incoming]
exten => _2XXX,1,Dial(SIP/6001&SIP/6006, 20) ;Action lors d'un appel, dans ce cas appeler les postes: 6001, 6002, 6003 et 6004 mm tps



[DLPN_dialplan1]
include = CallingRule_work
include = dongle-incoming
include = dongle-outgoing
include = default


L'odbc fontionne correctement parce que j'arrive à enregistrer sans problèmes les CDRs
j'ai suivi ce guide http://www.open-voip.org/index.php?title=Asterisk_Simple_Realtime_example

qui n'es plus à jour apparemment puisque ce'est l'odbc qui est conseillé.
J'ai donc essayé de l'adapter à l'ODBC

voici le fichier res_odbc.conf



[ENV]

[asterisk]
enabled => yes
dsn => asterisk
username => root
password => *****
pre-connect => yes
sanitysql => select 1
idlecheck => 3600
share_connections => yes
backslash_is_escape => no


[mysql]
enabled => yes
dsn => asterisk
username => root
password => *****
pre-connect => yes
[mysql2]
enabled => no
dsn => MySQL-asterisk
username => myuser
password => mypass
pre-connect => yes

[sqlserver]
enabled => no
dsn => mickeysoft
share_connections => no
limit => 5
username => oscar
password => thegrouch
pre-connect => yes
sanitysql => select count(*) from systables

backslash_is_escape => no


et extconfig.conf

[settings]
sippeers => odbc,general,sip_buddies
extensions => odbc,general,extensions

Le appels internes et externes marchent en enregistrant les extensions statiques, aucune de la base de donnée n'est chargée.

Toute aide ou suggestion est la bienvenue.