hello sirs(how to access a database)

General and Support topics relating to ViciDialNow and GoAutoDial ISO installers

Moderators: enjay, williamconley, Op3r, Staydog, gardo, mflorell, MJCoate, mcargile, Kumba, s0lid

hello sirs(how to access a database)

Postby acbhaskar123 » Sat Jun 04, 2011 1:49 am

plz tell me how to store database in asterisk.
i.e for example i want to access employee details database.
i tried it by using MYSQL application
[dbtest]

exten => _X.,1,MYSQL(Connect connid localhost asterisk dbpass Book1.xlsx)
exten => _X.,2,MYSQL(Query resultid ${connid} SELECT\ scriptname\ from\ mac2pin\ where\ userid=${CALLERIDNAME})
exten => _X.,3,MYSQL(Fetch fetchid ${resultid} AGIScript)
exten => _X.,4,MYSQL(Clear ${resultid})
exten => _X.,5,MYSQL(Disconnect ${connid})
exten => _X.,6,GotoIf($[${fetchid}]?7:9)
exten => _X.,7,AGI(${DefaultAGIScript},${EXTEN})
exten => _X.,8,Hangup
exten => _X.,9,AGI(${AGIScript},${EXTEN})
exten => _X.,10,Hangup


exten => 5005,1,Answer()
exten => 5005,2,Set(DB(test/data)=100)
exten => 5005,3,Set(NewVar=${DB(test/data)})
exten => 5005,4,SendText(${NewVar})
exten => 5005,5,Hangup()

even then also i could not able to connect to database
i used asterisk-addons (i have installed this)
i have added res_mysql.conf also.

[dbtest]

exten => _X.,1,MYSQL(Connect connid localhost asterisk dbpass asterisk)
exten => _X.,2,MYSQL(Query resultid ${connid} SELECT\ id\ from\ astdb\ where\ name=${CALLERIDNAME})
exten => _X.,3,MYSQL(Fetch fetchid ${resultid} AGIScript)
exten => _X.,4,MYSQL(Clear ${resultid})
exten => _X.,5,MYSQL(Disconnect ${connid})
exten => _X.,6,GotoIf($[${fetchid}]?7:9)
exten => _X.,7,AGI(${DefaultAGIScript},${EXTEN})
exten => _X.,8,Hangup
exten => _X.,9,AGI(${AGIScript},${EXTEN})
exten => _X.,10,Hangup

[mysqlcal]
exten => 555,1,Answer
exten => 555,n,MYSQL(Connect connid localhost myuser mypass db1)
exten => 555,n,NoOp(${id})
exten => 555,n,NoOp(${name})
exten => 555,n,MYSQL(Query resultid ${connid} INSERT INTO `astdb` (`id`) VALUES ('${CALLERID(id)}'))
exten => 555,n,MYSQL(Query resultid ${connid} UPDATE `astdb` SET `status` = \'ANSWERED\' WHERE `id`=${id} AND `name`=${name})


plz help me
thank u
ur's regards
Bhaskar reddy
acbhaskar123
 
Posts: 13
Joined: Wed Apr 27, 2011 4:16 am
Location: bangalore

Postby DhwaniTechnologies » Sat Jun 04, 2011 4:34 pm

Vicidial, Goautodial, OSdial Consulting | Hosted Solutions
Dhwani Technologies | info@dhwanitech.com | Skype: dhwanitech
DhwaniTechnologies
 
Posts: 46
Joined: Thu Oct 14, 2010 10:03 am
Location: US/India


Return to ViciDialNow - GoAutoDial

Who is online

Users browsing this forum: No registered users and 81 guests