Fix problems with zero message numbers, and make sure that the interface message number gets set to zero when it is not in use.
This commit is contained in:
parent
2ecb9846cb
commit
3f5395c6d9
15
chan_capi.c
15
chan_capi.c
|
@ -59,7 +59,7 @@
|
||||||
*/
|
*/
|
||||||
static unsigned capi_ApplID = 0;
|
static unsigned capi_ApplID = 0;
|
||||||
|
|
||||||
static _cword capi_MessageNumber = 1;
|
static _cword capi_MessageNumber;
|
||||||
static char *desc = "Common ISDN API for Asterisk";
|
static char *desc = "Common ISDN API for Asterisk";
|
||||||
#ifdef CC_AST_HAVE_TECH_PVT
|
#ifdef CC_AST_HAVE_TECH_PVT
|
||||||
static const char tdesc[] = "Common ISDN API Driver (" CC_VERSION ") " ASTERISKVERSION;
|
static const char tdesc[] = "Common ISDN API Driver (" CC_VERSION ") " ASTERISKVERSION;
|
||||||
|
@ -214,8 +214,15 @@ static _cword get_capi_MessageNumber(void)
|
||||||
_cword mn;
|
_cword mn;
|
||||||
|
|
||||||
cc_mutex_lock(&messagenumber_lock);
|
cc_mutex_lock(&messagenumber_lock);
|
||||||
mn = capi_MessageNumber;
|
|
||||||
capi_MessageNumber++;
|
capi_MessageNumber++;
|
||||||
|
if (capi_MessageNumber == 0) {
|
||||||
|
/* avoid zero */
|
||||||
|
capi_MessageNumber = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
mn = capi_MessageNumber;
|
||||||
|
|
||||||
cc_mutex_unlock(&messagenumber_lock);
|
cc_mutex_unlock(&messagenumber_lock);
|
||||||
|
|
||||||
return(mn);
|
return(mn);
|
||||||
|
@ -706,6 +713,7 @@ static void interface_cleanup(struct capi_pvt *i)
|
||||||
i->faxhandled = 0;
|
i->faxhandled = 0;
|
||||||
|
|
||||||
i->PLCI = 0;
|
i->PLCI = 0;
|
||||||
|
i->MessageNumber = 0;
|
||||||
i->NCCI = 0;
|
i->NCCI = 0;
|
||||||
i->onholdPLCI = 0;
|
i->onholdPLCI = 0;
|
||||||
|
|
||||||
|
@ -1956,6 +1964,9 @@ static struct capi_pvt *find_interface_by_msgnum(unsigned short msgnum)
|
||||||
{
|
{
|
||||||
struct capi_pvt *i;
|
struct capi_pvt *i;
|
||||||
|
|
||||||
|
if (msgnum == 0x0000)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
cc_mutex_lock(&iflock);
|
cc_mutex_lock(&iflock);
|
||||||
for (i = iflist; i; i = i->next) {
|
for (i = iflist; i; i = i->next) {
|
||||||
if ((i->PLCI == 0) && (i->MessageNumber == msgnum))
|
if ((i->PLCI == 0) && (i->MessageNumber == msgnum))
|
||||||
|
|
Loading…
Reference in New Issue