[Asterisk-Users] app_dbodbc segfault

Mike Machado mike at homelandtel.com
Fri Apr 30 12:05:02 MST 2004


Is anyone out there using app_dbodbc
(http://www.bkw.org/~brian/app_dbodbc.c)? Any problems with it?

I was able to get it all working, but it causes * to segfault every now
and then. It does not appear to be related to any specific function
(ODBCget,ODBCput,ODBCdel,ODBCdelltree). It is 100% repeatable. If I
noload the module, everything works fine, but when its running, after
calls to any of the applications, * will randomly segfault. The data is
going in and out of the database with no problems. I compared the code
to app_db.c, and its very similar. I cannot see anything that would be
causing it.

I am using latest CVS as of an hour ago. ODBC connection is to a mysql
database.

For what its worth, I ported app_dbodbc.c to a new app_dbmysql.c and
created MySQLget, MySQLput, MySQLdel and MySQLdeltree, and experience
the exact same problem. If anyone wants the app_dbmysql.c, let me know.


I am using this to implement the call forward examples found at
voip-info.org. extensions.conf snippit:


[macro-sipexten]

exten => s,1,SetVar(OrigNum=${ARG1})
                                                                                                                                                exten => s,2,ODBCput(CallReturn/${ARG1}=${CALLERIDNUM})
exten => s,3,ODBCget(temp=CFIM/${ARG1}) ; Get CFIM key, if not existing,
goto 104
exten => s,4,Goto(default|${temp}|1)   ; Unconditional forward
exten => s,5,Dial(SIP/${ARG1},20) ; 20sec timeout
exten => s,6,ODBCget(temp2=CFBS/${ARG1})  ; Get CFBS key, if not
existing, goto 107
exten => s,7,Goto(default|${temp2}|1) ; Forward on busy or unavailable
                                                                                                                                                
; No CFIM key
exten => s,104,Goto(s,5)
                                                                                                                                                
; No CFBS key - voicemail
exten => s,107,Voicemail(u${ARG1}) ; If no voicemail box for this user,
goto 208
exten => s,108,Hangup
                                                                                                                                                
exten => s,208,Playback(ss-noservice) ; Play no service message
exten => s,209,SayDigits(${ARG1})     ; and say back the number they
called
exten => s,210,Hangup
                                                                                                                                                



At startup:

 [app_dbodbc.so] => (Database access functions for Asterisk extension
logic)
  == Parsing '/etc/asterisk/odbc.conf': Found
       > app_dbodbc: dsn is MySQL-asterisk
       > app_dbodbc: username is asterisk
       > app_dbodbc: password is [secret]
       > app_dbodbc: Connected to MySQL-asterisk
  == Registered application 'ODBCget'
  == Registered application 'ODBCput'
  == Registered application 'ODBCdel'
  == Registered application 'ODBCdeltree'



Sample crash:


 -- Starting simple switch on 'Zap/23-1'
    -- Executing Macro("Zap/23-1", "sipexten|9161111111") in new stack
    -- Executing SetVar("Zap/23-1", "OrigNum=9161111111") in new stack
    -- Executing ODBCput("Zap/23-1", "CallReturn/9161111111=9162222222")
in new stack
    -- odbcput: family=CallReturn, key=9161111111, value=9162222222
       > app_dbodbc: Query Successful!
       > app_dbodbc: Query Successful!
    -- Executing ODBCget("Zap/23-1", "temp=CFIM/9161111111") in new
stack
    -- odbcget: varname=temp, family=CFIM, key=9161111111
       > app_dbodbc: Query Successful!
    -- odbcget: Value not found in database.
    -- Executing Goto("Zap/23-1", "s|5") in new stack
    -- Goto (macro-sipexten,s,5)
    -- Executing Dial("Zap/23-1", "SIP/9161111111|20") in new stack
Segmentation fault
smf-ast1:~# Ouch ... error while writing audio data: : Broken pipe



As I said, if I change these back to DBxxx, and noload app_dbodbc.so, no
problems at all. 100% repeatable. When I look in the astdb mysql table,
all the data that was ODBCput is there.

Thoughts?




More information about the asterisk-users mailing list