Re: Asterisk simply stops call processing

John Harragin <[email protected]>
Newsgroups gmane.comp.telephony.pbx.asterisk.user
Message-ID <CAEB6hR4-gJ_bffwSTRyYLUJx9AomW8YbJ9vwYCawGbd5D6PxLg@mail.gmail.com>
I've been having a related problem. I have Asterisk with some call
processing accessing Maria (hosted on the phone server, running Ubuntu) via
func_odbc. That same odbc driver is used to write cdr records on a
different server. I had never noticed a problem (and no threading attribute
defined) until after I did a system update several months ago.

Now if the ethernet cable is disconnected to the cdr server, call
processing then hangs when func_odbc trys to access the locally hosted
(same machine as asterisk) call process database. The zombied channels then
accumulate.

In my research, I read that the default threading value was changed in
unixodbc to assume that threading would be handled by the individual
odbc-drivers - rather than the odbc framework. Also, I read that unixodbc
has to be compiled with a threading directive set to yes for the
odbcinst.ini key-value to have any effect.

Anyway I am suspecting that the ubuntu unixodbc package is now compiled
without threading enabled.

This is happening on a production machine, so I am somewhat limited in when
& how much experimentation I can do. One thing I'd like to try is to
redefine the maria driver as maodbc-cdr in odbcinst.ini and see if it
exists in it's own thread?

root@phone:~# cat /etc/odbc.ini
[cdr-bmaria]
Driver          = maodbc
DATABASE        = cdr
DESCRIPTION     = MariaDB ODBC to remote-cdr-database
SERVER          = 192.168.1.11
UID             = cdr-reporter
PASSWORD        = secret
PORT            = 3306

[call-process-maria]
Driver          = maodbc
DATABASE        = phone
DESCRIPTION     = MariaDB ODBC local (to  self)
SERVER          = 192.168.2.22
UID             = dialplan-user
PASSWORD        = secret
PORT            = 3306

root@phone:~# cat /etc/odbcinst.ini
[maodbc]
Driver64        = /usr/local/lib64/mariadb/libmaodbc.so
Description     = MariaDB ODBC Connector
Threading       = 2



!!!!!!!!!!!!!!!!!! The proposed addition: - also changing the cdr-maria
conection key to Driver=maodbc-cdr
[maodbc-cdr]
Driver64        = /usr/local/lib64/mariadb/libmaodbc.so
Description     = MariaDB ODBC Connector



Anthony,
...anyway, enough about my problems. Have you put a:
Verbose(0, Your built out sql statement)
...before your ODBC application in both contexts to see if you just have
maybe an undefined variable creating a syntax error in your sql?

John



Here is a bit about odbc threads:
https://stackoverflow.com/questions/4207458/using-unixodbc-in-a-multithreaded-concurrent-setting







On Tue, Feb 28, 2023 at 9:02 AM Antony Stone <
[email protected]> wrote:

> On Wednesday 22 February 2023 at 15:29:38, John Harragin wrote:
>
> > If there are multiple connections that the utilize the same driver, try
> > putting:
> >
> > Threading       = 2
> >
> > in the appropriate driver section of
> > /etc/odbcinst.ini
>
> I'll give that a go, however I doubt that it is the problem, since I see
> the
> correct result from the ODBC query recorded in the assignment verbose log
> output, therefore the query is done and the result has been used by the
> time
> Asterisk freezes.
>
> > ...this would be a possibility if the problem is intermittent.
>
> It's actually extremely repeatable - I have not seen call processing
> proiceed
> beyond this stage once so far.
>
> > Also can you successfully execute the same SQL from the cli?
>
> Yes, and as I say, they query is working fine and Asterisk is correctly
> using
> the returned value in the assignment.
>
> The further detail which I think I added in a later post is that this is
> actually in a context which gets called using a Gosub() from two different
> places in the dialplan.
>
> From one, it works fine; from the other, it gets stuck.  Completely
> consistent.
>
> > By the way, what driver is asterisk using?
>
> You mean ODBC?  That's connected to MariaDB.
>
> > On Mon, Feb 20, 2023 at 11:12 PM Antony Stone wrote:
> > > Hi.
> > >
> > > I have a strange problem and I'm looking for suggestions on how to
> > > investigate it.
> > >
> > > I have a dialplan which is processing a call, and Asterisk simply stops
> > > doing anything for that call.
> > >
> > > I have verbose and debug logging turned on.
> > >
> > > There are two steps at a particular point in the dialplan:
> > >         Set(UserCredit=${ODBC_GENERIC(select Credit('${DDI}'))})
> > >
> > >         Verbose(6,Current credit level for user ${DDI} is ${UserCredit}
> > > pence)
> > >
> > >
> > > Everything gets processed up to and including the first line - the
> > > verbose log file shows me:
> > >
> > > pbx.c:2946 in pbx_extension_helper: Executing
> > > [0044xxxx509903@DialBleg:46]
> > > Set("SIP/TrunkTwo-00001184", "UserCredit=999") in new stack
> > >
> > > (Phone number obscured here for anonymity).
> > >
> > > Then, that is it.  Nothing further happens with call processing (until
> > > one of the parties hangs up) and the second dialplan command above
> never
> > > appears in the verbose log file.  I have several other Verbose(6,.....)
> > > commands preceding this, and they all output into the log file as
> expected.
> > >
> > > If another call arrives on the same server, Asterisk quite happily
> starts
> > > processing it and records what it's doing in the log files.
> > >
> > >
> > > Can anyone suggest how I can investigate what Asterisk is doing at the
> > > point where it "gets stuck", and how to find out why it simply stops
> > > processing the call and doesn't continue with the dialplan commands?
> > >
> > >
> > > Thanks,
> > >
> > >
> > > Antony.
>
> --
> Why are they called "The Rocky Mountains"?
> What are other mountains made of?
>
>                                                    Please reply to the
> list;
>                                                          please *don't* CC
> me.
>
> --
> _____________________________________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>
> Check out the new Asterisk community forum at:
> https://community.asterisk.org/
>
> New to Asterisk? Start here:
>       https://wiki.asterisk.org/wiki/display/AST/Getting+Started
>
> asterisk-users mailing list
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-users

-- 
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --

Check out the new Asterisk community forum at: https://community.asterisk.org/

New to Asterisk? Start here:
      https://wiki.asterisk.org/wiki/display/AST/Getting+Started

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.