diff --git a/libpri.h b/libpri.h index 878a3f2..f4ef1eb 100755 --- a/libpri.h +++ b/libpri.h @@ -487,6 +487,9 @@ extern int pri_hangup(struct pri *pri, q931_call *call, int cause); #define PRI_DESTROYCALL extern void pri_destroycall(struct pri *pri, q931_call *call); +#define PRI_RESTART +extern int pri_restart(struct pri *pri); + extern int pri_reset(struct pri *pri, int channel); /* Create a new call */ diff --git a/pri.c b/pri.c index 0493dac..64fe5f8 100755 --- a/pri.c +++ b/pri.c @@ -247,6 +247,16 @@ static struct pri *__pri_new(int fd, int node, int switchtype, struct pri *maste return p; } +int pri_restart(struct pri *pri) +{ + /* Restart Q.921 layer */ + if (pri) { + q921_reset(pri); + q921_start(pri, pri->localtype == PRI_CPE); + } + return 0; +} + struct pri *pri_new(int fd, int nodetype, int switchtype) { return __pri_new(fd, nodetype, switchtype, NULL, __pri_read, __pri_write, NULL);